Repository navigation
Description
Summary
Given one function, show the functions that call it and the functions it calls, out to two confident call hops, in one view with names, files, and the hop distance of each. Use it as a checklist when changing a function, and as a UI/report element. This is evidence for a presentation feature, not a risk score. The measurements below show that co-change lands within two hops somewhat more often than a directory-matched baseline (about 1.5x at the median across 28 repositories, weaker in Go and Java). They do not show that any function is more likely to be buggy, and the view must not carry a score or a colour that reads as one.
Class: change-impact views derived from the function call graph
The class is "given a function, what does a change to it touch?" Members share the same inputs (fcall_data confident rows, function_data) and differ in direction, depth, and scope.
| member | status | evidence |
|---|---|---|
Transitive upstream callers, depth-bounded (--depth, default 50), one direction per run |
handled | tests/tools/function_blast_radius.py:66 (main), :71 (--depth), :72 (--downstream); query in docs/function_call_graph.md (recursive CTE, ~line 225) |
| Transitive downstream callees, one direction per run | handled (unbounded by default) | same tool, --downstream; blast_radius() at :45 |
| Two-hop callers AND callees in one view, with hop distance and names | missing | no command or query returns both directions at once |
One-hop callers of a name, file-level counts (reach --callee) |
partial: file-level, callers only | gitgalaxy/tools/sensors/reach.py (scope() at :226); docs/wiki/08-24-reach-sensor.md |
| Functions touched by a diff, with callers named (one hop out) | partial: diff-driven, callers only | gitgalaxy/tools/sensors/change.py; docs/wiki/08-26-change-report.md; CLI wiring gitgalaxy/cli.py:43 |
func_fan_in / func_fan_out / func_pagerank |
scalar counts, not a neighbourhood | gitgalaxy/core/function_graph.py:85-87; columns gitgalaxy/recorders/record_keeper.py:969-971 |
| Repair radius (callers/callees within 1-2 calls, with baseline) | planned, optional evolution piece; research-stage | open #8719; docs/wiki/08-29-repair-radius.md |
| Hubs by callers and centrality in history | planned | open #8717 |
| Self-scan orientation queries ("what does X call") | handled as ad hoc SQL, not a view | .claude/skills/self-scan-query/SKILL.md |
Shared mechanism (in this issue's scope): a bounded recursive CTE over fcall_data, both directions, with the same confident-step rule. Members that already have it: function_blast_radius.py and the docs query. The gap is the combined two-hop view.
Out of this issue's scope (siblings, not filed here): the diff-driven change report, the history-based repair radius (#8719), and hubs in history (#8717). They read different inputs (git history or a diff).
Known inconsistency to fix in the same change: tests/tools/function_blast_radius.py:20 sets CONFIDENT = ('class', 'qualified', 'file', 'import', 'unique'), but the documented query in docs/function_call_graph.md (~line 230) also includes 'typed'. The tool and the doc disagree on which confident steps count. Pick one, and say which in the doc.
Evidence (what the view could show)
Source: two waves of repositories, engine 981e9ec, HEAD-only call graph, fix commits detected by commit-subject keywords (definition "B": fix/bug/regression, minus memory words). Pairs are functions changed together in one fix commit (up to 12 functions per commit). The observed share of pairs within two undirected call hops is compared with a directory-matched null: one member of the pair is replaced by a random fix-touched function from the same directory (same file when the observed pair is same-file). Wave 1: 8 C repositories (curl, redis, nginx, openssl, libuv, libgit2, git, haproxy). Wave 2: 6 more C, 8 Go and 8 Java repositories, with hypotheses written down before the history was mined. 28 repositories had at least 100 pairs.
| stratum | repos | median lift vs directory-matched null | repos with lift >= 1.5x | range |
|---|---|---|---|---|
| C, wave 1 | 8 | 1.6x | 5 of 8 | 1.4x-2.0x |
| C, wave 2 | 6 | 1.9x | 5 of 6 | 1.5x-2.4x |
| Go | 8 | 1.3x | 2 of 8 | 1.1x-1.7x |
| Java | 6 (mockito too few pairs) | 1.4x | 3 of 6 | 1.2x-2.1x |
| all | 28 | about 1.5x | 15 of 28 | 1.1x-2.4x |
Wave 1 per repo (share within 2 hops, observed vs directory-matched null): curl 45% vs 30%, redis 53% vs 26%, nginx 58% vs 42%, openssl 49% vs 28%, libuv 54% vs 27%, libgit2 67% vs 46%, git 62% vs 43%, haproxy 66% vs 34%.
Correction to an earlier summary. Against a repo-wide null of random fix-touched pairs, the same measurement gave 2x-18x on curl, redis, nginx and openssl. Most of that was directory adjacency. The pre-registered wave-2 hypothesis (lift >= 1.5x against the directory-matched null in a majority of repositories) passed in C and failed in Go and Java. The honest reading: co-change is above the directory baseline in every repository (never below 1.1x), but modestly, and not strongly in Go and Java.
Distance profile (wave 1, repo-wide null, so read it as a shape only): hop 1 holds 9-12% of pairs, hop 2 holds 37-51%, by hop 3 the rate equals the null, and 17-32% of co-changed pairs are more than 3 hops apart or unreachable. Chain length does not predict risk: depth-from-entry partial rho -0.10 to +0.04 (flat); height partial rho +0.03 to +0.17 (weak).
Limits (state them with every use of these numbers):
- The directory-matched null is not size-matched or call-density-matched. A stricter null (same file size band, same fan-in) has not been run.
- Refactors that change a signature also produce caller-plus-callee co-change, so part of the effect is refactoring, not repair.
- Unresolved function-pointer edges are missing from the graph (see the sibling issue on indirect calls), so the two-hop neighbourhood is a lower bound.
- Go and Java function attribution uses git's built-in
golangandjavadiff drivers to name the function of each hunk; Java overloads share a name and are all credited. Resolution quality of the Go and Java call graphs was not measured. - Fix detection is keyword-based. The graph is HEAD-only.
- Co-change reflects history, not the graph. Use the view as a checklist, not a prediction.
The same question is studied in temporal-crucible (docs/sensor-overhaul/sensors/ripple_radius.md, reported in docs/wiki/08-28-blast-radius.md and 08-29-repair-radius.md), which uses named causes (Fixes: lines) and tree-sitter-verified functions. Its headline is also "checklist, not prediction". Cite it rather than restate its numbers.
Proposed behaviour
- A read-only view, for example
gitgalaxy neighbourhood SCAN_DB FUNCTION [--file F] [--depth 2], or an extra section in an existing report. It prints two lists: callers and callees, each with hop distance (1 or 2), file, and the resolver step of each edge. - Confident steps only, as
docs/function_call_graph.mddefines them. Ambiguous rows are listed separately as "not followed", never as edges. - Shows counts, not a score. No colour scale, no risk word, no ranking by "fragility".
- Reuses
function_blast_radius.py's recursive CTE; do not write a second traversal.
Acceptance
- Additive, no score change. The view writes nothing into the scan DB and changes no existing column, score, or edge. Confirm by: (a) row counts and a checksum of
function_data,fcall_dataandfile_dataare identical before and after running the view on the same DB; (b)python tests/tools/crucible_check.py(or the golden-master audit) shows zero diff, so no golden re-bless is needed. A re-bless here would mean the change is not additive. - One traversal. The new view calls the shared recursive CTE. A test asserts that
neighbourhoodandfunction_blast_radiusreturn the same callers at depth 1 and 2 for one fixture DB. - Doc and tool agree on the confident steps. Resolve the
typedmismatch (see above) and add a test that pins the tuple the docs state. - A hand-checked sample. For 10 functions in one repo (for example curl's
Curl_closeandmulti_done), compare the two-hop lists with the source by hand. Record each mismatch with its cause. - Wording. The output header and the doc page say "neighbourhood (counts, confident links only)", never "risk", "fragility" or "impact score".
python tests/doc_refs_audit.py --cistays clean. - Headless worker cap. If picked up by an unattended worker, keep the PR to 5 hand-written files (
.claude/rules/pr-file-cap.md).
Remaining siblings (not filed here)
- Repair radius from named causes as an optional history piece: gitgalaxy evolution extras: call-graph GIF, repair radius and blame sampling as optional pieces #8719 (open).
- Hubs by callers and centrality in history: gitgalaxy evolution --db: growth, function lifetimes, hubs by callers and centrality, function types and their stability, comments #8717 (open).
- A "callers of a changed signature" check in
change: exists for signatures; no change to it here. - Indirect-call edges (function pointers, dispatch tables): see the sibling issue filed from the same study under the call-graph accuracy class.
Notes
- Not a duplicate: the closest open items are gitgalaxy evolution extras: call-graph GIF, repair radius and blame sampling as optional pieces #8719 and gitgalaxy evolution --db: growth, function lifetimes, hubs by callers and centrality, function types and their stability, comments #8717, which are history-based pieces of
gitgalaxy evolution, not a per-function view. Overlap noted; the caller should decide whether this is a sub-task of Epic: gitgalaxy evolution -- a one-page history of a repository, from git alone or with scans #8715. - Labels:
call-graphexists (no description in the repo label list); used as the area label.
Generated by Claude Code
Activity
squid-protocol commentedon Nov 22, 2026
Cross-links. These four issues came out of one study (fix history vs call-graph structure; 30 repositories in C, Go and Java). Read them together:
Order that makes sense: #8956 step 1 (hand-checked sample) tells us how far to trust the graph; #8957 and #8958 can land independently; #8955 should wait for the #8956 sample.
Generated by Claude Code