fix(extraction): warn when parse errors leave no symbols (#1522) (#1799)

Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
This commit is contained in:
Colby Mchenry
2026-09-08 16:17:28 -05:00
committed by GitHub
co-authored by Colby McHenry
parent 4fd816b610
commit 7b339373b4
5 changed files with 159 additions and 0 deletions
+12
View File
@@ -584,6 +584,18 @@ export class TreeSitterExtractor {
if (packageNodeId) this.nodeStack.pop();
this.nodeStack.pop();
// hasError is routine for several grammars; warn only when no symbols survived.
const symbolCount = this.nodes.filter((n) => n.kind !== 'file').length;
if (this.tree?.rootNode.hasError && symbolCount === 0) {
this.errors.push({
message:
`${this.filePath}: parse produced no symbols (tree has errors) — ` +
`the file is indexed but contributes nothing to the graph`,
severity: 'warning',
code: 'parse_error',
});
}
} catch (error) {
const msg = error instanceof Error ? error.message : String(error);