Skip to content

Persist external calls aggregated per (file, callee) in fcall_external (Part of #8529) - #8530

Merged
squid-shepherd[bot] merged 1 commit into
mainfrom
sensors/fcall-external
Nov 16, 2026
Merged

squid-shepherd[bot] merged 1 commit into
mainfrom
sensors/fcall-external

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

A scan counted its external calls (standard library, macros, third-party packages, built-ins; step none) in fcall_rate_data but stored none of them. New table fcall_external(src_file_id, callee, callers): one row per (calling file, callee name) for every call-kind external pair, callers = the calling functions (or top-level slices) in that file that make the call. Same pattern as fcall_candidates (#8161): created idempotently, wiped with the snapshot on a rescan, cascades off the calling file, nothing reads it into PageRank, fan-in or the file graph. fcall_data, the confident graph and fcall_rate_data are unchanged. Part of #8529.

Type of change

  • Other: a new scan table (recorder + doc + test); no parsing change

Measured (one snapshot each, this branch's engine)

repo fcall_external rows fcall_data rows sum of callers fcall_rate_data.external
curl 8,850 19,158 16,681 16,681
libgit2 8,072 41,428 20,881 20,881
prometheus 13,655 31,195 30,940 30,940

The table holds exactly the calls the rate table counts, in far fewer rows than adding them to fcall_data (which would roughly double it). A test pins the equality. Most-called externals look right: curl DEBUGASSERT, free, Curl_cfree, failf; prometheus (Go) NoError, len, Equal, append.

What it is for

Scoping a rename or removal of a name the repository does not define. Check: on curl, the parent of 193cb00ce9 (free to curlx_free, 471 files touched), the scan lists free in 168 files; the commit changed free( calls in 161 and 157 are in both (recall 0.98, precision 0.93; misses are macro definitions). The reader is a read-only command in a follow-up PR.

Class / Sibling gaps

Class: every call the resolver classes as external (step none, counted in fcall_rate_data.external) and previously dropped at insert, in every language: one rule in record_keeper, so all members are handled by this change: none left out for a language. Sibling gaps: (1) header include counts are a different mechanism (a parse of include directives, not the call resolver), tracked in #8529, not built here; (2) in Go and Python the callee string is a bare name, so same-named methods in different packages merge into one external row, the same limit fcall_data already has: a call-graph resolver matter, not this table's; (3) reference kind external pairs are not stored, the resolver keeps a reference only when the name is in scope for certain.

CI checklist

  • python tests/tools/audit_check.py passes
  • tests/tools_recorders (360 passed with the new file; 5 new tests, 4 fail without the change), tree-wide guards (289 passed, 1 skipped), time ratchet (35 tests, none near the limit)
  • Touches the scan output: python tests/tools/crucible_check.py passes in both modes (full precision and zero dependency); golden masters unchanged, no re-bless

Verification

$ python tests/tools/audit_check.py                         -- all clear
$ pytest -q tests/tools_recorders                           -- 360 passed
$ pytest -q <tree-wide guards from the worker protocol>     -- 289 passed, 1 skipped
$ python tests/tools/crucible_check.py                      -- full_precision PASS, zero_dependency PASS

Files (hand-written, 3): gitgalaxy/recorders/record_keeper.py, docs/function_call_graph.md, tests/tools_recorders/test_fcall_external.py.

🤖 Generated with Claude Code

https://claude.ai/code/session_018srRveGdV73aUiuqkipAic

…xternal

Calls the resolver cannot tie to a definition in the repository (standard library, macros, third-party packages, built-ins; step 'none')
were counted in fcall_rate_data but not stored, so a rename of such a name could not be scoped from a scan and caller lists were
incomplete. New table fcall_external(src_file_id, callee, callers): one row per (calling file, callee name), call kind only, cascading
off the calling file like fcall_data, wiped with the snapshot on a rescan. fcall_data, the confident graph and the rate table are unchanged.

Measured (one snapshot each): curl 8,850 rows (fcall_data 19,158), libgit2 8,072 (41,428), prometheus 13,655 (31,195); the sum of
callers equals fcall_rate_data's external count exactly in all three. Golden masters unchanged (crucible_check passes, both modes).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 16, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

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