Repository navigation
fix: move removing harness seeds into the stub's localStorageEntries - #36136
Conversation
825e674 to
0c8dada
Compare
|
Rebased: main moved in website/src/pages/chat/AssistantMessage.tsx since this head's CI ran (2f7e9f2 -> b2aac45); CI re-running. The last run was built on a main whose reply menu used [operator: bolichen97] |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The PR only changes capture harness scripts under [UX-REVIEWED] 8207ff6 Description read[DESCRIPTION-READ] 72cb09732cc78d4d656edc0b742036dcc7c0882226195797ea486249a9d1d44a That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. Each moved seed now runs after the clear at the top of the stub's own init script, so the order no longer depends on Chromium. Every removal that was dropped targeted a key that clear had already wiped, or a key a brand-new context never has. Notes
[DESIGN-REVIEWED] 8207ff6 Description read[DESCRIPTION-READ] 7e833f836a2a1094d3dd40cb81ca3604f196497caeadcdbfbc731935df30e8f6 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: ApproveWhy: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. Moves harness seeds that also removed or cleared keys into the stub's localStorageEntries. In stub-dashboard-api.mjs:266-271, one init script clears storage, writes mc-theme and mc-onboarded, then writes the entries, so every dropped removal acted on a key that clear had already removed. composer-collapse uses preserveStorage but a fresh context, so its dropped first-boot removal changes nothing. crew-board's dropped seed repeated the theme already passed to the stub. Every value now built in Node (SLOT, PROJECT, fileTab, bucket, SPLIT, tabs, s.attr, rail.collapsed) is declared before the stub call that uses it. The SLOT-as-second-argument bug fix in two harnesses is correct. The new test expects exactly the ten RESEEDED_PAGES files. I checked about 90 harness files with init scripts that call clear/removeItem: apart from those ten, none calls stubDashboardApi or stubSplitPanes, so the expectation should hold. The failing CI checks are unrelated: a Python backend test and a CodeQL rate limit. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
Eighteen capture harnesses seeded a stubbed page from their own addInitScript that also called localStorage.removeItem or clear, so the seed still raced the clear inside stubDashboardApi's init script, whose order against a caller's script Playwright does not define. Each page registers its seed once, so the removal is already done by the stub's clear: the removal goes and the writes move into localStorageEntries. A seed that only repeated the stub's own theme and onboarding keys is dropped, and capture-composer-collapse loses a first-boot removal that a new context never needed. The guard test now also reports a removeItem or clear seed on a stubbed page. The ten harnesses that re-seed one page per scenario stay pinned by name until they move to a fresh page per scenario. Part of #31778
0c8dada to
8207ff6
Compare
|
Rebased: main moved in test/test_reply_format_once.py since this head's CI ran (b2aac45 -> b677e0d); CI re-running. The last run merged this branch with a main where the new [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Verified on head 8207ff6. Each dropped removeItem or clear targets a key that the stub's own init script already clears, because no changed harness passes preserveStorage except composer-collapse, which uses a fresh context. Every moved entry reads values that are defined before the stub call. node --check is clean on all 19 harnesses. The new harnessStorageSeeds case passes against the head's scripts and fails against the parent's, listing exactly the 19 fixed harnesses.
Done well: the seed writes now run after the clear by construction. The change also fixes a real bug in blocked-link-chip-host-only and redacted-reveal, where the extra SLOT argument to addInitScript made those harnesses store the string 'undefined' as the active slot.
Optional: the body's counts are off by one. The parent has 30 init-script sites in 29 harnesses, and the first table row covers 17 seeds, not 16.
Optional: RESEEDED_PAGES pins file names, not sites. A second removing seed in a file already on the list would still pass. A per-file site count, or a line in the doc comment, would close that.
Optional: five moved seeds still pass mc-theme 'dark' and mc-onboarded '1', which the stub already writes. Main has the same pattern elsewhere.
Problem / Motivation
Goal: Capture harnesses that seed a stubbed page once, and also removed or cleared keys in that seed, get their seed on every run whatever order Playwright runs init scripts in.
Thirty capture harnesses seed a page that goes through
stubDashboardApifrom their ownaddInitScript, and that script also callslocalStorage.removeItemorlocalStorage.clear.localStorageEntries(the fix for #4760) cannot express a removal, so these seeds still ride on Chromium running the stub's clear before them. Playwright does not define that order.Why it matters
These harnesses take the screenshots that PRs attach as evidence. If the order flips, the stub's clear wipes the seed and the capture comes up with the wrong theme, slot, locale or panel layout, without any error, so a wrong screenshot reads as proof.
Not a goal
RESEEDED_PAGESin the test). A stub registered once cannot carry a seed that changes per scenario; they need a fresh page per scenario, a later part of Harness storage seeds that localStorageEntries cannot express still ride on init-script order #31778.openTranscriptHarness,capture-side-panel-add-menu,check-i18n-render.mjs.stubDashboardApiitself.What changed (motivation → approach → change)
Every harness below now seeds its page inside the stub's own init script, so the seed lands on every run, not only when Chromium happens to run the stub's clear first. That works because each of these pages registers its seed once and the stub clears storage at the top of its script: every
removeItemorclearin the harness's own script removed a key that clear had already removed. Without them onlysetItemwrites are left, which is whatlocalStorageEntriesholds, and the stub writes those after its clear.setItemwrites plus a redundantremoveItem/clearlocalStorageEntries(values computed in Node); the removal goescapture-crew-board.mjsmc-themeandmc-onboarded, so it is droppedcapture-composer-collapse.mjs(preserveStorage: true)mc-composer-collapsedacted on a new context that never has the key, so it is droppedcapture-blocked-link-chip-host-only.mjsandcapture-redacted-reveal.mjspassedSLOTas a second argument toaddInitScript, which takes one, so they wrote the stringundefinedas the active slot; the entry now carriesSLOT. Comments that explained a removal now say the stub's clear leaves that key absent.harnessStorageSeeds.test.tsgains a second check: an init script on a stubbed page that callsremoveItemorclearis reported, and the reported files must be exactly the ten re-seeding harnesses, so a new one fails the test.Backwards compatibility
Compatible: only capture harnesses under
website/scripts/and one test change; no product code, API or stored data is touched.Removes nothing: the dropped removals act on keys the stub's own clear already removed, and no shipped code reads the harness scripts.
Tests
website/src/test/harnessStorageSeeds.test.ts: the new case fails on the parent's harness files (reverted in a throwaway worktree: 1 failed, 1 passed) and passes on this head; the existing flat-setItemcase stays at zero. Run 10 times and shuffled, the same result each time.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
node --checkon every changed harness.Screenshots / video
Why no screenshot: only capture harness scripts and a source-shape test change; no product surface renders differently.
Related Issues
Part of #31778
Sibling sweep
Swept: git grep -lE "localStorage.(removeItem|clear)(" -- website/scripts/, kept where the file also calls stubDashboardApi( or stubSplitPanes( (then the test's AST walk over each addInitScript on a stubbed page)
Sibling: website/scripts/capture-continue-turn.mjs -- tracked in #31778
Sibling: website/scripts/capture-diff-split-preference.mjs -- tracked in #31778
Sibling: website/scripts/capture-file-changes-older-turn.mjs -- tracked in #31778
Sibling: website/scripts/capture-files-tree-empty-folder.mjs -- tracked in #31778
Sibling: website/scripts/capture-pierre-chat-diffs.mjs -- tracked in #31778
Sibling: website/scripts/capture-pierre-files-tab.mjs -- tracked in #31778
Sibling: website/scripts/capture-pierre-misc-surfaces.mjs -- tracked in #31778
Sibling: website/scripts/capture-pulls-first-paint.mjs -- tracked in #31778
Sibling: website/scripts/capture-stale-collapse.mjs -- tracked in #31778
Sibling: website/scripts/capture-turn-snapshot-budget.mjs -- tracked in #31778
Sibling: website/scripts/lib/stub-dashboard-api.mjs -- not affected -- its clear is the one the harnesses now rely on
Pattern harvest
Rule candidate: review-prompt
Pattern: a test harness writes browser storage from its own init script on a page another init script clears; the two scripts' order is undefined
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement