Skip to content

fix(blast-radius): rank changed files by churn before the cap; header states whole-diff totals - #208

Merged
JordanCoin merged 3 commits into
mainfrom
fix/149-blast-radius-full-set
Oct 11, 2026
Merged

JordanCoin merged 3 commits into
mainfrom
fix/149-blast-radius-full-set

Conversation

@JordanCoin

Copy link
Copy Markdown
Owner

Problem (#149)

The changed-file cap (--max-changed-files, default 20) took the first files in scan order and the [diff] panel reported that subset's counts as if they were the change. On this repo vs HEAD~8:

before  changed_files=20/59
        │ Changed: 20 files | +807 -147 lines vs HEAD~8 │

The real change was 59 files, +3740 -355. The header contradicted the [summary] block, and the cut dropped the largest edits because they sorted late.

Change

  • Changed files are ranked by added+removed descending (path as tie-break) before any cap, so the cut lands on the smallest edits. Stable and deterministic.
  • scanner.Project gains DiffTotals (files, added, removed over the whole diff), set only when Files is a subset. The tree renderer then prints the whole-diff numbers and states the subset:
after   changed_files=20/59
        │ Changed: 59 files | +3740 -355 lines vs HEAD~8 | 20 shown, ranked by churn (--max-changed-files) │
  • The deps panel is filtered to the same files the diff panel shows, instead of an unrelated prefix of scan order.
  • Markdown summary line: Changed files: 20 shown of 59 (ranked by churn; raise --max-changed-files) when capped.
  • JSON: diff.diff_totals carries the whole-diff counts next to the existing changed_files_total.

Test

TestBlastRadiusCapRanksByChurnAndStatesTotals: two changed files, cap 1, the later-sorting file has the larger churn; asserts it is the one shown, diff_totals.files == 2, the header states both numbers, deps shows the same file, and the markdown line names the flag. Existing cap tests (...AnalyzesFullChangedSetBeyondCap, ...ImpactFooterMatchesShownFiles, ...ZeroCapIsConsistent) still pass; equal churn falls back to path order so their contract holds.

go build ./... && go test ./... && gofmt -l . clean.

Not changed: scanner/walker.go ordering (PR #203), the cap default, importer/hub-based ranking (churn is what the report measured; hub-ness can be a second key later).

Fixes #149

🤖 Generated with Claude Code

https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T

…whole-diff totals in the panel header

The changed-file cap (20) took the first files in scan order, so on a
52-file refactor it dropped the highest-churn file and the app entry
point while keeping tiny files that sorted earlier. The diff panel then
reported the subset's counts ("Changed: 20 files | +131 -112") as if
they were the change.

Changed files are now ordered by added+removed descending (path as the
tie-break) before any cap. Project carries DiffTotals when Files is a
subset, and the header reads "Changed: 59 files | +3740 -355 lines vs
HEAD~8 | 20 shown, ranked by churn (--max-changed-files)". The deps panel
is filtered to the same files the diff panel shows instead of a prefix
of scan order, and the markdown summary names the cap and the flag.

Fixes #149

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
Copilot AI balanced review requested due to automatic review settings October 11, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JordanCoin
JordanCoin merged commit de371e0 into main Oct 11, 2026
12 checks passed
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.

blast-radius truncates changed files alphabetically and presents the subset as the whole diff

2 participants