Repository navigation
Pair a change's most alike lines as the desktop does - #80
Conversation
@pierre/diffs splits a change with more lines on one side so the lines that pair are the most alike, and the desktop runs it on every patch. The Code tab now does the same, stacked and side by side, and stacks each part's lines removed before those added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ain after a theme change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge recipe Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… more toolbar rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in the Code recipe Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reader.rs's removed self.load_unchecked() now pairs with the added self.load(), the line most like it, so the split steps wait for the comment added above it on a row of its own, and a check on the sideways capture holds the stacked order: the comment, then the removed line, then the added one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… count at the highest line number Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in the boundary unfold test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e before the whitespace steps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…un while the file's text is read, tests that no hunk is read once the whitespace steps run out and brings #68's fix that lays review threads out again when the theme changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ments out again when the theme changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
PASS+NOTES for head
Regression sweep: each checkout's own smoke passed 13 of 13 recipes on both base and head. Current master Rules: live and after-stop checks passed. The identical settled Code flow has the same CI: macOS, E2E smoke, Linux build and Greptile checks passed on this exact head. Greptile: no review threads or new head findings; 5/5 review completed. Evidence: I downloaded @pierre/diffs 1.5.2 into Product binaries driven, with LC_UUID:
The existing f78d5f7 cache was reused. Each newly built head logged Notes, inherited verification mismatches only:
No product findings and no required claim left inconclusive. No PR source, branch, merge state or author fix was changed. |
Pairs the lines of an uneven change by how alike they are, as the desktop's diff does, rather than the first removed beside the first added.
code/align.rsports @pierre/diffs 1.5.2'srealignChangeBlock(dist/utils/realignChangeContent.js), with its bound of 4,096 comparisons and its half point a pair in favor of the order the patch has.self.load_unchecked()now pairs with the addedself.load(), so the split steps wait for the comment added above it on a row of its own. A check on the sideways capture holds the stacked order: the comment, then the removed line, then the added one (47cb8fc).Stacked on #79.
All four come from the fixture server at 120x48. The before shots use #79's head, aa47159.
self.load()shares 11 of the 21 code units inself.load_unchecked(), 0.52, and the comment shares none. The pair in order scores 0 plus the half point, so pierre moves the comment ahead.Decision log
What I noticed. docs/pull-request-panel.md listed as a known limit that "a run of changes that removes more lines than it adds, or adds more than it removes, shows as git wrote it", where the desktop moves the lines left over to line up the most alike lines.
How I confirmed it. @pierre/diffs 1.5.2's
parsePatchFilescallsrealignChangeContentBySimilarityon every file it reads (dist/utils/parsePatchFiles.js:296).parseDiffFromFileruns the same_processFile, so the desktop's whitespace filter, which calls it (apps/web/src/lib/diffRendering.ts:99), splits changes too. The PR Code tab reads its slices throughgetRenderablePatch(PullRequestCodeTab.tsx:395), which callsparsePatchFiles.iterateOverDiffstacks each part's deletions before its additions (dist/utils/iterateOverDiff.js:440-446), so a split changes the stacked order as well as the pairs.Options.
hunkContentholds them, and have both layouts read the parts.stackedandpairsshare one walk, so the two can't disagree.What review changed. Greptile scored it 5/5 on 76b05d1 and found nothing to change.
71b0d34 and c1af472 merge #79 at 3731cd9 and c798b74, which bring #66's fix for a hunk that removes nothing at the highest line number (8073497) and its test, with the same patch.
00f9864 merges #79 at 2743a8d, which returns from the Timeline before #75's whitespace steps (d9fd767), with the same patch.
77fe142 and ab66976 merge #79 at 58529f0 and 14ee77c, which bring #72's fix that counts each Enter on a run while the file's text is read, #75's test that no hunk is read once the whitespace steps run out, and the fixes that lay a thread's comments and its loaded pages out again when the theme changes (#68's ad1590c and #69's 942dad5).
Known limits.
Measurement
On an Apple M5,
cargo test --releaseran a temporary test, not committed, on #79's head (aa47159) and on this branch. It built one slice of 1,500 changed files, each a hunk that removes 66 lines and adds 67, 199,500 lines in all. Each line is a 300-character line of code with its number in front, and each added line ends in anx, so every pair's lines share their first 300 or so code units. The test unfolded every file and timedcode.prepare(width, &theme())at 52, 51 and 50 columns, wrapped, stacked and side by side.Every change there compares 132 pairs whose lines match for about 300 code units. A change with as many lines on each side, or lines only on one, compares none.
Tests
each_change_splits_as_the_desktops_does: align/pierre.json holds 63 random patches and each hunk's parts as pierre 1.5.2 split them, as the patch has them and with whitespace hidden. pierre.mjs writes it and says how. t3term's parts match in all of them, 39 changes split as the patch has them and 32 with whitespace hidden.\shas it; the bound of 4,096 comparisons at 4,096 and 4,097; the notes; and a line that starts another, each of its characters counted once.a_change_pairs_its_most_alike_lines_and_stacks_them_so: the Code tab's rows for a split change, stacked and side by side.whitespace_starts_hidden_and_one_row_shows_itnow expects SPACED's alternating run to stack its lines removed first.>to>=, the code units, the overlap or the bound each fails at least one test.🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
Uneven changes now pair their most alike lines. Both layouts read the same change parts.
The full PR diff was reviewed because the previous and current revisions have different merge bases with the target branch.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR H[Hunk lines] --> P[Group change lines and their notes] P --> A[Choose the best pairing offset] A --> C[Emit change parts] C --> S[Stack removed lines before added lines] C --> B[Pair lines side by side]Reviews (6) · Last reviewed commit: "Merge the word-wrap branch at 14ee77c, w..." · Reviewed by Greptile