Skip to content

Call-graph reference: Go via golang.org/x/tools VTA on cobra (Part of #3782) - #6397

Merged
squid-protocol merged 3 commits into
mainfrom
churn/3782-go-callgraph
Oct 24, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/3782-go-callgraph

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3782 (epic #3772). Go call-graph reference on spf13/cobra, same pattern as the JS entry in #6392.

What changed

  • tests/tools/go_callgraph/ (main.go, go.mod, go.sum): type-checks the repo (tests included), builds SSA, emits the callgraph_refs contract from the golang.org/x/tools 0.37.0 VTA graph over a CHA seed.
  • tests/tools/callgraph_refs.py: go_contract, _go_version (needs Go 1.24+ on PATH), REFERENCES["go"].
  • tests/tools/test_call_graph_resolution_gate.py: fixture test (functions, pointer-receiver method, interface call, closure, generic, cross-package call, stdlib external); skips without Go.
  • tests/call_graph_resolution_go_baseline.json (generated) and the docs/graph_accuracy.md row + section.

Numbers (cobra @ pinned commit)

confident precision 99.3% (1,367 judged), recall 82.9% (1,636 reference edges), resolution recall 89.1%; 123 confident links land on a name the checker resolves to the standard library (strict precision 91.1%). Without _test.go in the reference 1,019 engine ends were unmapped; with them 2, so tests are included.

Class / Sibling gaps

Class: a language with a corpus repo in tests/import_graph_corpus.json but no registered compiler call-graph reference. Handled here: go. Gaps (not done, need their own tool/adapter): c (hiredis, libuv), cpp (fmt), lua, php (guzzle), and any other corpus language without a REFERENCES entry; javascript is #6392. CI gap: graph-accuracy-audit.yml has no Go setup step nor a go gate line (workflows untouched here), so the baseline is not CI-enforced yet.

Gates

pr_gates --fast 7/7. --ratchets 9 pass, 0 fail, 0 skipped. No engine change, no golden bless.

Cross-repo

None. #6392 touches the same three shared files; whichever merges second merges main (hunks are adjacent, not overlapping).

Lessons for agents

  • ssa.Function.Origin() is nil for a non-generic function: don't treat nil as "no function".
  • With InstantiateGenerics an instance is Synthetic with a nil Parent: skip wrappers only when Origin() == nil too.
  • A compiler reference that omits _test.go leaves most engine links unmapped; include tests if the engine scans them.

🤖 Generated with Claude Code

squid-protocol and others added 3 commits October 24, 2026 03:02
…3782)

Adds the go_callgraph helper, the callgraph_refs.REFERENCES["go"] entry and
adapter, a fixture test, the cobra baseline and the graph_accuracy.md section.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 24, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 24, 2026 07:19
@squid-protocol
squid-protocol enabled auto-merge (squash) October 24, 2026 07:20
@squid-protocol
squid-protocol merged commit 9e4d83e into main Oct 24, 2026
54 checks passed
@squid-protocol
squid-protocol deleted the churn/3782-go-callgraph branch October 24, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant