Repository navigation
Call resolution Level 2: measure TypeScript against the compiler's type checker - #3761
Merged
Merged
Conversation
…pe checker call_graph_resolution.py only scored Python (vs pyan3). Add a `typescript` mode that scores the engine's fcall links against the TypeScript checker's own call resolution (new tests/tools/ts_callgraph.js, typescript pinned 6.0.2) on the pinned typescript repo of tests/import_graph_corpus.json (zod) -- the crucible's TypeScript samples are flattened, so no import would resolve. The pyan scorer becomes a shared _score() over a RefGraph; python numbers are unchanged (gate passes at the same baseline). The checker adds one verdict pyan cannot: `external`, a confident link for a call it resolves only outside the repo (`str.trim()` -> String.prototype.trim), reported as strict precision. zod: confident precision 99.6% (1,519 judged), strict 96.3% (52 external), recall 56.9%, resolution recall 73.7%. Baselined in tests/call_graph_resolution_typescript_baseline.json and gated in graph-accuracy-audit.yml. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Contributor
… without one The smoke suite failed on the runner's preinstalled global typescript, which is now 7.x -- the native Go port, whose npm package exports no createProgram or type checker. ts_callgraph.js crashed on `ts.sys.fileExists`. It now exits 3 with a message naming the fix ([email protected], what graph-accuracy-audit.yml installs), and the fixture test skips unless the package on NODE_PATH has the compiler API, and shows the script's stderr when it does fail. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
The compiler reports SourceFile.fileName with forward slashes on every platform, but the repo prefix came from path.resolve (backslashes on Windows), so every file would read as outside the repo there. Normalise the prefix, and fold case on win32. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
6 of 10 tasks
This was referenced Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Level 2 call-resolution check (
tests/tools/call_graph_resolution.py) only covered Python, scored against pyan3. This PR adds atypescriptmode. It scores the engine'sfcall_datalinks against the TypeScript compiler's own type checker, which knows which declaration each call andnewresolves to.tests/tools/ts_callgraph.js(new): builds ats.Programfrom every.ts/.tsxfile of a repo under its roottsconfig.json. It emits function defs, caller→callee edges, andexternalcalls (resolved only tolib.d.ts/node_modules). Thetypescriptversion is pinned at 6.0.2 (TYPESCRIPT_VERSION).--ciwarns if the installed version differs, and--regeneraterefuses to run.tests/import_graph_corpus.json(zod), fetched by the existingimport_graph_accuracy.py --fetch-only. language-crucible's TypeScript samples are flattened (28 files, one directory per repo), so no relative import would resolve._score()over aRefGraph. Python numbers are unchanged:python --cipasses at the same baseline. TypeScript adds one verdict pyan cannot give.externalmeans the engine linked a call that the checker resolves only outside the repo. It is reported asconfident_strict_precision_pct, which is baselined but not gated yet.graph-accuracy-audit.yml:npm install --global [email protected]plus a TypeScript gate step, using the same 0.5 pp tolerance.docs/graph_accuracy.mdgets a table row and a "Call resolution in TypeScript" section.docs/function_call_graph.mdhas updated limits.zod results (
tests/call_graph_resolution_typescript_baseline.json)The checker is a reference, not ground truth. It stays silent on
anyreceivers and on package imports, because zod isn'tnpm installed. Those links count asunconfirmed, neverwrong.Engine defects this surfaced (filed, not fixed here — this PR is measurement-only)
str.trim(),map.get()) links confidently to a same-named repo method viafile/import#3756: an untyped receiver's built-in call (str.trim(),map.get(),set.has()) links confidently to a same-named repo method. These are the 52externallinks.import { clone }vsimport * as schemas) #3758: a bare call to a named import resolves to a namespace import's same-named member.const Node = …per test) all resolve to one of them, not the enclosing scope's #3759: block-scoped same-name definitions (const Nodeper test) all resolve to one of them.async "array-objects"() {}asasync#3760: the methodasync "array-objects"() {}is extracted with the nameasync.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
python tests/tools/audit_check.py: ruff, format and dead-key are OK. mypy reports 4 findings, all in files this PR doesn't touch, from missingyamlstubs in the local env. ast-accuracy couldn't run because the local clone is shallow and has nov2.4.7tag.pytest tests/tools/test_call_graph_resolution_gate.py(run as plainpytestfrom an unrelated directory): 5 passed, including a livets_callgraph.jsfixture test that skips when node or typescript is absent.crucible_check.py/tree_sitter_accuracy_audit.pydon't apply.Differential Scan target
N/A (no engine change).
Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
Generated by Claude Code