Skip to content

fix(web): unsaved PR review comments survive a light/dark switch - #38004

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-37996
Nov 17, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-37996

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Nothing needed changing in this round. The brief listed no items, and PR #38004 at 9c7c3e4 is green: all 39 checks passed, including the 8 required ones. Macroscope approved (Approvability: approved). CodeRabbit generated no actionable comments, and there are no line comments, so no high-or-above finding is open. The fix is unchanged: it removes ${resolvedTheme} from PullRequestCodeTab's diffModel and withheld-file parse cache keys. A light/dark switch therefore keeps the same parsed file objects and render keys, so fold state and open comment, reply and edit editors survive. The shared diff worker pool still re-highlights mounted diffs when the theme changes.

Fixes #37996

Reproduction on main

Commit 49c3ab8 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree, added the worktree (origin = pingdotgg/t3code) as a project, paired the preview browser, opened Pull requests > #30045 > Code tab, emulated prefers-color-scheme: dark, expanded ComposerPrimaryActions.tsx, clicked the gutter '+' on line 12, and typed 'Long unsaved review comment draft' into the 'Comment on lines …:12' textarea without saving. Switched prefers-color-scheme to light: the line-comment textarea was gone from the DOM (only 'Review summary' and 'Comment on this pull request' remained) and the file was folded closed again. Expanding the file did not bring the editor or the text back. Failing test on factory/repro-37996: 'keeps an unsent reply when the appearance switches between light and dark' in apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx. It opens a reply on a review thread, fills 'Unsent', calls setAppearanceMode('light') after starting in dark, and fails because the reply textbox no longer exists (the ARIA tree shows only '1 file', so the file folded). With the appearance switch removed, the same test passes.

Evidence

Real Chromium web client, 1280×800, fresh isolated database on each commit. Open #30045 → Code → expand ComposerPrimaryActions.tsx → gutter plus on line 12 → type Long unsaved review comment draft without saving → switch prefers-color-scheme from dark to light.

Proven: scenarios:prove exited 0, failing on base and passing on head. On base the file folded and the editor disappeared. On head the file stayed expanded and the complete draft remained visible.

Before After
Commit 49c3ab8632 9c7c3e4bf4
Unsent draft, dark Before: unsaved draft in dark mode After: unsaved draft in dark mode
After switching to light Before: file folds and draft disappears After: editor and complete draft remain
Recording Before interaction After interaction

Scenario source

Not shown:

  • Reply and edit draft editors were not exercised; this proof covers the reported new line-comment reproduction.
  • Native macOS appearance switching was not exercised; the web reproduction used Chromium prefers-color-scheme emulation.

Tests

No new commands this round. Read the CI results on GitHub: all 39 check runs on 9c7c3e4 passed, including Test Web 1/2, Lint, and Build and Typecheck. From the earlier step: PullRequestCodeTab.browser.test.tsx 9/9 pass, and vp run check:changed passes.

Not in this change

  • DiffPanel (diff-panel:${resolvedTheme}) and useReviewFilePatches (diff-panel:${theme}) also put the theme into their parse cache keys, so their per-file state may reset the same way on a theme switch; not changed here because the issue is about the PR Code tab.
  • DiffPanel (diff-panel:${resolvedTheme}) and useReviewFilePatches (diff-panel:${theme}) also put the theme into their parse cache keys, so their per-file state may reset on a theme switch the same way; not changed here.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

Julius Marminge and others added 2 commits November 17, 2026 07:52
Fails on main: the Code tab's diff model is keyed by the rendered
appearance, so switching it re-parses the files, folds them back and
remounts their annotations, dropping any unsaved comment text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Code tab keyed its parsed diff model by the rendered appearance, so a
theme change re-parsed every file into new objects with new render keys.
That folded the files again and remounted their annotations, discarding
unsaved comment, reply and edit text. The diff worker pool already follows
the appearance and re-highlights mounted diffs, so the theme is dropped
from both parse keys.

Fixes #37996

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 17, 2026
@macroscopeapp

ghost commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 9c7c3e4

