Repository navigation
Description
Summary
A one-off study compared call-graph and file metrics from GitGalaxy against fix history in 8 C repositories, then a second wave of 22 repositories in C, Go and Java. Its raw outputs and scripts live only in a session scratch directory, so nobody can rerun it after an engine change. This issue turns it into a committed, rerunnable tool. It keeps the pre-registered hypotheses and their results (both waves), and it names the gaps a further round must close: a bug-introducing-commit method in place of keyword matching, a size-matched null, Kotlin and other languages, and committing the Go and Java attribution and the directory-matched null that wave 2 already used.
This is research tooling. It reads public repositories and writes results. It changes no engine output and no score.
Class: empirical validation studies of engine signals
The class is "an engine signal is compared with an outside measure, and the comparison is reproducible". Each member below is an existing tool or study, with its status. Members that already have a reproducible gate are listed so the new study is not built beside them by mistake.
| member | where | status for this class | note |
|---|---|---|---|
| tri-comparison (engine vs ctags / tree-sitter / other tools) | tests/tools/tri_comparison_chart.py, tri_comparison_ledger.py, docs/self_scan/tri_comparison_README.md |
handled (ledger-gated; a cell earns a badge only when its entries are validated) | the owner rule: a rate alone does not settle which measurement is correct |
| tree-sitter accuracy audit | tests/tree_sitter_accuracy_audit.py, tests/tree_sitter_accuracy_baseline_<lang>.json (about 40 languages) |
handled (baseline-gated) | structural extraction, not graph |
| call-graph resolution vs compiler references | tests/tools/call_graph_resolution.py, tests/call_graph_resolution_*_baseline.json (c, cpp, go, java, rust, typescript, ...), docs/graph_accuracy.md |
handled for 11 languages; C is scored against libclang and skips pointer calls (see the indirect-call issue) | C baseline: recall 50.8%, resolution recall 55.3% |
| call-graph accuracy and PR gate | tests/tools/call_graph_accuracy.py, graph_accuracy_plan.py, graph_ledger.py (epic #3799 open) |
handled / in progress | |
| import-graph accuracy | tests/tools/import_graph_accuracy.py, import_graph_accuracy_baseline.json |
handled | |
| DOOM-rosetta call-graph oracle | tests/tools/doom_rosetta_check.py, tests/tools/doom_speedrun/callgraph_oracle.py (#5630, #5874, #6266) |
handled for C/C++ on DOOM ports; function-pointer kind unscored | |
| family validity oracle (per-function signals) | tests/tools/family_oracle.py, family_oracle_ts.py (epic #8863 open) |
in progress | the same question as this study, for keyword families |
| fix-history vs graph and file metrics (this study) | not in repo; scripts in session scratch | not committed | this issue |
| ripple radius / repair radius (named causes, tree-sitter-verified functions) | temporal-crucible docs/sensor-overhaul/sensors/ripple_radius.md; wiki docs/wiki/08-28-blast-radius.md, 08-29-repair-radius.md; optional piece #8719 (open) |
exists in another repo; exploratory | overlaps this study's question; cross-reference, do not restate |
| exposure deltas over git history | epic #2982 (closed); exposure-history sibling repo; docs/validation.md |
handled elsewhere, per docs/ecosystem.md |
Decision for the owner: the same question is studied in temporal-crucible with named causes. Before this tool claims new results, reproduce one temporal-crucible result on the same repository. A rerun that agrees is the check that the tool is right.
The study as run (what the tool must reproduce)
- Repositories (C): development set curl, redis, nginx, openssl; fresh set libuv, libgit2, git, haproxy. Shallow since 2021-01-01. Test, doc and vendored directories removed before the scan. That removal is a data choice that changes the graph and must be a documented, flagged option, not a silent step.
- Engine: gitgalaxy at 981e9ec, scanned with
GITGALAXY_DISABLE_GIT_HISTORY=1. Graph =function_data+fcall_data(resolved rows only) from<repo>_galaxy_master.db. - Fix detection: commit subject matches a keyword set. Three definitions:
orig(fix/bug/cve/crash/overflow/leak/uaf/heap/stack...),B(fix/bug/regression minus memory words),D(any commit, as a churn control). - Function attribution: the git hunk-header name mapped to
function_data. Known limit, verified in the study script (study.py:36): the name regex takes the first identifier followed by(. That works for C headers. For Go (func (r *T) name() it returnsfunc; Java and C# need their own rule. Replace it per language; do not reuse it. - Null (wave 1): random fix-touched pairs repo-wide. Not directory-matched. Wave 2 added a directory-matched null (see below); the tool must report both.
- Model: Poisson regression on log(1+LOC) and log(1+complexity), fitted per repo and definition. Lift = observed / predicted. Pooled CI by within-repo bootstrap.
- Determinism: a rerun at the same engine SHA gave byte-identical raw output (the study recorded this). Keep that as an acceptance test.
Pre-registered hypotheses and their results
Written before the fresh repositories were scanned. The development set was not valid evidence for them, so read them against the fresh set.
| id | hypothesis (as pre-registered) | result, fresh set, def B | verdict |
|---|---|---|---|
| H1 | orchestrators (fan-in < 8, fan-out >= 8) have lift > 1 under def B, in a majority of fresh repos, CI excluding 1 | pooled 1.23x (1.14-1.32). Per repo: libuv 0.85 (0.62-1.22), libgit2 1.02 (0.66-1.43), git 1.20 (1.08-1.32), haproxy 1.24 (1.14-1.36). 2 of 4 repos with CI excluding 1, not a majority | pooled: pass. Per-repo majority clause: fail |
| H2 | lifecycle-named (free/close/destroy/...) AND fan-in >= 8 have lift > 1 under def B, majority of fresh repos (pooled CI excluding 1) | pooled 1.26x (0.72-1.91); per repo the subset is too small in 3 of 4; haproxy 1.31 (0.72-2.02) | fail |
| H3 | fan-out partial Spearman (controls LOC, complexity) with fix touches > 0 in a majority of fresh repos | +0.12, +0.05, +0.07, +0.19 (4 of 4 positive point estimates; per-repo significance not reported in the output) | pass on the sign; significance not established per repo |
| H4 | consumer-ish (fan-in ratio < 0.2) has lift > producer-ish (> 0.8) under def B | pooled consumer 1.14x (1.08-1.21) vs producer 0.73x (0.62-0.84); consumer > producer in 4 of 4 repos | pass |
| time split | H1 and H2 hold in both halves on the original four repos | development set, def B: orchestrators older 1.24x*, newer 1.17x* (H1 holds). Lifecycle with fan-in >= 8: older 0.87x (0.29-1.52), newer 2.08x (1.29-2.77) | H1 holds; H2 fails in the older half |
Also reported, not pre-registered: the any-commit control gives orchestrator lift 1.29x (fresh set) and about 1.23x (development set), so the orchestrator effect is general change-proneness, not specifically bug-proneness. The lifecycle effect is a churn effect (any-commit control 1.64x). The fix-definition-dependent lifecycle result was withdrawn in the study.
Note: the earlier summary said "H1 pass". Per the per-repo clause above, H1 passes only pooled. The rerun must state the per-repo result.
The tool (proposal)
- Location:
tests/tools/fix_ripple_study.py(analysis, the same place astri_comparison_*andfamily_oracle.py), plustests/tools/test_fix_ripple_study.pyon a synthetic fixture repo built intmp_path. No corpus in CI. Write-up and pre-registration indocs/research/(docs/research/README.mdgets a row). Results JSON indocs/research/is already whitelisted (.gitignore!docs/research/*.json). A pin file undertests/needs an explicit whitelist line:*.jsonis ignored (.gitignore:99) andtests/*_baseline*.jsondoes not match a pin file name. - Pins: one committed manifest with repository name, URL, and commit SHA for each repository (not a branch). Clone into a sibling directory (for example
../fix-ripple-corpora/<name>), never inside the repo (CLAUDE.md, "Ghost Clones"). Scratch and caches go under/tmp/gitgalaxy-scratch/claude/. - Dependencies: the study script imports numpy and networkx. Neither is a project dependency (numpy was removed in Remove the XGBoost malware classifier and --fail-on-malware (owner 2026-11-19); docs say removed, research pending #8430; networkx is not in
pyproject.toml). Use the standard library and the engine's own graph code, or add an extra. No module-level optional-import fallbacks (CLAUDE.md). - Subprocess only: set
GITGALAXY_DISABLE_GIT_HISTORY=1in the child environment, not process-wide, so it does not leak into the test session (CLAUDE.md, "Never ... assign scan env vars"). - Imports: a
tests/toolsscript insertsREPO_ROOTonsys.pathbefore anygitgalaxyimport, with# noqa: E402. - Python: 3.11 floor. Run
ruff checkon the changed files with the pinned ruff. - Scans: galaxyscope on each pinned repository at its SHA. The study's preprocessing (test/doc/vendor removal) becomes an explicit flag, default off, recorded in the results JSON.
Acceptance
- Pre-registration first. Commit the four hypotheses and the decision rules as text (
docs/research/fix-ripple-preregistration.md) in a commit of their own, before any code that computes them. Record H1's per-repo result as it is. - Reproduces the study. On the fresh set at the study's SHAs and engine commit (recorded in the manifest), the tool reproduces the def-B table above to the printed precision. A rerun at the same SHA is byte-identical.
- Synthetic unit test. A tiny fixture repository with one known fix commit and a known call graph: the test asserts the 2-hop pair count and the lift by hand. This is the test that runs in CI; the corpora are not.
- Not a PR gate. It runs on demand or on a schedule, not on pull requests (CI cost;
.claude/rules/ci-workflows.md). If scheduled, measure its runner minutes in the PR body. - Cross-check. Reproduce one named-cause result from temporal-crucible on the same repository, with the same causes. If the two disagree, state why in the write-up before any claim.
- Extensions, each its own acceptance item (one mechanism: the study tool):
- a directory-matched null (same directory, similar size) next to the repo-wide null (wave 2 used same-directory matching; add the size matching);
- Go and Java hunk-header attribution (the first-identifier rule fails for
func (r *T) m(); wave 2 used git's built-ingolangandjavadiff drivers, which the tool must adopt, plus Kotlin; - a bug-introducing-commit method (blame of removed lines at the parent, as the
--blamesampling in gitgalaxy evolution extras: call-graph GIF, repair radius and blame sampling as optional pieces #8719 does) in place of subject keywords; - more repositories per language, with the same pins.
- Wording. The write-up states every limit: 8 C repositories, keyword detection, HEAD-only graph, hunk-header attribution, and the not-run items. No claim is stated as a risk claim.
- Third-party policy. Read-only analysis of public repositories (
docs/research/third-party-material-policy.md). No code, excerpts or corpora are committed. Each repository's licence is checked when it is pinned; any repository without a licence is not committed or quoted. - Cross-repo note. If a companion change lands in temporal-crucible, the PR carries a "Cross-repo" note naming it and the merge order (
docs/ecosystem.md). - Headless cap. Whoever picks this up unattended keeps the PR to 5 hand-written files (
.claude/rules/pr-file-cap.md). A suggested split: tool and test; pre-registration; manifest and.gitignore; write-up.
Wave 2: 22 more repositories (C, Go, Java), run after the first draft of this issue
Hypotheses were written before any wave-2 history was mined. Repositories: C (memcached, tmux, lua, libssh2, mbedtls, zstd), Go (caddy, prometheus, hugo, fzf, cli, traefik, grpc-go, gin), Java (commons-lang, commons-io, jsoup, jackson-databind, guava, mockito, maven; okhttp skipped because it is Kotlin and the miner reads only .java). Same method, fix definition "B" as primary, per-repo Poisson size baseline, random-effects pooling (DerSimonian-Laird) with a heterogeneity measure (I-squared). Go and Java function names come from git's built-in golang and java diff drivers (the C-only name regex returned func for Go).
| id | hypothesis | C | Go | Java |
|---|---|---|---|---|
| H1 | orchestrators lift > 1, pooled CI excludes 1 | pass 1.19x (1.04-1.36) | pass 1.21x (1.12-1.30) | pass 1.25x (1.09-1.42) |
| H1b | percentile definition (fan-out >= p90, fan-in < p90) agrees | pass 1.18x | pass 1.14x | pass 1.21x |
| H3 | fan-out partial correlation > 0 in a majority of repos | pass 6 of 6 | pass 8 of 8 | pass 7 of 7 |
| H4 | consumer-ish lift > producer-ish; consumer CI above 1 and producer CI below, or non-overlapping | pass 1.09x vs 0.76x | fail 1.14x vs 1.01x (producer not below 1) | pass 1.25x vs 0.71x |
| H5 | co-changed pairs within 2 call hops >= 1.5x a directory-matched null, in a majority of repos | pass 5 of 6 | fail 2 of 8 | fail 3 of 6 |
All 21 usable repositories: orchestrators 1.22x (1.15-1.29), I-squared 0.20; consumer-ish 1.16x (1.09-1.24), I-squared 0.64; producer-ish 0.82x (0.74-0.91); fan-out partial correlation positive in 21 of 21; fan-in median -0.03. The any-commit churn control gives similar lifts (orchestrators 1.19x), so these are change-proneness effects, not specifically bug effects. cli (Go) is an outlier (orchestrators 0.41x, producers 1.91x), probably near-identical command functions; keep it in, report it.
The lifecycle-named result was not retested (retracted after wave 1: a churn effect, unstable over time).
The tool must carry these results as its first regression fixture and must fail loudly if a hypothesis changes verdict after an engine change.
Evidence limits (state these in every write-up)
- 30 repositories: 14 in C, 8 in Go, 7 in Java (okhttp, Kotlin, skipped). Kotlin, Rust, C++, C#, JavaScript and Python were not run. The distance result uses a directory-matched null in wave 2 and for the 8 wave-1 C repositories; it is not size-matched.
- Fix commits detected by subject keywords (not verified fixes). The any-commit control shows the orchestrator effect is general change-proneness.
- HEAD-only call graph and file graph. Renamed functions and files are dropped by hunk attribution.
- Removal of test/doc/vendor directories is a choice, not a fact about the repositories.
- Effects of 10-25% are small. The results are associations and must not become a risk score.
Remaining siblings (not filed here)
Each is an acceptance item above, not a separate issue: directory-matched null, Go/Java attribution, bug-introducing commits, more repositories. Filed separately only if the write-up shows one of them needs its own mechanism.
Discrepancies to fix in the rerun
- The study's first C call-site row (total 31,925; external 39%) and its 13 curl cycles came from a first scan that still included
tests/; the test-free scans give total 22,994, external 42%, and 11 cycles. Record which directories were removed next to every number the tool prints.
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
tests/tools: fix-history vs call-graph study as a rerunnable C tool (…