You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
codegraph exports: dynamic-dispatch via registry object literal (LANGUAGE_REGISTRY) not credited as consumer #1779
Discovered during Titan audit (phase: gauntlet, date: 2026-07-02).
Description
codegraph exports <file> -T --json reports every per-language extractor entry function (e.g. extractRSymbols, extractDartSymbols) as a zero-consumer dead export. These functions are in fact referenced — via LANGUAGE_REGISTRY in src/domain/parser.ts, where each is assigned to an extractor property in an object literal and invoked later through dynamic property dispatch (registry[lang].extractor(...)), not a direct static call. The exports/dead-role analysis does not attribute a consumer edge for this registry-object-literal + dynamic-dispatch pattern, so it false-positives on every one of the 34 language extractors' top-level entry function.
Verified manually via grep in parser.ts for extractRSymbols/extractDartSymbols — both are demonstrably wired up and invoked.
Both report the top-level extractor function as a zero-consumer dead export despite being referenced via LANGUAGE_REGISTRY[lang].extractor(...).
This is a distinct root cause from #1724 (type-only imports not credited) and #1730 (renamed imports not credited) — here the consumer edge is missing because the reference is an object-literal-property assignment followed by dynamic dispatch through a computed property access, not any form of static import.
Already fixed — by #1771's value-ref reference-edge mechanism, which landed earlier in this same batch (commit 6515186, "fix: emit reference edges for function identifiers used as object-literal values"). No code change needed here.
Root cause overlap
#1771 fixed exactly this pattern: a bare function identifier used as an object-literal property value ({ resolve: someFunction } / shorthand { someFunction }), which previously produced no edge at all. The fix (collectObjectLiteralValueRefCall in src/extractors/javascript.ts, mirrored in crates/codegraph-core/src/extractors/javascript.rs) fires unconditionally on every pair AST node in any parsed JS/TS/TSX file, emitting a calls edge with dynamic=1, dynamicKind='value-ref' whenever the property value is a bare identifier resolving to a function/method.
LANGUAGE_REGISTRY's entries ({ id: 'r', extensions: [...], grammarFile: '...', extractor: extractRSymbols, required: false }) are structurally identical to that pattern — extractor: extractRSymbols is a pair node whose value is a bare identifier. src/domain/analysis/exports.ts's consumer query (kind IN ('calls', 'imports-type'), unchanged since #1724) already credits calls edges regardless of the dynamic/dynamicKind flags, so this flows through with zero additional changes — exactly the "reuse the existing calls kind" design #1771 called out.
Verification
Built this repo's own graph fresh from the current branch tip (native engine, then rebuilt with --engine wasm — both produce identical results) and ran the exact repro:
(The second consumer is a deliberate local duplicate of LANGUAGE_REGISTRY inside wasm-worker-entry.ts, for worker-thread cache isolation — same object-literal shape, also correctly credited.)
codegraph fn-impact confirms real transitive dependents for both:
Spot-checked every other extractor entry in src/extractors/*.ts (bash, c, clojure, cpp, csharp, cuda, elixir, erlang, fsharp, gleam, go, groovy, haskell, hcl, java, javascript's extractSymbols, julia, kotlin, lua, objc, ocaml, php, python, ruby, rust, scala, solidity, swift, verilog, zig) — all 34 languages show consumerCount: 2 with a non-dead role (core or utility), on both engines.
Repo-wide sweep confirms no false positives remain: codegraph roles --role dead -T --json reports 641 dead symbols, none named extract*Symbols.
Full verification gate: npm run lint clean (829 files), npm test full suite green (220 test files, 3589 passed, 30 skipped, 2 todo, 0 failed).
Activity
carlos-alm commentedon Jul 6, 2026
Already fixed — by #1771's value-ref reference-edge mechanism, which landed earlier in this same batch (commit 6515186, "fix: emit reference edges for function identifiers used as object-literal values"). No code change needed here.
Root cause overlap
#1771 fixed exactly this pattern: a bare function identifier used as an object-literal property value (
{ resolve: someFunction }/ shorthand{ someFunction }), which previously produced no edge at all. The fix (collectObjectLiteralValueRefCallinsrc/extractors/javascript.ts, mirrored incrates/codegraph-core/src/extractors/javascript.rs) fires unconditionally on everypairAST node in any parsed JS/TS/TSX file, emitting acallsedge withdynamic=1, dynamicKind='value-ref'whenever the property value is a bare identifier resolving to a function/method.LANGUAGE_REGISTRY's entries ({ id: 'r', extensions: [...], grammarFile: '...', extractor: extractRSymbols, required: false }) are structurally identical to that pattern —extractor: extractRSymbolsis apairnode whose value is a bare identifier.src/domain/analysis/exports.ts's consumer query (kind IN ('calls', 'imports-type'), unchanged since #1724) already creditscallsedges regardless of thedynamic/dynamicKindflags, so this flows through with zero additional changes — exactly the "reuse the existingcallskind" design #1771 called out.Verification
Built this repo's own graph fresh from the current branch tip (native engine, then rebuilt with
--engine wasm— both produce identical results) and ran the exact repro:(The second consumer is a deliberate local duplicate of
LANGUAGE_REGISTRYinsidewasm-worker-entry.ts, for worker-thread cache isolation — same object-literal shape, also correctly credited.)codegraph fn-impactconfirms real transitive dependents for both:Spot-checked every other extractor entry in
src/extractors/*.ts(bash, c, clojure, cpp, csharp, cuda, elixir, erlang, fsharp, gleam, go, groovy, haskell, hcl, java, javascript'sextractSymbols, julia, kotlin, lua, objc, ocaml, php, python, ruby, rust, scala, solidity, swift, verilog, zig) — all 34 languages showconsumerCount: 2with a non-dead role (coreorutility), on both engines.Repo-wide sweep confirms no false positives remain:
codegraph roles --role dead -T --jsonreports 641 dead symbols, none namedextract*Symbols.Full verification gate:
npm run lintclean (829 files),npm testfull suite green (220 test files, 3589 passed, 30 skipped, 2 todo, 0 failed).No commit needed — closing as already resolved.