Skip to content

feat(#550): git co-change ranking signal#609

Merged
justrach merged 1 commit into
release/0.2.5825from
feat/issue-550-cochange
Jun 11, 2026
Merged

feat(#550): git co-change ranking signal#609
justrach merged 1 commit into
release/0.2.5825from
feat/issue-550-cochange

Conversation

@justrach

Copy link
Copy Markdown
Owner

Signal 2 of #550 — step 1 of the two-step finish for the ranking lane (#531 pick 4's ranking half).

What

  • git.zig: parseCoChange — pure parser over git log --name-only --pretty=format:%H text (40-hex lines are commit boundaries; mega-commits >32 files and git-quoted exotic names skipped as co-change noise) → per-file top-8 partner lists by shared-commit count. buildCoChange shells out via the existing cio.runCapture (bounded: 500 commits, 8 MB output cap); freeCoChange owns cleanup.
  • Explorer: lazy ensureCoChange (own mutex + attempted flag — a non-repo root never re-shells; setRoot now also keeps the root path). coChangeBoost folds it into both ranking paths: files that historically change together with the files defining the queried symbol get a ≥1 multiplier — noise floor 2 shared commits, saturating at 8 → ×1.25. The temporal sibling of the call-graph distance boost from feat(#546,#550): defines-first tier0 candidates + call-graph distance ranking #608.
  • Cost discipline: seeds are defining files only, so plain-word queries never trigger the one-time git log shell-out (~200 ms on this repo, once per process; the warm daemon pays it once ever). CODEDB_NO_COCHANGE opts out.
  • Tier 0's defines scan now shares the new fileDefinesSymbol helper (one impl).

Tests

  • issue-550: parseCoChange builds bounded per-file partner lists — pure-fn parser test: pair counting across commits, mega-commit skip, count-desc ordering, max_partners truncation.
  • issue-550: co-change partner of the defining file outranks an unrelated equal-lexical file — injected co-change map; partner and stranger are lexically identical, only history distinguishes them.
  • Live A/B on this repo (CODEDB_NO_COCHANGE=1 vs off): identical recall, definition-first order preserved, no crashes against real git history.

Suite: 813/813.

🤖 Generated with Claude Code

git.zig gains parseCoChange — a pure parser over git log --name-only
--pretty=format:%H output (commit boundaries detected as 40-hex lines,
mega-commits and git-quoted names skipped) — plus buildCoChange (shell
out via cio.runCapture, bounded: 500 commits, 32 files/commit, top 8
partners/file) and freeCoChange.

Explorer builds the map lazily (ensureCoChange, own mutex, attempted
flag so a non-repo never re-shells; root path captured in setRoot) and
folds it into both ranking paths as coChangeBoost: files that
historically change with the files DEFINING the queried symbol get a
>=1 multiplier (noise floor 2 shared commits, saturating at 8 -> x1.25).
Seeds are defining files only, so plain-word queries never trigger the
one-time git shell-out. CODEDB_NO_COCHANGE opts out. The tier0 defines
scan now shares the new fileDefinesSymbol helper.

Suite: 813/813.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 106860 108816 +1.83% +1956 OK
codedb_changes 13465 10299 -23.51% -3166 OK
codedb_context 1769751 1775532 +0.33% +5781 OK
codedb_deps 375 313 -16.53% -62 OK
codedb_edit 39769 40831 +2.67% +1062 OK
codedb_find 8858 9748 +10.05% +890 NOISE
codedb_hot 27029 24500 -9.36% -2529 OK
codedb_outline 38546 37010 -3.98% -1536 OK
codedb_read 15898 18455 +16.08% +2557 NOISE
codedb_search 28871 28120 -2.60% -751 OK
codedb_snapshot 68475 72053 +5.23% +3578 OK
codedb_status 8801 12379 +40.65% +3578 NOISE
codedb_symbol 48586 48734 +0.30% +148 OK
codedb_tree 37325 37595 +0.72% +270 OK
codedb_word 11856 11518 -2.85% -338 OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant