You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): compare branches and show diffs with desktop's base-ref and whitespace settings - #34038
On the phone, the "committed changes" list always compared against the base branch, and its diffs showed every re-indented line as changed. Desktop compares against the upstream when you turn that setting on, and hides whitespace-only edits unless you ask to see them. The phone now reads those two desktop settings and follows them.
What Changed
Each item is from the mobile/desktop parity audit (source-control report).
Desktop's base-ref-resolution.ts moved to src/shared/source-control-base-ref-resolution.ts; desktop imports it from there.
The phone resolves its compare base with the same resolveSourceControlBaseRef / resolveSourceControlCompareBaseRef. With compare-against-upstream on and no pinned base, the Changes list and the review screen compare against the branch's upstream, as desktop does.
New src/shared/diff-whitespace.ts (shouldIgnoreTrimWhitespace) is desktop's Monaco rule; desktop's diff-editor-whitespace-options.ts uses it.
The phone's line diff compares trimmed lines unless diffShowWhitespace is on, so a re-indent shows no changed lines by default. Context rows show the new text. This applies to the staged/unstaged file tabs, the review screen and the branch diff preview.
Open diff tabs, including ones still loading, are rebuilt when the setting changes.
Host: the two settings are published.settings.get now carries sourceControlCompareAgainstUpstream and diffShowWhitespace.
Phone settings read.useMobileSourceControlSettings keeps one copy per host connection, shared by every screen. It rereads when a screen mounts, on reconnect, and on Source Control Refresh.
Mobile behaviour removed or changed (it now follows desktop):
comparing against the base branch even with compare-against-upstream on
showing whitespace-only line edits as delete plus add
Not changed:
PR base for SHA-pinned worktrees (Fix update checker 406 error and add menu feedback #8, deferred). Desktop compares a worktree pinned to a commit hash against its PR's base branch. The phone does not have the PR's base branch when it runs the compare, so that part needs the PR read wired into the compare and is left for a follow-up.
No live settings stream. The phone has no settings subscription. A desktop change shows after a Refresh, a screen open or a reconnect. An open branch diff preview sheet keeps its diff until it is reopened.
Why
Both rules now have one copy in src/shared. The desktop renderer and the phone both read it, with desktop's settings published by the host.
Linked Issue
Part of the mobile/desktop parity audit
Visual Proof
No device captures for this fleet. The change adopts desktop's existing behaviour: use-base-refs compare-base resolution (sourceControlCompareAgainstUpstream) and the Monaco diff editor's ignoreTrimWhitespace: diffShowWhitespace !== true.
Testing
Focused mobile tests (source-control, session, components, tasks, RPC recordings with re-recorded goldens). Also desktop and shared tests for the moved module and the host settings projection.
New: a re-indent hidden unless whitespace is shown, and open or loading diffs dropped when desktop's setting arrives. The second test was confirmed failing without the fix.
Mobile typecheck / typecheck:tests, tc:web and tc:node pass. So do check:code-quality:changed, check:react-doctor:changed and verify:localization-coverage.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Mixed versions: older hosts omit the two new fields, and the phone then uses desktop's defaults (compare against base, hide whitespace-only edits). Older phones ignore the fields.
Folder workspaces: they have no branch compare. The whitespace rule only applies to git diffs.
SSH/remote: the settings come from the paired host's settings.get, so the phone follows the desktop it is connected to.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The changes add runtime and mobile support for source-control settings, including upstream comparison, group ordering, and whitespace display. Mobile branch comparisons use the configured comparison target. Mobile diff paths can ignore whitespace-only changes while retaining original line content for display. Shared whitespace and base-reference helpers are used by mobile and renderer code. RPC recording fixtures now capture the revised requests, responses, states, and checkpoints.
Priority: Normal
Merge Risk: Low · previous review e6cd2
A narrowly timed Refresh may leave mobile comparison and whitespace settings stale. Another Refresh recovers; fixing the queued reread is advisable before merge.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Description check
The description is detailed and relevant, but it does not provide the required actual linked issue. The visual-proof section also does not use the required N/A wording or provide before-and-after ca…
Add a valid issue link under Linked Issue, provide before-and-after visual proof or write N/A with a brief reason, and complete the Review section. Confirm whether the unchecked full lint, typecheck, test, and build commands passed locall…
Docstring Coverage
Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: aligning mobile branch comparison and diff whitespace behavior with desktop settings.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description is detailed and relevant, but it does not provide the required actual linked issue. The visual-proof section also does not use the required N/A wording or provide before-and-after captures, and the Review section is empty.
Resolution
Add a valid issue link under Linked Issue, provide before-and-after visual proof or write N/A with a brief reason, and complete the Review section. Confirm whether the unchecked full lint, typecheck, test, and build commands passed locally or will be covered by CI.
Full details: Docstring Coverage
Explanation
Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 18 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 2
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
The merge-queue branch bypasses translate, so non-English locales can display these badges in English. Reuse the existing key for Merge when ready and add the generated English catalog key for Auto-merge on. The semantic key autoMergeOn does not follow the repository convention.
Queue a settings reread requested during an in-flight read.
settings.get snapshots the host settings when runtime.getClientSettings() runs. If the host settings change before that response completes, Refresh calls reloadSettings(), but entry.inFlight discards the reread. The same client remains connected, so no automatic effect reruns. The earlier response can therefore leave comparison and whitespace settings stale.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
…and whitespace settings
Base-ref resolution moves to src/shared and the host publishes the compare-against-upstream
and show-whitespace settings, so the phone's branch compare and diffs match desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On the phone, the "committed changes" list always compared against the base branch, and its diffs showed every re-indented line as changed. Desktop compares against the upstream when you turn that setting on, and hides whitespace-only edits unless you ask to see them. The phone now reads those two desktop settings and follows them.
What Changed
Each item is from the mobile/desktop parity audit (source-control report).
base-ref-resolution.tsmoved tosrc/shared/source-control-base-ref-resolution.ts; desktop imports it from there.resolveSourceControlBaseRef/resolveSourceControlCompareBaseRef. With compare-against-upstream on and no pinned base, the Changes list and the review screen compare against the branch's upstream, as desktop does.src/shared/diff-whitespace.ts(shouldIgnoreTrimWhitespace) is desktop's Monaco rule; desktop'sdiff-editor-whitespace-options.tsuses it.diffShowWhitespaceis on, so a re-indent shows no changed lines by default. Context rows show the new text. This applies to the staged/unstaged file tabs, the review screen and the branch diff preview.settings.getnow carriessourceControlCompareAgainstUpstreamanddiffShowWhitespace.useMobileSourceControlSettingskeeps one copy per host connection, shared by every screen. It rereads when a screen mounts, on reconnect, and on Source Control Refresh.Mobile behaviour removed or changed (it now follows desktop):
Not changed:
Why
Both rules now have one copy in
src/shared. The desktop renderer and the phone both read it, with desktop's settings published by the host.Linked Issue
Part of the mobile/desktop parity audit
Visual Proof
No device captures for this fleet. The change adopts desktop's existing behaviour:
use-base-refscompare-base resolution (sourceControlCompareAgainstUpstream) and the Monaco diff editor'signoreTrimWhitespace: diffShowWhitespace !== true.Testing
Focused mobile tests (source-control, session, components, tasks, RPC recordings with re-recorded goldens). Also desktop and shared tests for the moved module and the host settings projection.
New: a re-indent hidden unless whitespace is shown, and open or loading diffs dropped when desktop's setting arrives. The second test was confirmed failing without the fix.
Mobile
typecheck/typecheck:tests,tc:webandtc:nodepass. So docheck:code-quality:changed,check:react-doctor:changedandverify:localization-coverage.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
settings.get, so the phone follows the desktop it is connected to.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)