feat(web): add a since-fork diff scope - #5193
Conversation
The diff panel could show uncommitted work (`git diff HEAD`) or committed work since the fork point (`git diff base...HEAD`), but never both at once. While an agent thread is mid-run with uncommitted edits, neither scope answers "what has this worktree changed since it branched?". `git diff A...B` has no working-tree form, so resolve the fork point with `git merge-base` and diff that against the worktree, folding in untracked files through the existing --no-index helper. Exposed as a third scope alongside the existing two, which are unchanged. The base-ref picker now applies to both base-relative scopes and remembers one comparison target per thread across them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
| import * as Order from "effect/Order"; | ||
|
|
||
| export type ReviewSectionKind = "turn" | "working-tree" | "branch-range"; | ||
| export type ReviewSectionKind = "turn" | "working-tree" | "branch-range" | "since-fork"; |
There was a problem hiding this comment.
🟠 High review/reviewModel.ts:8
A git:since-fork section added by buildReviewSectionItems is unreachable in the mobile UI. buildReviewSectionMenu only extracts working-tree, branch-range, and turn sections, and ReviewSheet only renders actions for those entries, so a since-fork section appears in reviewSections but the user can never select it from the section menu. Consider adding a sinceFork entry to the menu output (and a matching action in ReviewSheet) so the scope is accessible.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/review/reviewModel.ts around line 8:
A `git:since-fork` section added by `buildReviewSectionItems` is unreachable in the mobile UI. `buildReviewSectionMenu` only extracts `working-tree`, `branch-range`, and turn sections, and `ReviewSheet` only renders actions for those entries, so a `since-fork` section appears in `reviewSections` but the user can never select it from the section menu. Consider adding a `sinceFork` entry to the menu output (and a matching action in `ReviewSheet`) so the scope is accessible.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4861e56. Configure here.
| import * as Order from "effect/Order"; | ||
|
|
||
| export type ReviewSectionKind = "turn" | "working-tree" | "branch-range"; | ||
| export type ReviewSectionKind = "turn" | "working-tree" | "branch-range" | "since-fork"; |
There was a problem hiding this comment.
Since-fork unreachable on mobile
Medium Severity
The new since-fork review section is available from the server, but mobile's review section menus don't expose this option. Users are unable to select or view the since-fork review scope.
Reviewed by Cursor Bugbot for commit 4861e56. Configure here.
| </DropdownMenuContent> | ||
| </DropdownMenu> | ||
| {selectedTurnId === null && selectedGitScope === "branch" && selectedGitSource?.baseRef && ( | ||
| {selectedTurnId === null && isBaseRelativeScope && selectedGitSource?.baseRef && ( |
There was a problem hiding this comment.
Misleading since-fork comparison label
Medium Severity
The since-fork diff scope's header incorrectly displays a branch-vs-base comparison (e.g., "headRef → baseRef"). This misrepresents the actual comparison, which is between the worktree and the merge base, obscuring that uncommitted changes are included.
Reviewed by Cursor Bugbot for commit 4861e56. Configure here.
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR adds a new 'since-fork' diff scope feature with unresolved review comments identifying incomplete mobile support (feature unreachable in mobile UI) and misleading comparison labels in the web UI. These issues warrant human review before merging. You can customize Macroscope's approvability policy. Learn more. |
buildReviewSectionMenu picked the two git scopes out by kind, so the since-fork section arrived from the server and was stored unfiltered but had no entry in either menu surface. Users could not select or view it. Add it to the menu shape and to both surfaces that render it: the Android action list and the native header toolbar. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


What changed
Adds a third scope to the diff panel, Since fork, alongside the existing Working tree and Branch changes. It shows everything a branch has changed relative to its fork point, whether or not it has been committed.
git diff HEADgit diff base...HEADgit diff $(git merge-base base HEAD)The two existing scopes are untouched.
Why
The panel could show uncommitted work or committed-since-fork work, but never both at once. While a thread is mid-run with uncommitted edits, neither scope answers "what has this worktree changed since it branched?" — Branch changes is empty until the agent commits, and Working tree only diffs against
HEAD, not the fork point. This is most noticeable on worktree-backed threads, where the fork point is exactly the interesting baseline.Implementation notes
git diff A...Bhas no working-tree form, so the server resolves the fork point withgit merge-base <base> HEADand diffs that commit against the worktree, folding in untracked files via the existing--no-indexhelper thatworking-treealready uses. It honors the ignore-whitespace toggle, and returns an empty source rather than erroring when no base resolves (unrelated histories, missing ref).The base-ref picker now applies to both base-relative scopes, and the chosen comparison target is remembered once per thread and carries across when switching between them.
Mobile builds its review sections generically from the sources array, so the new scope appears there too with a
base ... worktreesubtitle.Testing
pnpm typecheckclean;pnpm lintclean for touched filessince-forkwhilebranch-rangestays committed-only, one for the unresolvable-base caseScreenshots
Before/after images of the scope menu and the new view to follow.
Note
Medium Risk
Touches Git diff generation and shared review contracts; behavior is covered by new server and store tests, but incorrect merge-base or diff assembly could misrepresent what changed on a branch.
Overview
Adds a Since fork diff scope so reviewers can see everything changed on a branch since its fork point—committed and uncommitted—in one view.
The server extends review diff previews with a new
since-forksource: it runsgit merge-baseagainst the chosen base, diffs that commit to the worktree, and merges untracked files the same way as the working-tree scope. Branch changes (base...HEAD) stays committed-only; Working tree stays uncommitted-only.Web and mobile pick up the new source: the diff panel adds a Since fork menu item, shares the base-ref picker and persisted comparison target between branch and since-fork scopes, and mobile review sections show a
base ... worktreesubtitle for this kind.Reviewed by Cursor Bugbot for commit 4861e56. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add a 'since-fork' diff scope to the review diff panel
since-forkdiff scope that shows all changes since the merge-base of the current branch and a selected base ref, including untracked working-tree files.since-forkkind alongside existingbranch-rangeandworking-treekinds.branchandsince-forkscopes preserves the previously selected base ref.getReviewDiffPreviewcomputes the merge-base viagit merge-base, diffs against it, and appends untracked changes; returns an empty diff when the base ref cannot be resolved.branch-rangeandsince-forkscopes, and thetruncatedflag forsince-forkaggregates truncation from both the git diff and untracked file output.📊 Macroscope summarized 4861e56. 4 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.