| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…es (#2389) <Header /> and Factory.create(AppModule) produced no reference edge to Header/AppModule, causing systematic false dead-code across React (every component used as JSX) and NestJS (module/controller registration via NestFactory.create(AppModule)) codebases. Both patterns are extracted as value-ref dynamic calls, the existing mechanism already used for object-literal property values, instanceof operands, and logical-or/ternary fallbacks: - A JSX opening/self-closing element's tag name is credited as a reference to the component it renders, gated on JSX's own capitalization convention (lowercase = intrinsic DOM element, never a symbol reference). - A capitalized bare identifier passed as a call argument is credited as a reference to whatever it names. Restricted to capitalized identifiers specifically because issue #1741 is a regression guard proving that crediting an arbitrary lowercase DATA argument risks the global-fallback resolver binding it to an unrelated same-named function elsewhere in the repo, fabricating a call edge and a phantom cycle -- a class/component reference passed by value is overwhelmingly PascalCase in JS/TS convention, so this restriction satisfies #2389's request without reopening #1741. Mirrored in crates/codegraph-core/src/extractors/javascript.rs for engine parity. The WASM query-based extraction path required adding new tree-sitter query patterns scoped to only the javascript/tsx grammars (plain .ts has no JSX node types at all -- folding them into the shared TS pattern set would throw at Query-compile time) -- duplicated in both src/domain/parser.ts and the isolated wasm-worker-entry.ts, which intentionally keeps its own copy of these patterns to avoid importing parser.ts's non-worker-safe caches. A new query-vs-walk parity test case for a capitalized JSX tag would have caught the omission from the worker-entry copy immediately; verified it fails against the pre-fix worker-entry file before confirming the fix. docs check acknowledged: internal extractor bugfix, no README/CLAUDE.md/ ROADMAP surface area changed. Impact: 7 functions changed, 0 affected
Greptile SummaryThe follow-up replaces callee-shape-specific call-argument handling with a generic call-expression query capture, closing the previously reported WASM extraction gap.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
Source["JS / TS / TSX source"] --> Native["Native Rust extraction"]
Source --> Wasm["WASM query extraction"]
Source --> Walk["JavaScript walk fallback"]
Wasm --> Generic["Generic call_expression capture"]
Generic --> Args["Capitalized argument value-ref extraction"]
Native --> Output["ExtractorOutput calls"]
Args --> Output
Walk --> Output
Output --> Graph["Resolved graph reference edges"]
Reviews (2): Last reviewed commit: "fix(js/ts): route call-arg value-refs th..." | Re-trigger Greptile |
Sorry, something went wrong.
Codegraph Impact Analysis7 functions changed → 17 callers affected across 5 files
|
Sorry, something went wrong.
…capture (#2389) Greptile flagged that the query path's callfn/callmem/callsub captures only cover identifier/member/subscript callees, so expression-based callees like getFactory()(AppModule) never reached extractCallArgumentIdentifierRefs in WASM builds even though the walk path and native engine handle every call_expression unconditionally. Adds a generic (call_expression) @callarg_node capture (excluding super/this to match handleCallExpr's early returns) and moves the extraction there instead of duplicating it per callee shape. docs check acknowledged Impact: 1 functions changed, 2 affected
|
@greptileai please re-review — addressed the query-path callee-shape coverage gap by routing call-argument value-ref extraction through a generic (call_expression) capture instead of duplicating it per callee shape. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Two members of the "value-position reference produces no edge" family (#2257, #2260):
Both are structural, not edge cases: every React component used only as JSX read as dead, and NestJS's module/controller registration pattern (NestFactory.create(AppModule)) relies entirely on the second pattern — depressing caller coverage and inflating dead-code counts across every React/NestJS repo in the org rollout.
Changes
Both patterns are extracted as value-ref dynamic calls — the existing mechanism already used for object-literal property values, instanceof operands, and logical-or/ternary fallbacks (#1771/#1895/#2257):
Why capitalized-only for call arguments
This restriction isn't stylistic — it's load-bearing. Issue #1741 is an existing regression guard proving that crediting an arbitrary lowercase DATA argument (e.g. analyzeDrift(communities, communityDirs)) as any kind of reference risks the global-fallback resolver binding it to an unrelated same-named function elsewhere in the repo, fabricating a call edge and, transitively, a phantom cycle. My first pass at this fix did exactly that and broke 13 existing tests locally before I caught it. A class/component reference passed by value is overwhelmingly PascalCase in JS/TS convention, so restricting to capitalized identifiers satisfies #2389's request without reopening #1741 — verified all 13 previously-broken tests pass again with this restriction in place.
Engine parity
Mirrored in crates/codegraph-core/src/extractors/javascript.rs.
The WASM query-based extraction path required new tree-sitter query patterns scoped to only the javascript/tsx grammars — plain .ts (no JSX) has no JSX node types at all, so folding them into the shared TypeScript pattern set would throw at Query() compile time and break all .ts parsing. These patterns are duplicated in both src/domain/parser.ts and the isolated wasm-worker-entry.ts (which intentionally keeps its own copy to avoid importing parser.ts's non-worker-safe process-global caches) — I initially only updated parser.ts and the fix silently didn't work through the real WASM worker pool. A new query-vs-walk parity test case for a capitalized JSX tag catches exactly this class of omission; verified it fails against the pre-fix wasm-worker-entry.ts before confirming it passes with the fix.
Verification
Closes #2389