Macroscope's review found this PR approvable — Theme switches now preserve PR diff identities, allowing unsaved review comments to remain in place. PR and commit isolation remain intact, with no changes to comment submission or permissions.

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

@coderabbitai

ghost commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The diff model and withheld-file patch cache keys no longer include the resolved theme. A browser regression test checks that an unsent review reply remains after switching from dark to light appearance.

Changes: Theme change and review reply

Layer / File(s) Summary
Theme-independent diff caches and regression test
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx, apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx
The diff model and withheld-file patch cache keys no longer include the resolved theme. The browser test enters an unsent reply in dark mode, switches to light mode, and checks that the reply remains.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: yash-singh1, maria-rcks, jakeleventhal

Merge Risk: Minimal · up to 9c7c3

Theme switches in the pull-request Code tab should no longer discard unsent review text. Syntax colors after a live theme switch were not checked by hand, but no concrete defect was found, so the change looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its scope: unsaved PR review comments survive a light/dark appearance switch. It matches the main change, which removes the theme from the PR Code tab parse cache keys. It …
Linked Issues check Passed Issue #37996 requires that an unsaved PR review comment, reply, or edit in the pull-request Code tab stays open with its text after a macOS dark/light switch. The reviewed head removes `${resolvedThem…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes only PullRequestCodeTab.tsx, in two cache-key expressions. The test file change adds the regression test for the linked issue. The PR description and o…
Description check Passed The description states the problem, the change, the reproduction on main, the verification, and the author's attribution. It maps onto the template's Problem, Change, Scope, Verification, and agent-at…
Full details: Title check

Explanation

The title names the fix and its scope: unsaved PR review comments survive a light/dark appearance switch. It matches the main change, which removes the theme from the PR Code tab parse cache keys. It follows the conventional commit format from the template. It is specific and does not need a file list.

Full details: Linked Issues check

Explanation

Issue #37996 requires that an unsaved PR review comment, reply, or edit in the pull-request Code tab stays open with its text after a macOS dark/light switch. The reviewed head removes ${resolvedTheme} from the diffModel key (pull-request:${scopeKey}:${ignoreWhitespace}) and from the withheld-file parse key (pull-request:${scopeKey}:withheld:${path}) in PullRequestCodeTab.tsx. The PR description states that the theme-keyed parse caused re-parsing, new render keys, fold reset, and remount of annotations, which discarded component-state text. Removing the theme from those keys removes that reset path. resolvedTheme still feeds diffViewOptions, so theme display is preserved. The regression test 'keeps an unsent reply when the appearance switches between light and dark' is reported as failing before the fix and passing after it. I did not run that test. The causal chain from cache key to remount is taken from the PR description and was not traced through buildFileDiffRenderKey or the annotation components. Syntax-colour updates after a live switch are not verified, and they are not part of the issue's stated requirement.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes only PullRequestCodeTab.tsx, in two cache-key expressions. The test file change adds the regression test for the linked issue. The PR description and objectives state that DiffPanel and useReviewFilePatches are excluded, and the diff does not touch them. No unrelated changes were found in the reviewed diff.

Full details: Description check

Explanation

The description states the problem, the change, the reproduction on main, the verification, and the author's attribution. It maps onto the template's Problem, Change, Scope, Verification, and agent-attribution sections, with clear before/after evidence and a failing test named. Two gaps remain. The Problem section does not state the expected behavior in one clear sentence. The Scope section does not clearly say why the change needs no issue, although it does link issue #37996 and fixes #37996. The Verification section relies on pre-existing CI results and a proof run, but its focused test results are reported (9/9 pass). The description also repeats the DiffPanel/useReviewFilePatches note twice in the 'Not in this change' section. These are non-critical, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • 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 49c3ab8 and 9c7c3e4.

Files selected for processing: 2

  • apps/web/src/components/pullRequest/PullRequestCodeTab.browser.test.tsx
  • apps/web/src/components/pullRequest/PullRequestCodeTab.tsx

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). 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]: Unsaved PR review comment text is lost when macOS switches between dark and light mode

1 participant