Skip to content

fix(web): FG-5 commit, diff, log and compare views (renames, totals, compare) - #164

Merged
PastaPastaPasta merged 5 commits into
masterfrom
fix/fg5-diff-compare
Sep 29, 2026
Merged

PastaPastaPasta merged 5 commits into
masterfrom
fix/fg5-diff-compare

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

What

This PR is fix group FG-5 from the dash-ux QA ledger: the commit, diff, log and compare views. It fixes L-24, L-25, L-26, L-27, L-29, L-30, L-31, L-35, L-47, L-68, L-69 and L-71. Each row of the table has been checked against git on the real dashpay/dash history.

Finding Fix
L-24 renames show as an A plus a D New lib/view/renames.ts, a port of git's diffcore-rename with git diff -M defaults, scored by diffcore-delta's span hash. See the rename detection section below for the phases. It is wired into commit diffs and PR/compare diffs through diffTreesWithRenames. A renamed file is one R row, old → new, with its similarity in the tooltip.
L-25 totals cover only the loaded files diffTotals counts the way git diff --shortstat does. See the totals section below. There are no partial totals.
L-29 split gutters take half the width A <colgroup> fixes the gutter widths, so a leading gap row can't widen them. Measured 48/575/48/575 px on 00aabf52f at 1440 px.
L-69 unchanged-lines rows can't be expanded Each gap offers ↓ 20, ↑ 20 and Show all, like GitHub. A gap of 20 lines or fewer opens whole.
L-71 hide whitespace isn't in the URL Hide whitespace reads and writes ?w=1 or ?w=0, falling back to the reader's preference. A file that differs only in whitespace says so.
L-26 / L-27 author vs committer, unlabelled dates The byline reads "A authored … · C committed …", and each date is a <time> with the exact UTC time on hover. Co-authored-by trailers from the last paragraph are listed. The log and PR commit rows label the author date too.
L-68 Tree-SHA512 overflows Measured scrollWidth − clientWidth = 0. The wrapping came from #149; this PR verifies it on f5979f7c5.
L-31 the log loses its place on Back ?pages=N is kept in the URL through router.replace, and a ?pages= link loads that many pages again. The scroll position is kept per URL for the tab and used once.
L-35 log footer counts loaded rows The footer reads "Showing the newest 120 commits", or "Showing 40 of 7,979 commits" with the first-parent count when #146's history index covers the tip, or "The whole history: N commits". The home count itself is #146's.
L-30 no compare view New /repo/compare?base=…&head=… route, GitHub's base...head. See the compare section below.
L-47 New PR guesses a branch, then shows a misleading diff The New PR form accepts ?base=master&head=develop short names, as well as full ref names and repo:branch keys. It no longer guesses a head, and lists branches with the default first, then in the switcher's order (#162's compareRefNames). An open PR whose base already contains its head gets "nothing to compare" instead of a diff against the head's parent, and on the PR page "Update branch" is hidden in that case.

Rename detection (L-24)

lib/view/renames.ts runs the same three phases as git diff -M:

  1. Exact renames: identical blobs pair, preferring a shared basename. Symlinks and submodules pair only when their modes match.
  2. Unique-basename matches at 75% similarity.
  3. The similarity matrix: the best 4 candidates per destination, paired best first at 50%, with diff.renameLimit 1000.

The browser adds two limits that git doesn't have, and the page states whichever one applies:

  • A 64-blob read budget. In the basename phase, pairs are scored in queue order up to the budget, so the result is always a subset of git's pairs.
  • A 1 MiB blob cap.

Totals (L-25)

  • diffTotals counts as git diff --shortstat does:
    • binary files, mode changes and exact renames count 0;
    • a submodule counts one line per side.
  • Patches now come from the xdiff port that feat(web): blame progress, partial keep, permalinks and git-exact alignment; repo shell before the SDK; hosting doc #151 added for blame, run over whole files. A minimal Myers script isn't always git's: script_util.py in f5979f7c5 counted 12/10 against git's 13/11.
  • Files too large to show (256 KiB to 1 MiB) are still read so their lines can be counted.
  • Up to 100 files are counted automatically; a larger change counts on request ("Count lines in all N files").
  • On a capped listing, the totals say "in the N listed files".

Compare (L-30)

  • /repo/compare?base=…&head=… works like GitHub's base...head. Each side can be a branch, a tag or a commit, and short names work.
  • It shows the commits (git log base..head) and the diff from the merge base (git diff -M base...head).
  • The merge-base search shows progress and a Stop button.
  • Two branches get a Create pull request link. Up-to-date, identical and unrelated histories each get their own message.
  • It is linked from the branches and tags lists and from New PR.
  • The base and head params are sealed for private repos, like ref and path.

Design decision: New PR still offers branches only, not tags. A PR's head and base must be branches (D-501), so tag comparisons belong on /repo/compare.

Verification

Moutai is on beta.7 and this branch's JS can't read it, so there was no live run (see the follow-up below).

  • git-oracle unit tests, each against real git:
    • renames.test.ts: 150 random tree pairs match git diff -M --raw exactly, including similarity. A tight budget always gives a subset of git's pairs.
    • compare.test.ts: 40 random pairs over a forked and merged history match git merge-base, git log base..head and git diff -M --name-status base...head.
    • diff-totals.test.ts: matches git diff -M --shortstat.
    • text-diff tests cover the gap expansion.
  • The real dash history (lib/view/dash-compare.local.test.ts, run against a local clone, never in CI):
    • f1be1b800: 69 files, the same 3 renames as git.
    • f5979f7c5: +1331 −1906 over 747 files, equal to git.
    • v22.0.0...develop: the same merge base (7f28292) and 6,308 commits as git.
  • Browser QA on my own build (c587c39): a harness renders the real CommitClient, CommitsClient and CompareClient over objects from the dash clone. It stubs only the SDK and scaffold and checks the served build sha. All 17 checks pass, with screenshots in dash-forge-qa/evidence/impl/fix-fg5-diff-compare/.
  • Full suite and checks: vitest (3,039 passing), tsc, next lint and next build all pass. /repo/compare is prerendered.

