Repository navigation
gitgalaxy reach: caller counts, header include counts and the scope of a name from a finished scan (Part of #8529) - #8532
Merged
Conversation
…f a name from a finished scan (read-only) New post-scan command 'gitgalaxy reach SCAN_DB [--src ROOT] [--callee NAME]' (gitgalaxy/tools/sensors/reach.py): per source file, distinct caller files, caller functions and callers one hop out from fcall_data; per header, the files that #include it, resolved by path; tied calls (fcall_candidates) shown beside the count as possible callers; --callee NAME lists who calls a name, from fcall_data when the repository defines it and from fcall_external when it does not. Only kind='call' edges that resolve to one definition count; the rest are reported. Opens the database read-only; adds no column and changes no scan output. Wiki page 08-24. Part of #8529. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic
Contributor
Contributor
|
No description provided. |
This was referenced Nov 16, 2026
squid-protocol
added a commit
that referenced
this pull request
Nov 16, 2026
…can database; golden masters re-blessed (#8546) The LLM brief gets two short sections after 15 (call resolution): 16 "Reach (Who Depends On What)" (the five most-called source files and the five most-included headers, from gitgalaxy reach) and 17 "Libraries (What The Repository Leans On)" (the eight external libraries with the most files, from gitgalaxy libsurface; a C or C++ library only if it is in the shipped table, a discovered one only when an import names it). They read the master database galaxyscope has just written, passed to generate_artifacts as scan_db; absent without one, and a failure to read never stops the brief. No table, no column; the only scan output that changes is llm.md (a 35-line insertion in both golden brief fixtures). Reading a WAL-mode database read-only creates -wal and -shm files, which the documented scan output must not contain (test_cli_contract caught it): the sensors now open the database immutable when no -wal file is beside it (nothing is mid-write) and read-only otherwise. Closes nothing; follows #8544 (header counts from stored imports) and #8532. Claude-Session: https://claude.ai/code/session_018srRveGdV73aUiuqkipAic Co-authored-by: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 17, 2026
Merged
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
New read-only command
gitgalaxy reach SCAN_DB [--src ROOT] [--callee NAME] [--top N] [--all-roles] [--json FILE](gitgalaxy/tools/sensors/reach.py, wired intogitgalaxy/cli.pybesideassess). It reads a finished*_galaxy_master.dband reports who depends on a file: per source file the distinct caller files, caller functions and callers one hop out; per header the number of files that#includeit (resolved by path, so same-named headers in different folders stay separate; needs--src); files the call graph cannot see as "not measured" with a reason. Onlykind = 'call'edges that resolve to exactly one definition count, ties and ambiguous edges are reported as left out, and tied calls (fcall_candidates, #8161) are shown beside the count as possible callers.--callee NAMEscopes a rename or removal: who calls NAME, fromfcall_datawhen the repository defines it and fromfcall_external(#8530) when it does not; on a scan without that table it says so. The database is opened read-only, no column is added and no scan output changes, so no golden master moves. Part of #8529.Type of change
Measured
On three real scans the headline numbers match the research prototype (curl
lib/mprintf.c403 caller files, libgit2src/util/errors.c591, redissrc/zmalloc.c88); a run takes a fraction of a second. Scope check on curl: scanning the parent of193cb00ce9(freetocurlx_free, 471 files touched) and running--callee freelists 168 files; the commit changedfree(calls in 161 and 157 are in both (recall 0.98, precision 0.93). Exploratory validation of the underlying call graph over seven repositories: per function the engine's callers agree with a text search at Spearman +0.74 to +0.92 with precision 1.00 (about half of a text search's callers are found); for headers call-based reach does not work, hence include counts.Class / Sibling gaps
Class: post-scan "who depends on this" questions answerable from
fcall_data,fcall_candidates,fcall_externaland the import lists the scan already stores, for any language that writes them. Handled here: source-file reach, header include counts for C-family sources, possible callers from tied calls, scope of a name. Sibling gaps: (1) header include counts are computed from the source tree at run time (--src) because the scan does not persist them: persisting them is the open item of #8529; (2) Go and Python call matching is by bare name, so same-named methods in different packages merge and counts there over-state reach: call-graph resolver work, not this command; (3) navigation and the Connectivity page edits for the new wiki page (docs/wiki/index.md, mkdocs.yml, 08-14) are a follow-up docs PR to stay within the 5-file limit; (4) a stable-foundations list and a combined recent-activity view are research prototypes, not in this command.CI checklist
python tests/tools/audit_check.pypassestests/tools/test_reach_sensor.py(13 tests), tree-wide guards (289 passed, 1 skipped),tests/tools(4,730 passed; 1 failure,test_l5_speedups::test_javac_session_compiles_live_and_rejects_stillborn, fails identically on unmodified main: this box's JDK has no javac), existingassessCLI tests (45 passed, 22 skipped), time ratchet (4,795 tests, none over the limit)Files (hand-written, 5):
gitgalaxy/tools/sensors/__init__.py,gitgalaxy/tools/sensors/reach.py,gitgalaxy/cli.py,tests/tools/test_reach_sensor.py,docs/wiki/08-24-reach-sensor.md.Remaining slices
docs/wiki/index.mdandmkdocs.ymlentries for 08-24, and the08-14-api-exposure.mdlimitation and measured-behavior text.Lessons for agents
pytest tests/tools/test_l5_speedups.py::test_javac_session_compiles_live_and_rejects_stillbornfails on a box whose JDK has nojavac; it fails the same on main, so it is not a regression in your change.🤖 Generated with Claude Code
https://claude.ai/code/session_018srRveGdV73aUiuqkipAic