Skip to content

SCIP call-graph adapter; Java measured vs scip-java; SCIP-vs-tsc cross-check (#3783) - #3838

Merged
squid-protocol merged 2 commits into
mainfrom
claude/optimistic-heisenberg-bta91d
Sep 26, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
claude/optimistic-heisenberg-bta91d

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

This closes #3783 (epic #3772). It evaluates SCIP as a shared route to compiler-grade call graphs, and uses it to measure Java.

The adapter: tests/tools/scip_callgraph.py

It turns any SCIP index into the call-graph contract.

  • Reading the index: a dependency-free protobuf reader, with no generated code and no protobuf package.
  • Edges: a reference in call position (f(, f<T>(, new X() inside a named callable's enclosing_range. The caller is the innermost named unit, so an anonymous function's calls belong to the named function around it (C8).
  • External calls: a callable defined outside the repo gives external.
  • Names follow the engine: a Java constructor takes its class's name, each overload keeps its own line, an anonymous class's methods are units, and abstract or interface methods are not.

Java: callgraph_refs.py registers scip-java 0.12.3 on gson

scip-java index re-runs the Maven build with a forked javac, and that failed on gson's -Werror build. So the adapter builds the index itself:

  1. one reactor mvn -fae compile dependency:build-classpath, which resolves the modules that depend on their sibling's snapshot;
  2. javac with the semanticdb-javac plugin, per module, main and test sources together, falling back to main alone;
  3. scip-java index-semanticdb.

All six modules are indexed: 259 files, 3,397 definitions, 7,858 edges. It takes about 45 seconds once the jars are cached. The pinned jars come from Maven Central, with retries for its 429s.

First numbers vs scip-java (gson, 7,858 reference edges):

strict (gated) overload-blind (baselined, not gated)
confident precision 59.8% (4,778 judged) 94.3%
recall 36.3% 58.4%
resolution recall 38.7%
external (JDK calls linked into gson) 473

1,653 of the 1,923 wrong links go to a different overload of the right method in the same class. The engine can't choose between them without argument types.

The scorer now reports that overload-blind view for OVERLOADED_LANGS, currently Java only. It's an additive sub-count of wrong, so Python's and TypeScript's numbers don't change; callgraph_check confirms that below.

Cross-check and the decision on #3783

I ran scip-typescript 0.4.0 on zod through the same adapter, then compared it edge by edge with ts_callgraph.js:

tsc 6.0.2 scip-typescript 0.4.0
edges 2,661 1,445
in both 1,394 1,394
agreement 52.4% of tsc's 96.5% of SCIP's
  • SCIP's edges are trustworthy, but it sees half the graph.
  • 88% of the gap is callers SCIP has no definition for: zod's inst.refine = (...) => member assignments, quoted keys, and object-literal methods.

Decision:

  • Use SCIP when the indexer runs the compiler and records definitions fully, as scip-java does.
  • Keep a native adapter where one sees more, as tsc does for TypeScript.
  • Run the same compare cross-check before adopting SCIP for any new language. It's documented in docs/graph_accuracy.md.

Wiring

  • CI: graph-accuracy-audit.yml gains JDK 21 (the pinned setup-java), a cache for the scip-java jars and ~/.m2, and a gate step for Java.
  • Session hook: .claude/hooks/session-start.sh pre-fetches the scip-java jars.
  • callgraph_check.py: the new tests added to its focused test list.
  • Docs: a new "Call resolution in Java, and SCIP" section in docs/graph_accuracy.md, the limits list in docs/function_call_graph.md, the README coverage passage (call resolution is now measured in 3 languages), the roadmap row, and the regenerated coverage chart.
  • Skills: the onboarding skill gets a "SCIP indexer" route and the OVERLOADED_LANGS note. The miss-sweep's known-pattern table gets the three Java patterns.

Findings filed (milestone 14), each sample checked in source

Type of change

  • Test and measurement tooling, CI and docs. No engine change.

CI checklist

  • python tests/tools/audit_check.py: all clear, format clean
  • New tests tests/tools/test_scip_callgraph.py (5). They build SCIP indexes by hand, so they need no JDK or network. Run as plain pytest from /tmp, and made Python 3.9-safe.

Differential Scan target

N/A: no parsing or engine code changed, so golden masters are unaffected.

Verification

python tests/tools/callgraph_check.py --skip crucible,tree-sitter:

PASS     gate:java          precision 59.8% (4778) recall 36.3% resolution 38.7%  [baseline 59.8% / 36.3% / 38.7%]
PASS     gate:python        precision 99.8% (1806) recall 51.6% resolution 97.5%  [baseline 99.8% / 51.6% / 97.5%]
PASS     gate:typescript    precision 99.9% (1520) recall 57.1% resolution 73.7%  [baseline 99.9% / 57.1% / 73.7%]
PASS     tests              312 passed
PASS     lint:ruff / lint:dead-key / lint:mypy / lint:format

Samples of external, unconfirmed, unmapped_dst and non-overload wrong were read against gson's source before the numbers were quoted. The findings above cite them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt


Generated by Claude Code

…s-check (#3783)

tests/tools/scip_callgraph.py turns any SCIP index into the call-graph contract
(dependency-free protobuf reader; call-position references inside a callable's
enclosing_range; external for callables outside the repo; engine naming for
constructors, overloads, anonymous-class methods, bodyless declarations).

Java is registered against scip-java 0.12.3 on gson (reactor mvn -fae compile
+ build-classpath, javac with the semanticdb plugin per module, index-semanticdb):
59.8% confident precision (4,778 judged), 36.3% recall. 1,653 of the 1,923 wrong
links are a different overload of the right method; the scorer now reports an
overload-blind view for OVERLOADED_LANGS (94.3% / 58.4%), baselined, not gated.

Cross-check: scip-typescript 0.4.0 on zod agrees with tsc on 96.5% of its own
edges but covers 52.4% of tsc's (member-assigned and quoted-key functions have
no SCIP definition), so TypeScript stays on tsc. CI gate, session hook, docs,
skills, README coverage and the coverage chart updated. Findings: #3835-#3837.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
@squid-protocol squid-protocol added this to the Compiler call-graph comparison milestone Sep 26, 2026 — with Claude
@squid-protocol squid-protocol added enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification labels Sep 26, 2026 — with Claude
Comment thread tests/tools/scip_callgraph.py Fixed
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 4e6b286 into main Sep 26, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the claude/optimistic-heisenberg-bta91d branch September 26, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Call-graph reference: evaluate SCIP on Java as a shared route for several languages

3 participants