Skip to content

fix(cfml): a <cfquery> or <cfscript> block that fails to parse no longer flags the file - #2843

Merged
colbymchenry merged 1 commit into
mainfrom
claude/issue-2654-cfml-embedded-parse-warning
Oct 23, 2026
Merged

colbymchenry merged 1 commit into
mainfrom
claude/issue-2654-cfml-embedded-parse-warning

Conversation

@colbymchenry

@colbymchenry colbymchenry commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

In a tag-based CFML file, a <cfquery> or <cfscript> block the parser can't read put this warning on the whole file: "parse produced no symbols (tree has errors) — the file is indexed but contributes nothing to the graph". codegraph init printed it and codegraph status counted the file among those "could not be parsed, so their symbols are missing", though the file's component, methods and calls were all in the graph. The reporter saw it on 66 DAO and gateway files.

The issue's own example SQL (SELECT <cfif arguments.fields IS "count">COUNT(*)<cfelse>p.*</cfif> FROM pages p) parses cleanly with the bundled query grammar, as do about 110 other query shapes tried, so the reporter's actual trigger was not reproduced. The fix doesn't depend on it: any <cfquery> body the query grammar can't read produced the warning (the repro uses EQV in a <cfif> condition, one shape it can't read), and so did a statement-only <cfscript> block with a syntax error.

Root cause

Both delegates in cfml-extractor.ts parse the block with its own grammar through a fresh TreeSitterExtractor and copied its errors onto the file. That extractor warns when its tree has errors and it produced no symbols, which describes the block, not the file, and a <cfquery> body never declares a symbol. extractTagExpressions already drops that warning for the same reason; the two delegates didn't.

Fix

The delegates record the block's warning as what it is: one naming the block and its line (<cfquery> at line 6 has a syntax error — the rest of the file is indexed, but calls inside that block may be missing from the graph), with line set and its own code, partial_parse. So codegraph files --json shows which block failed, while init no longer prints a whole-file warning and status no longer counts the file as one whose symbols are missing (both key on parse_error). Other errors pass through as before. A file whose whole source fails to parse still gets the old warning.

Validation

  • New __tests__/cfml-embedded-parse-warning.test.ts: the repro's DAO (class, both methods and the #getSiteId()# call inside the failing query are kept; one partial_parse warning names <cfquery> at line 6), a failing <cfscript> block, and getIndexHealth() no longer listing either file. All 3 fail on main's extractor and pass with the fix. status-index-health.test.ts passes.
  • On the repro, main prints ▲ appsettingsdao.cfc: parse produced no symbols … during init and status reports "1 file could not be parsed, so its symbols are missing"; with the fix, neither.
  • A/B against main f406fe0 (CFML has no kernel path), each arm built from its own sources:
    • CFML: FW/1 d7fb9add, BlogCFC 8758879a, ColdBox 13480b7c, ContentBox 7070b2c4, Preside a3d9028b and CFWheels 2b1a8a62: no change. In CFWheels' vendor/wheels core indexed as its own project (the default ignore skips vendor/), one file changed: tests/html.cfm, a template whose <cfscript> block at line 8 fails to parse, now records <cfscript> at line 8 has a syntax error … instead of the whole-file warning. Nodes, edges and references are identical in every repo.
    • Controls: express 0dee2c52 and flask d086db85 on the kernel path, full graph dumps byte-identical.
  • Index time: median of 4 interleaved runs, CPU with workers, main vs fix: Preside 57.1 / 54.5 s, Wheels core 33.2 / 32.8 s. Within noise; the change only rewrites an error record.
  • Full suite on the pushed commit 9fc2bc6 (rebased onto ef05970, whose test(daemon): the OS process lookup tests pass on a loaded Windows machine #2842 only touches daemon tests and process lookup), kernel built (CODEGRAPH_KERNEL_EXPECT=1): 752 files (746 passed, 6 skipped), 8,986 tests: 8,904 passed, 0 failed, 82 skipped. The pre-rebase head 35e6edc on f406fe0 also passed with 0 failures.

Fixes #2654

Left out

Making the bundled query grammar read more SQL is upstream work in tree-sitter-cfml, and without one of the reporter's files the shape that fails for them is unknown.

🤖 Generated with Claude Code

…ger flags the file

Both delegates in cfml-extractor.ts read a block with its own grammar
through a fresh TreeSitterExtractor and copied its errors onto the file.
That extractor warns "parse produced no symbols (tree has errors) - the
file is indexed but contributes nothing to the graph" when its tree has
errors and it found no symbols: true of the block, not of the file, and a
`<cfquery>` body never declares a symbol. So `codegraph init` printed the
warning and `codegraph status` counted the file among those whose symbols
are missing, though its component, methods and calls were indexed.
extractTagExpressions already drops the warning for the same reason.

Fix: the delegates record that warning as one naming the block and its
line, with code partial_parse, so `codegraph files --json` shows which
block failed while init and status, which key on parse_error, no longer
report the file. Other errors pass through unchanged.

The issue's own example SQL parses cleanly with the bundled cfquery
grammar, so the reporter's trigger was not reproduced; any query body the
grammar can't read (here `EQV` in a <cfif> condition) and any
statement-only <cfscript> block with a syntax error showed the same
warning.

Validation:
- New cfml-embedded-parse-warning.test.ts: the repro DAO keeps its class,
  both methods and the call inside the failing query, and records one
  partial_parse warning naming <cfquery> at line 6; a failing <cfscript>
  block likewise; getIndexHealth lists neither file. All 3 fail on main's
  extractor and pass. status-index-health.test.ts passes.
- On the repro, main prints the whole-file warning during init and status
  says 1 file could not be parsed so its symbols are missing; with the fix
  neither does.
- A/B vs main f406fe0: FW/1, BlogCFC, ColdBox, ContentBox, Preside and
  CFWheels unchanged; in Wheels' vendor/wheels core (indexed as its own
  project) one file changed, tests/html.cfm, whose <cfscript> block at line
  8 fails: its warning now names that block. Nodes, edges and references
  are identical in every repo. express and flask controls byte-identical.
- Index time, median of 4 interleaved runs, CPU with workers, main vs
  fix: Preside 57.1 / 54.5 s, Wheels core 33.2 / 32.8 s. Within noise.

Fixes #2654

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@colbymchenry
colbymchenry force-pushed the claude/issue-2654-cfml-embedded-parse-warning branch from 35e6edc to 9fc2bc6 Compare October 23, 2026 12:21
@colbymchenry
colbymchenry merged commit 6500a37 into main Oct 23, 2026
@colbymchenry
colbymchenry deleted the claude/issue-2654-cfml-embedded-parse-warning branch October 23, 2026 12:32
danusha2345 pushed a commit to danusha2345/codegraph that referenced this pull request Oct 23, 2026
…mchenry#2843; superseded colbymchenry#2483 yields to main's colbymchenry#2837)

CFML includes/createObject/parse-failure handling and the `export type *`
preParse from main; our colbymchenry#2483 (the same blanking, by a narrower rule) and its
test are dropped in favour of colbymchenry#2837, status-index-health takes main's
merge-conflict fixture, resolution/index.ts keeps both sides' imports.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CFML: misleading "parse produced no symbols" warning when only an embedded <cfquery> block fails to parse

1 participant