Skip to content

Call-graph comparison: a reference-adapter contract, with a cached reference graph #3773

Closed

Description

@squid-protocol

Part of #3772.

What

Every language's reference should produce one JSON shape. call_graph_resolution.py's RefGraph already consumes it:

{ "tool": "...", "version": "...", "files": N,
  "defs":     [[path, name, line], ...],
  "edges":    [[caller_key, callee_key], ...],
  "external": [[caller_key, callee_name], ...] }   # optional: calls resolved only outside the repo
  • pyan3: gets an adapter that emits this shape (today it's read in-process).
  • ts_callgraph.js: already emits it.
  • Registry: a language maps to its adapter command and its pinned tool version.

Wiring

  • Corpus: a manifest (extending tests/import_graph_corpus.json) says which pinned repo each language is scored on.
  • Language names: call_graph_resolution.py <lang> then works for any registered language. Adding one means an adapter and a manifest entry, with no scorer change.
  • Baselines: per language, tests/call_graph_resolution_<lang>_baseline.json. The Python file keeps its current name.

Cache

The reference graph depends only on (repo commit, tool, tool version), not on the engine. So it's cached under the corpus directory, keyed on those three. Re-running a gate after an engine change should cost only the engine scan. zod's TypeScript graph was rebuilt about eight times during #3767.

Done when

  • Python and TypeScript go through the contract with unchanged numbers.
  • The cache hits on a second run.
  • Unit tests cover the loader and the cache key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature, sensor, or structural signaturetestingUnit, integration, and E2E pipeline verification

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions