Skip to content

perf(mobile): skip projection for abandoned diff replies - #34873

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/mobile-skip-abandoned-diff-projection
Oct 29, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/mobile-skip-abandoned-diff-projection

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5

Problem and change

A dismissed mobile branch preview still builds its diff after the reply arrives. The review screen similarly ignores an old result only after the real loader builds lines, highlights them, and constructs hunks.

Move the branch preview's existing ownership check before projection. Pass an optional effect-lifetime signal through the review loader and check it after the already-issued RPC settles. Cleanup retires local work; RPC issuance, live render modes, errors, whitespace policy and hunk behavior stay unchanged.

With abandoned 100/1,000-line replies, forwarding spies observe 3,178/33,778 input characters entering the actual branch diff builder and 3,578/37,778 entering the actual review builder on base, versus zero fixed. Old review replies also highlight and build hunks once on base versus zero fixed. Live successors still run the actual pipeline and return exact expected rows/hunks; remounted readers preserve whitespace and hunk-selection behavior.

Validation

  • Final regression owners: 2 files / 12 tests passed; six new regressions fail base.
  • Focused diff/loader/reconnect/syntax/hunk suites: 8 files / 63 tests passed.
  • Both mobile TypeScript projects and changed-file format/lint: passed.
  • Actual checkout required gate: 11/11 passed.

Linux Node evidence only; no measured phone CPU, latency, memory or battery claim. This prevents discarded local projection and does not cancel already-issued host requests.

Local/remote host and folder/git workspace paths use the existing identities and compatible response schemas. No wire protocol, persistence format, OS path or subprocess behavior changes. Native iOS/Android and macOS/Windows execution were not measured. All app/test commands use ORCA_BACKGROUND_LAUNCH=1; no windows were shown or focused. Visual proof is not applicable to the internal work/retention change; real production operation counts and exact live-output controls are provided above.

Actual checkout validation: 8 suites / 63 tests passed, both mobile production/test TypeScript projects passed, and the required changed gate 11/11 passed (ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false check:changed --maxWorkers=2).

@OrcaWin
OrcaWin marked this pull request as ready for review October 28, 2026 20:37
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c70fd9d5-a5af-4ff4-a624-f522db9ac4f2
Commits

Reviewing files that changed from the base of the PR and between a21f79d and fffe485.

Files selected for processing: 5
  • mobile/src/session/mobile-diff-review-loaders.test.ts
  • mobile/src/session/mobile-diff-review-loaders.ts
  • mobile/src/session/use-mobile-diff-review-diff-loading.ts
  • mobile/src/source-control/mobile-branch-preview-ownership.test.tsx
  • mobile/src/source-control/use-mobile-branch-diff-preview.ts
  • 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.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect local diff work in two mobile review flows.

The PR appears safe to merge, with a non-blocking test gap around replies abandoned while pending.

Findings

  1. P2 Pending abandonment goes untested ▶

Summary

Skips local diff building when a mobile reader no longer owns a reply.

  • Branch previews stop processing replies that no longer belong to them.
  • Review diff loads stop projecting replies after their screen effect ends.

Reviews (1) · Last reviewed commit: "test(mobile): consolidate abandoned diff..." · Reviewed by Greptile

Comment on lines +63 to +65
const controller = new AbortController()
controller.abort()
await expect(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Pending abandonment goes untested

The test aborts before calling loadMobileDiffReviewDiff, so it would still pass if the abort check moved before the RPC wait. That would miss the case this PR fixes: cleanup runs while a request is pending, then its reply arrives.

Add a deferred reply, abort after the request starts, and resolve it afterward. Assert that the request was issued and buildMobileDiffLines was not called.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@OrcaWin
OrcaWin merged commit 3453677 into main Oct 29, 2026
48 checks passed
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