Repository navigation
fix(github): align PR file diff order - #10081
Conversation
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 4178b253e18998e4157ee15e5110d979355a7c79 and 5b900d6. 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughCombined diff viewers now order mapped pull request files through source-control tree traversal. A new helper supports commit and branch modes by building, compacting, flattening, and filtering the tree to file entries. The GitHub item dialog and pull request page use this helper for commit-mode viewers. A unit test verifies the resulting file order. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
4178b25 to
5b900d6
Compare
|
Before/after evidence (requested by maintainer — not merging yet, for review). This is a pure ordering change (no visual/styling delta), so the faithful before/after is the file-ordering itself: PR #10081 — align PR "Files changed" diff order with the file treePR: fix(github): align PR file diff order (branch What changedThe left-hand file tree in the desktop GitHub PR view orders entries via the BEFORE / AFTER ordering (empirical)Produced by running the actual ordering function against two datasets. Dataset A — unit-test fixture
Dataset B — realistic PR file set
Note the AFTER order groups directories first (docs/, src/…) with nested folders Test proof (both directions)
Caveat on "screenshots"This is a pure data-ordering change with no visual/styling delta, so the |
fix(github): align PR file diff order
Summary
Fixes the desktop GitHub PR "Files changed" view so the diff sections render in the same order as the left-hand file tree.
ELI5
When you review a pull request, the list of files on the left and the actual diffs on the right were in different orders, so clicking a file could jump you to an unexpected spot. Now they line up.
Root cause & fix
The file tree ordered entries via the source-control tree (directories grouped, path-sorted, DFS), but the diff sections consumed the raw GitHub API response order, so the two sequences diverged. This adds
getCombinedDiffBranchEntriesInTreeOrder()tocombined-diff-file-tree-model.ts, which builds, compacts, and flattens the source-control tree to emit combined-diff entries in file-tree order. Both PR combined-diff viewers (GitHubItemDialog.tsxandPullRequestPage.tsx) now wrapfiles.map(gitHubPRFileToBranchEntry)with this ordering for mode'commit'.Evidence
Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.
src/renderer/src/components/editor/CombinedDiffFileTree.test.ts"orders commit entries to match the file tree"—TypeError: getCombinedDiffBranchEntriesInTreeOrder is not a function(1 failed | 6 passed). Proven both ways.oxlinton the 3 changed source files exits 0, clean.Trade-offs
None — pure fix.
Regression risk
Low. The change only reorders how already-rendered combined-diff entries are displayed, and the new function reuses the established source-control-tree builders. Non-affected paths are unchanged. Residual note: the test covers the model function directly, not the
.tsxviewer wiring — but that wiring is a mechanical wrap of the same call in both files.Original fix by @xianjianlf2. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.