Repository navigation
fix(blast-radius): rank changed files by churn before the cap; header states whole-diff totals - #208
Merged
Merged
Conversation
…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
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.
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 vsHEAD~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
added+removeddescending (path as tie-break) before any cap, so the cut lands on the smallest edits. Stable and deterministic.scanner.ProjectgainsDiffTotals(files, added, removed over the whole diff), set only whenFilesis a subset. The tree renderer then prints the whole-diff numbers and states the subset:Changed files: 20 shown of 59 (ranked by churn; raise --max-changed-files)when capped.diff.diff_totalscarries the whole-diff counts next to the existingchanged_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