Skip to content

feat(web): add a since-fork diff scope - #5193

Draft
derfred wants to merge 2 commits into
pingdotgg:mainfrom
derfred:feat/diff-since-fork-scope
Draft

feat(web): add a since-fork diff scope#5193
derfred wants to merge 2 commits into
pingdotgg:mainfrom
derfred:feat/diff-since-fork-scope

Conversation

@derfred

@derfred derfred commented Aug 1, 2026

Copy link
Copy Markdown

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.

scope range includes uncommitted
Working tree git diff HEAD only uncommitted
Branch changes git diff base...HEAD no
Since fork (new) git diff $(git merge-base base HEAD) yes

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...B has no working-tree form, so the server resolves the fork point with git merge-base <base> HEAD and diffs that commit against the worktree, folding in untracked files via the existing --no-index helper that working-tree already 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 ... worktree subtitle.

Testing

  • pnpm typecheck clean; pnpm lint clean for touched files
  • New server tests: one asserting committed + dirty-tracked + untracked all land in since-fork while branch-range stays committed-only, one for the unresolvable-base case
  • New store test covering base-ref carry-over between the two base-relative scopes
  • Existing suites pass: 87 server vcs, 8 web diff-panel-store, 44 mobile review

Screenshots

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-fork source: it runs git merge-base against 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 ... worktree subtitle 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

  • Adds a new since-fork diff scope that shows all changes since the merge-base of the current branch and a selected base ref, including untracked working-tree files.
  • Extends the contract schema, store types, and mobile review model to accept the since-fork kind alongside existing branch-range and working-tree kinds.
  • The diff panel UI gains a 'Since fork' dropdown option with a base ref combobox; switching between branch and since-fork scopes preserves the previously selected base ref.
  • Server-side, getReviewDiffPreview computes the merge-base via git merge-base, diffs against it, and appends untracked changes; returns an empty diff when the base ref cannot be resolved.
  • Behavioral Change: branch ref queries now execute for both branch-range and since-fork scopes, and the truncated flag for since-fork aggregates 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.

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>
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e5d7f824-e8df-476c-b371-6eda7f034524

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026
import * as Order from "effect/Order";

export type ReviewSectionKind = "turn" | "working-tree" | "branch-range";
export type ReviewSectionKind = "turn" | "working-tree" | "branch-range" | "since-fork";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ 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";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4861e56. Configure here.

</DropdownMenuContent>
</DropdownMenu>
{selectedTurnId === null && selectedGitScope === "branch" && selectedGitSource?.baseRef && (
{selectedTurnId === null && isBaseRelativeScope && selectedGitSource?.baseRef && (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4861e56. Configure here.

@macroscopeapp

macroscopeapp Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@derfred
derfred marked this pull request as draft August 2, 2026 06:24
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant