Skip to content

fix(mobile): a rewritten guide stop no longer shows the previous push's diff - #37989

Closed
StiensWout wants to merge 4 commits into
pingdotgg:mainfrom
StiensWout:t3/1057-a-rewritten-review-guide-can-show-code-f
Closed

StiensWout wants to merge 4 commits into
pingdotgg:mainfrom
StiensWout:t3/1057-a-rewritten-review-guide-can-show-code-f

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

On mobile, a review guide stop read the pull request diff through a cache keyed without the push it was written for, so opening a rewritten guide could show code from the previous push. The diff hook now takes the stop's guide head and passes it as the diff query's cacheHeadSha, as the web guide already does, so each push gets its own cached pages and the previous push's patch is never shown.

Fixes #37988
Related: #35324

Reproduction on main

Commit bb29ee3e71 (main), in the running app:

  1. On the T3 Code phone app, open a pull request that has review guides turned on, open Changes, and wait until the code is on screen. Note one line in a file the guide covers.
  2. From git, push a commit that replaces the text of that line and leaves the surrounding lines in place. Leave the phone on the pull request and do not pull to refresh or tap Reload changes.
  3. On the phone, select Guide. When it says there are new changes since this guide, tap Rewrite guide, and wait until that notice is gone and the new stops are listed.
  4. Open the stop that shows an excerpt of the file you changed.

The stop's explanation is about the commit you just pushed, and the code in the excerpt is still the line from before that commit. Expected: The code in the excerpt is the line from the commit you just pushed.

The cause is at apps/mobile/src/features/pull-requests/usePullRequestDiff.ts:118. Ran cd apps/mobile && pnpm exec vp test run src/features/pull-requests/usePullRequestDiff.test.tsx with the repro test added: it failed in 2 of 2 runs on a clean checkout, with not to contain '+previous code' in the output.

Evidence

Environment: Linux x64, the repository's own tests

Proven: the test fails on base c2eb8f3369 and passes on head c4fe7d43c5.

Before After
Commit c2eb8f3369 c4fe7d43c5
Result Fails, with not to contain '+previous code' in the output Passes

Tests

  • 3d78b175cb adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed passed on head.

Who did the work

  • Confirmed by Grok 4.7, in Grok
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.1 Sol, in Codex, each on its own
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by Grok 4.7, Claude Opus 5.5 and GPT 6.1 Sol

StiensWout and others added 3 commits November 17, 2026 08:27
…s diff

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…'s diff

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Grok 4.7 <noreply@x.ai>
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 17, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c4fe7d4

Macroscope's review found this PR approvable — Mobile guide stops now separate cached diffs by guide head, preventing reuse of a previous push’s cached patch. The change is limited to client-side cache identity and leaves server requests and ordinary diff reads unchanged.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c4fe7d4 and 81d43e9.

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

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds an optional guide head SHA to the mobile diff hook and maps it to the diff target’s cache head. A regression test checks that changing guide heads does not show the previous head’s patch.

Changes: Guide diff cache

Layer / File(s) Summary
Map guide head to diff cache and test head changes
apps/mobile/src/features/pull-requests/usePullRequestDiff.ts, apps/mobile/src/features/pull-requests/usePullRequestDiff.test.tsx
The hook maps the optional guide head SHA to the diff target’s cache head. The test changes from an old guide head to a new one and checks that the old patch is absent and the new patch appears.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

Suggested reviewers: juliusmarminge, macroscopeapp, t3dotgg

Merge Risk: Minimal · previous review c4fe7

This change keys mobile diff pages by the guide's head SHA, so a rewritten review guide shows the newly pushed code instead of the previous push's patch. The guide screen already supplies that head to the hook, and a regression test covers the switch. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile): a rewritten guide stop no longer shows the previous push's diff" states the main change. The diff hook now passes the guide head SHA as cacheHeadSha, so a rewritten guide stop …
Description check Passed The description follows the template. It has a problem statement (the stale diff from a cache keyed without the push), a change section (the hook passes the guide head as cacheHeadSha), a scope sectio…
Linked Issues check Passed [#37988] The issue requires that a rewritten guide stop show the code from the newly pushed commit, not a cached diff from the previous push. The cause named in the issue is apps/mobile/src/features/p…
Out of Scope Changes check Passed The changes cover two files under apps/mobile/src/features/pull-requests/: usePullRequestDiff.ts (guideHeadSha type field and cacheHeadSha mapping, plus the existing commit mapping kept unchanged) and…
Full details: Title check

Explanation

The title "fix(mobile): a rewritten guide stop no longer shows the previous push's diff" states the main change. The diff hook now passes the guide head SHA as cacheHeadSha, so a rewritten guide stop no longer shows the previous push's patch. The title uses a conventional commit prefix and plain language. It is 76 characters, which is slightly long but still clear.

Full details: Description check

Explanation

The description follows the template. It has a problem statement (the stale diff from a cache keyed without the push), a change section (the hook passes the guide head as cacheHeadSha), a scope section that links the issue (#37988) and a related PR, and a verification section with a reproduction, a before/after test result table, and the checks that ran. It also lists the models that did the work, which the template asks for. The Scope section does not state explicitly that the change is a bug fix rather than a feature, but the issue link shows the bug. The description is mostly complete.

Full details: Linked Issues check

Explanation

[#37988] The issue requires that a rewritten guide stop show the code from the newly pushed commit, not a cached diff from the previous push. The cause named in the issue is apps/mobile/src/features/pull-requests/usePullRequestDiff.ts. At head, PullRequestDiffParams gains an optional guideHeadSha. usePullRequestDiff maps it to target.input.cacheHeadSha, so the diff query key differs per guide head. Base lacks this mapping. The added test 'does not show the previous push's patch when a rewritten guide opens' covers the requirement at hook level: it checks that a remount with a new guide head does not return the old patch and that the new head's patch is shown. The author reports that this test fails on base c2eb8f3 and passes on head c4fe7d4. This review did not run the test. The hook change matches the issue's root cause. Not verified in this review: that the guide stop caller passes guideHeadSha. The changed-file summary lists no caller change, so the end-to-end path depends on existing wiring.

Full details: Out of Scope Changes check

Explanation

The changes cover two files under apps/mobile/src/features/pull-requests/: usePullRequestDiff.ts (guideHeadSha type field and cacheHeadSha mapping, plus the existing commit mapping kept unchanged) and usePullRequestDiff.test.tsx (test helper keyed by cursor and head, plus the regression test). The test helper changes support the new regression test and do not alter other behavior. No unrelated change was found in the reviewed evidence.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c2eb8f3 and c4fe7d4.

Files selected for processing: 2

  • apps/mobile/src/features/pull-requests/usePullRequestDiff.test.tsx
  • apps/mobile/src/features/pull-requests/usePullRequestDiff.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the capture step could not show the problem on the base commit, so there is nothing to prove fixed.

On both commits, generate a guide describing PREVIOUS_PUSH; leave the PR open before loading Changes; open greeting.ts and capture PREVIOUS_PUSH; publish a commit replacing it with CURRENT_PUSH while preserving context; return without refreshing or choosing Reload changes; open Guide; select Rewrite guide after the new-changes notice; wait for the CURRENT_PUSH explanation; open its stop. Both commits displayed CURRENT_PUSH in the explanation and code excerpt. Result screenshots matched pixel-for-pixel across captures taken more than 500 ms apart.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 17, 2026
@StiensWout StiensWout closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A rewritten review guide can show code from the previous push on mobile

2 participants