-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Found during dogfooding v3.0.0
Severity: Medium
Command: codegraph ast
Reproduction
npx codegraph build <repo> --engine native --no-incremental
npx codegraph ast --kind new # "No AST nodes found."
npx codegraph ast --kind string # "No AST nodes found."
npx codegraph ast --kind regex # "No AST nodes found."
npx codegraph ast --kind throw # "No AST nodes found."
npx codegraph ast --kind await # "No AST nodes found."
npx codegraph ast --kind call # 10703+ nodes foundExpected behavior
All 6 AST node kinds (call, new, string, regex, throw, await) should be stored when building with the native engine, matching the WASM engine behavior.
Actual behavior
Only call nodes are stored (24716 in the codegraph repo). The other 5 kinds are empty. The WASM engine correctly stores all 6 kinds for JS/TS/TSX files because it preserves the tree-sitter parse tree and performs a post-build AST walk in src/ast.js:buildAstNodes().
Root cause
The native Rust engine (crates/codegraph-core/) extracts only call_expression nodes (see src/extractors/javascript.rs). It does not preserve the parse tree, so the JavaScript-side AST walk in ast.js cannot extract new, string, regex, throw, and await nodes.
The JS-side code in ast.js checks for symbols._tree and only walks it for JS/TS/TSX files, but the native engine never sets _tree.
Suggested fix
Either:
- Extend the native Rust extractors to also capture
new_expression,string,regex_pattern,throw_statement, andawait_expressionAST nodes - Or document that
--engine wasmis required for full AST node coverage
Option 1 is preferred for engine parity.