Repository navigation
perf(mobile): skip projection for abandoned diff replies - #34873
Conversation
|
Warning Review limit reachedYou'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. View limit details
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 |
[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
SummarySkips local diff building when a mobile reader no longer owns a reply.
Reviews (1) · Last reviewed commit: "test(mobile): consolidate abandoned diff..." · Reviewed by Greptile |
| const controller = new AbortController() | ||
| controller.abort() | ||
| await expect( |
There was a problem hiding this comment.
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!
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
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).