Skip to content

codegraph fails to attribute call edges to CodeGraph class getters/methods, causing false dead-unresolved flags #1769

Description

@carlos-alm

Summary

codegraph roles --role dead --file src/graph/model.ts -T --json and codegraph fn-impact <method> -T --json report zero callers (totalDependents: 0) for several CodeGraph (src/graph/model.ts) methods/getters that are demonstrably called throughout src/. This is distinct from #1723 (which covers kind: parameter and interface-member type declarations that have no call edges by construction) — these are real class methods on a widely-used class with real call sites the resolver fails to attribute.

Repro

$ codegraph roles --role dead -T --file src/graph/model.ts --json

Flags (role dead-unresolved) among others:

  • CodeGraph.constructor
  • CodeGraph.directed (getter)
  • CodeGraph.nodeCount (getter)
  • CodeGraph.edgeCount (getter)
  • CodeGraph.nodeIds
  • CodeGraph.getEdgeAttrs
  • CodeGraph.successors
  • CodeGraph.predecessors
  • CodeGraph.neighbors
  • CodeGraph.outDegree
  • CodeGraph.inDegree

But grepping the codebase shows real call sites, e.g.:

  • graph.directed — 15+ read sites across src/graph/algorithms/** (bfs.ts, centrality.ts, shortest-path.ts, leiden/cpm.ts, leiden/modularity.ts, leiden/optimiser.ts, leiden/partition.ts, ...)
  • graph.nodeCount / graph.edgeCountsrc/features/communities.ts, src/graph/algorithms/louvain.ts
  • graph.successors(node)src/graph/algorithms/bfs.ts:11, src/graph/algorithms/tarjan.ts:25, src/graph/algorithms/shortest-path.ts:42
  • new CodeGraph(...) — 6 call sites in src/
$ codegraph fn-impact "CodeGraph.successors" -T --json
{ "totalDependents": 0, "direct": 0, "transitive": 0, "role": "dead-unresolved", ... }

Impact

codegraph roles --role dead / fn-impact are unreliable for the core CodeGraph model class — the class with the widest fan-out in the codebase reports zero callers for methods that are its primary public API, actively used. Any dead-code-driven cleanup pass risks deleting load-bearing graph-traversal methods if it trusts these results without manual grep verification.

Suspected cause

Call-edge resolution likely fails to attribute <var>.<method>(...) / <var>.<getter> accesses back to CodeGraph's declaration when the receiver variable isn't statically obvious as a CodeGraph instance (e.g. generic parameter names like graph, g, s.graph), unlike #1723 which is about type-level declarations never having call edges by construction. Needs investigation in the resolver/call-graph extraction layer (native + WASM) responsible for method-call attribution.

Discovered during

Titan-run grind phase 22 (fix/native-func-prop-1432/titan-grind --phase 22), while triaging codegraph roles --role dead --file src/graph/model.ts output as part of dead-symbol classification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions