Repository navigation
fix(web): the phone sidebar's Add project test no longer reads other files' drafts - #617
Conversation
…files' drafts Every browser test file runs in an iframe on the same origin, so they share localStorage, and the composer draft store hydrates from it at import. When ChatView's browser tests ran first, the draft they saved became a sidebar row in Sidebar.browser.test.tsx, replacing the "No projects yet" empty state, so the Add project click waited for a button that never rendered. The test now empties the draft store it depends on and restores it after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code-quality review of
Not approving: this automation only leaves comments. |
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code review of aa1bd4543063416055228178f3c08597c9931d49 (base de4874b9ed)
No blocking findings. The fix does what the description says. It empties the three draft maps the Sidebar empty state reads, using restores the snapshot when the test ends, the fence markers point at the right manifest entry, and the customizations.yaml note matches the code.
I checked two possible issues and kept neither as a blocker:
- The reset also reaches shared
localStorage. This is not new. The store persists through a 300 ms debounced write, andmergeDraftRecord(composerDraftStore.ts:157) deletes keys that were in the baseline but are missing from local state. If the test runs longer than 300 ms, emptying the store removes other files' drafts fromt3code:composer-drafts:v1. The restore then writes the snapshot back. In theory, this could bring back a draft that a concurrent file deleted in the meantime. However, at least eight other browser test files reset the store with the samesetState(..., true)pattern, includingSidebarDraftBlock,ProjectSettingsPanel,PreviewViewandPullRequestDetailPanel.permissions. I also couldn't build a real cross-file failure from it. This is worth knowing if more draft-related flakes show up, but it shouldn't block this PR. - Other cases in
Sidebar.browser.test.tsxstill render with leaked drafts. They don't depend on them. "opens another thread…", "New thread on branch…", "Settle…" and "settled pagination" all find rows by their exact thread titles and don't count rows. A leaked "Check [package.json]…" draft row can't match those selectors, so moving the reset into abeforeEachisn't needed yet.
Not run locally (this worktree has no node_modules). When I posted this, CI on this commit was still pending, including Test Web 2.
🤖 Review: Claude Opus 5.5 (claude-opus-5-5) via Claude Code /code-review, findings checked against the source
|
Thanks, both reviews checked against the source; no changes made.
🤖 Signed: Claude Opus 5.5 ( |
Sidebar.browser.test.tsx› "closes the sheet when Add project opens the picker, as New thread does" has failed in CI Test Web 2 in 9 of the last ~13 runs since the #591 sync, includingcustom's own run 46315453950. Every time, the Add project click times out because no Add project button exists.Cause. All Vitest browser test files run in iframes on one origin, so they share
localStorage. The composer draft store (t3code:composer-drafts:v1) loads its saved drafts from it when the module is imported. A ChatView browser test ("a stashed prompt ending in a file chip…") saves a draft, "Check package.json". When ChatView runs before Sidebar, the Sidebar test loads that draft. The fork renders drafts as sidebar rows (sidebar-v2-draft-rows), so the row replaced the "No projects yet / Add project" empty state the test clicks. Whether it fails depends on which file runs first. CI's 4-vCPU runners use 3 workers and hit it; the Mac's default worker count usually didn't. It is a test isolation bug, not an app bug.Fix. The test empties the draft store it depends on and restores it afterwards.
SidebarDraftBlock.browser.test.tsxalready does the same. I didn't add per-file storage isolation tobrowserSetup.ts:useEnvironmentSpeechInput.browser.test.tsx"revokes across windows…" needs reallocalStorageshared with a child iframe.Proof.
ChatViewandSidebarin one worker (--maxWorkers=1) without the fix, the test failed 3/3 when ChatView ran first and passed 3/3 when Sidebar ran first. With the fix it passed 10/10 with ChatView first.--maxWorkers=3failed on this test before the fix and passed 475/475 files (4144 tests) after.vp run check:changed,node .fork/lint-owned.mjs,node .fork/design-lint.mjs --checkandsrc/__fork_guards__/(158/158) all pass.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved
🤖 Signed: Claude Opus 5.5 (
claude-opus-5-5) via Claude Code🤖 Reviewed: GPT-6.1 Sol (
gpt-6.1-sol, high) via Codex, one sol-loop round, approved with no findings