Repository navigation
Open
Labels
core-engineModifications to the central physics and parsing engineenhancementNew feature, sensor, or structural signaturepriority: mediumscope:infraCI, tooling, churn/factory, docs infrastructure
Milestone
Description
Why
The call graph and import graph feed PageRank, blast radius, popularity, dependency_density and call resolution. Until this week we measured them for only a few languages:
- Calls: 11 of ~36 applicable languages (
call_graph_accuracy.py). - Imports: 20 of ~32 (
import_graph_accuracy.py).
The first sweeps found real bugs quickly:
- Scala/Rust brace-selector imports split before the prefix is distributed (
a.b.{C, D}→a.b. C,D): Scala import recall 33% #3595–Shellsource "$VAR/path"resolves by bare stem: wrong edges to config.yml / lib/completion.bash, misses on repeated names #3598,_dependency_capturereads comments and docstrings: example imports become real edges (Dart, Perl, TS, Python) #3600, Statistical auditor's Packed Payload Guard drops re-export__init__.pyfiles from the scan (flask's package root vanishes) #3583, Kotlin func_start misses extension functions with a generic receiver (Collection<X>.name,fun <T> List<T>.name) #3608, PHP_dependency_capturecaptures multi-line code blocks as import tokens #3609. - #3332 follow-up: ruby calls_out misses paren-less calls and ?/! method names (Level-1 recall 33.7%) #3377: Ruby call recall was 34%, and the fix exposed that no Ruby method was ever attached to its class.
Scope: calls and imports only. Structural extraction (functions, classes, args) is out of scope; it has its own method.
Coverage today (engine main cfb9de91)
| measured | tree-sitter-comparable, not measured | |
|---|---|---|
| calls | c, cpp, csharp, go, java, javascript, php, python, ruby, rust, typescript | apex, dart, fortran, haskell, kotlin, lua, matlab, objective-c, perl, powershell, scala, swift, tcl, zig, groovy, solidity, ada, scheme, makefile, … |
| imports | c, cpp, dart, go, haskell, java, javascript, kotlin, lua, objective-c, perl, php, python, ruby, rust, scala, shell, solidity, typescript, zig | csharp, swift, fortran, matlab, powershell, tcl, apex, groovy, ada, css, html, dockerfile |
Approach: three referees per language
- Pinned repos (
import_graph_accuracy.py,call_graph_accuracy.py, as today): 2–3 repos per language in different styles. They give the benchmark number, the prevalence of each gap, and resolution effects that only a real tree shows. - Semantic truth, generated offline and committed as JSON: SCIP indexers (
scip-python,scip-typescript,scip-javafor Java/Kotlin/Scala,scip-go,rust-analyzer,scip-clang,scip-ruby,scip-dotnet). Where cheap, native resolvers too:dependency-cruiser,grimp,go list, Composer PSR-4.- This gives the first real Level-2 truth (does a call bind to the right definition?) beyond pyan3 for Python.
- Shape catalog (
tests/graph_shapes/<lang>/): numbered variants such asIMP-PY-012 from . import a as borCALL-RB-007 receiver-dot without parens.- Each variant is a tiny multi-file fixture with declared expected edges. There are also numbered decoys: the form inside a string, comment, or method name.
- Each entry has a status:
supported,gap #issue,out-of-contract (why)ortruth-bug. - The per-PR gate ratchets on the pass/fail grid.
- Seeding: from the grammar, from a shape miner, and from every bug found by the other referees. The miner runs tree-sitter / ast-grep with each grammar's
tags.scmover a broad sample (The Stack v2 or Software Heritage), and lists every distinct import/call shape by frequency.
A disagreement between referees is a lead, not a verdict (CLAUDE.md's comparative-correctness rule). Each goes through a verification ledger modelled on tri_comparison_ledger. This week our own ground-truth code was wrong twice (Kotlin importing Java classes, Scala backticks).
Steps
- 1. Disagreement bucketer. Classify each call/import FP/FN by syntactic shape, not callee name. Today's reports list
add,get,then; the bucketer should say "62% of JS FPs are callback attribution". - 2. Coverage sweep. Extend
call_graph_accuracyandimport_graph_accuracyto the unmeasured languages with the existing tools. Output: the full gap map, filed per language. - 3. SCIP pilot.
scip-typescriptagainst the JS/TS call precision gap (79.5% / 86.2%), andscip-pythoncross-checked against pyan3. The result decides whether SCIP truth is clean enough to adopt. - 4. Catalog runner, and shape miner. Seed Python, JS/TS and Ruby first.
- 5. Fix by shape ID, highest cost first.
- 6.
recheckstatic ReDoS analysis on changed patterns in PRs.
Fix checklists
Import graph:
- Add a failing catalog entry first.
- Decide which layer is wrong: capture, resolution, or the truth side.
- Capture fixes: anchored to statement position, one line unless the grammar requires more, bounded quantifiers with a ReDoS test. Flags go at the top level of the definition, not in
rules(orphaned_logic reports 100% dead code for five languages whose invocation model never names the callee — the family #2727 closed without covering #2806). - Check the side effects: firewall
imports_unknown, typosquat hits, local tokens. - Run
import_graph_accuracy --ci, then--regenerate. - Golden rebless with a scoped diff.
rosetta-audit: if it moves, addrosetta:rebless-owedand open the companion PR.- Mainframe ledger.
- Label the PR so the OS × Python matrix runs (Python 3.9 and Windows bugs only show there).
Call graph:
- Add a failing catalog entry first.
- Check the contract (
docs/calls_out_rule_contract.mdC1–C7): is it a call at all? - Decide which layer is wrong: Level-1 name, Level-2 resolution, or attribution (nested callbacks, class ownership). Fixing one layer often exposes the next, as with Ruby in fix(ruby): calls without parentheses, ?/! names, and methods owned by their class (#3377) #3637.
- Pattern changes: group 1 is the callee, register the pattern in
QUALIFIED_CALLS_OUT_PATTERNS, and check the qualifier and the C5 header. - Run
call_graph_accuracy --ciand regenerate;call_graph_resolutionwhere a reference exists. - Run rosetta
check_calls_out_truth. - Goldens: popularity and blast radius ripple, so scope the diff.
- Label for the matrix.
Out of scope
- Structural extraction (functions, classes, args).
- Languages with no tree-sitter grammar (mainframe, assembly). COBOL is covered by the mainframe answer keys instead.
Metadata
Metadata
Assignees
Labels
core-engineModifications to the central physics and parsing engineenhancementNew feature, sensor, or structural signaturepriority: mediumscope:infraCI, tooling, churn/factory, docs infrastructure
Activity
call_graph_accuracy --buckets: classify each disagreement by cause, n…
squid-protocol commentedon Sep 25, 2026
Decisions (2026-09-25, from the author)
1. Reconcile, don't grade.
callorimport, the bucketer's cause label, and the agreeing vs dissenting readers.credit_tools, using the same geometry astri_comparison_ledger.py:--ciregression gate;2. Separate ledger file.
docs/self_scan/graph_comparison_ledger.json.tri_comparison_ledger.py), same schema and lifecycle, samehow_to_investigate_a_discrepancy.md.3. Contract rulings (to be written into
docs/calls_out_rule_contract.md):call_graph_accuracydrops these calls today.(*T)(x)and[]byte(s)are conversions, not calls. tree-sitter's call nodes for them are tree-sitter-side verdicts.Data::Struct(x) =>in a match, andOk(t) =>/Err(e) =>match arms. The engine counting them is an engine defect.Step 1 of this epic is now: bucketer (done, pushed) → shapes → ledger → validated numbers, for calls first, then imports.
Generated by Claude Code
Graph comparison: reconcile calls like the tri-comparison -- ledger, …
Commit the graph comparison ledger (#3641)
Graph ledger: post-merge refresh workflow, 5 examples per shape (#3641)
Graph comparison: reconcile calls like the tri-comparison — ledger, v…
Graph comparison: imports join the ledger -- causes by layer, validat…
test_graph_ledger: skip the scala truth tests without tree-sitter (#3641
Import contract C7/C8; scala truth-side fixes take scala recall 51.6 …
Call-graph accuracy: measure kotlin, scala, swift, lua (Part of #3641) (
Call-graph accuracy: measure zig, dart, haskell, perl (Part of #3641) (…
squid-protocol commentedon Oct 24, 2026
Churn run
3641-20261024T0750Z(host melek) ended without a PR. plan approved, resumed as 3641-20261024T0753ZRegenerate graph coverage chart for solidity, apex (Part of #3641)
Call-graph accuracy: measure solidity, apex (Part of #3641) (#6415)
squid-protocol commentedon Oct 24, 2026
Churn run
3641-20261024T1228Z(host melek) ended without a PR. plan-held on overlap with 3799; requeuedMerge origin/main; regenerate graph ledger and chart (Part of #3641)
Call-graph accuracy: measure powershell and tcl callee names (Part of #…
squid-protocol commentedon Oct 24, 2026
#6480 merged: a partial slice of [c:bf495ed4] "2. Coverage sweep. Extend
call_graph_accuracyandimport_graph_accuracyto the unmeasured languages with the existing tools. Output: the full gap map, filed per language."; left: calls half done for powershell and tcl; groovy is unmeasurable here; the import half and the other unmeasured languages remain (promoter-bot)Import-graph accuracy: measure powershell and tcl (Part of #3641) (#6527
import_graph_accuracy: measure matlab imports (Part of #3641) (#6663)
squid-protocol commentedon Oct 25, 2026
#6663 merged: a partial slice of [c:bf495ed4] "2. Coverage sweep. Extend
call_graph_accuracyandimport_graph_accuracyto the unmeasured languages with the existing tools. Output: the full gap map, filed per language."; left: imports still unmeasured: apex, ada, css, html, dockerfile; matlab is measured but its engine recall is 0% (promoter-bot)