Compare v22.0.0...develop on dash: cost

Measured on the local clone, at the object level:

  • Merge-base search: 21,878 commits. develop carries commits older than v22.0.0 that aren't its ancestors, so the search has to go deep. Without a commit-graph, git's paint_down_to_common would read the same commits.
  • Browser reads for the search: those commits are about 16.5 MB packed, which is roughly 64 read-ahead blocks of 256 KiB.
  • Commit list: it re-walks the same commits from the walker's block cache.
  • Diff: 269 tree reads, plus 56 blobs for rename scoring.
  • Timing: 1.0 s of compute in Node, and 9.8 s to the summary in the browser harness (local objects, no network).
  • Live budgets: DAPI request numbers need the live run. e2e/fg5-dash.spec.ts asserts ≤ 400 requests and ≤ 90 s for this compare.

Follow-ups

  • Live pass on bonsia: run e2e/fg5-dash.spec.ts (read-only) once the dash showcase mirror is back after the wipe and beta.7 cut-over. It covers the 747-file merge totals, the renames and the v22.0.0...develop compare. The live e2e CI job is expected to be red until then.
  • Not done here:
    • a GitHub-style short URL for compare (/owner/name/compare/a...b);
    • keeping only the counts, not the full diff, for files counted off screen.

Ledger: FG-5 in dash-forge-qa/evidence/dash-ux/LEDGER.md.

🤖 Generated with Claude Code

PastaPastaPasta and others added 5 commits September 29, 2026 15:34
…-M does (L-24)

Port of git's diffcore-rename (exact, unique-basename at 75%, best-first matrix at 50%, diff.renameLimit) scored by diffcore-delta's span hash; checked against git diff -M --raw on random tree pairs.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… and committer, log position in the URL, and /repo/compare (FG-5)

L-25 totals as git diff --shortstat counts them, L-29 fixed split gutters, L-69 expandable gaps, L-71 hide whitespace in the URL, L-26/L-27 labelled author and commit dates with co-authors, L-31 ?pages= and scroll kept for Back, L-35 log footer copy, L-30 /repo/compare base...head for branches, tags and commits, L-47 New PR: short-name params, no guessed head, nothing-to-compare.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…chored on the old path, partial rename budgets, compare follow-ups

Patches and +/- totals come from the xdiff port over whole files, so counts equal git diff --numstat (dash f5979f7c5: +1331 -1906, as git); files up to 1 MiB are counted though not shown. Expanded context is keyed by whitespace mode; totals on a capped listing say so; ?w=0 is written. A renamed file's old side keeps its old path for inline comments; Update branch is hidden when there is nothing to compare. Rename detection reads what its budget allows in the basename phase (a subset of git's pairs), sorts paths by code point, and reports blobs over its size cap. Compare shows Stop only while searching, keeps the URL's refs for its links, and stops the commit list at the merge base. New PR helpers move to refs.ts; a local check against the dash clone is added.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…me budgets

The 747-file merge's whole-commit totals, the renames of f1be1b800, and compare v22.0.0...develop; runs on the live devnet once the showcase mirror is back.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ed branch cannot shadow it

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 688de883-c1be-4fb2-b147-29902e0219ce

📥 Commits

Reviewing files that changed from the base of the PR and between 2e9ed11 and c587c39.

📒 Files selected for processing (36)
  • forge-web/app/repo/compare/client.tsx
  • forge-web/app/repo/compare/page.tsx
  • forge-web/components/repo/byline.tsx
  • forge-web/components/repo/commit-content.tsx
  • forge-web/components/repo/commits-content.test.ts
  • forge-web/components/repo/commits-content.tsx
  • forge-web/components/repo/compare-content.tsx
  • forge-web/components/repo/diff-view.tsx
  • forge-web/components/repo/new-pull-content.tsx
  • forge-web/components/repo/pull-content.tsx
  • forge-web/components/repo/pull-diff.tsx
  • forge-web/components/repo/pull-tabs.tsx
  • forge-web/components/repo/ref-list-content.tsx
  • forge-web/components/repo/repo-header.tsx
  • forge-web/e2e/code-browsing-parity.spec.ts
  • forge-web/e2e/fg5-dash.spec.ts
  • forge-web/lib/page-title.ts
  • forge-web/lib/view/commit-log.ts
  • forge-web/lib/view/commit-people.test.ts
  • forge-web/lib/view/commit-people.ts
  • forge-web/lib/view/compare.test.ts
  • forge-web/lib/view/compare.ts
  • forge-web/lib/view/dash-compare.local.test.ts
  • forge-web/lib/view/diff-totals.test.ts
  • forge-web/lib/view/file-diff.ts
  • forge-web/lib/view/index.ts
  • forge-web/lib/view/private-nav.ts
  • forge-web/lib/view/pull-diff.test.ts
  • forge-web/lib/view/pull-diff.ts
  • forge-web/lib/view/refs.ts
  • forge-web/lib/view/renames.test.ts
  • forge-web/lib/view/renames.ts
  • forge-web/lib/view/text-diff.test.ts
  • forge-web/lib/view/text-diff.ts
  • forge-web/lib/view/xdiff-compact.ts
  • forge-web/lib/view/xdiff.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta merged commit 8fa3fa6 into master Sep 29, 2026
5 of 6 checks passed
PastaPastaPasta added a commit that referenced this pull request Sep 29, 2026
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