Skip to content

Wait for the QR chunk and terminal-context autorun before Storybook snapshots - #771

Merged
nedtwigg merged 2 commits into
mainfrom
fix/ci-35907472490
Sep 23, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
fix/ci-35907472490

Conversation

@dormouse-bot

@dormouse-bot dormouse-bot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Makes two groups of Storybook stories wait for async UI before their snapshot is taken, so Argos stops capturing a different frame on each run.

QR setup story. The Argos run on main after #770 (run 35907472490) failed on RemoteControlSection > Setup Phone Qr under WebKit: Unable to find role="img" and name "Setup code for this machine". The setup panel had rendered, but ScannableCode's <Suspense fallback={null}> was still waiting for the lazily imported QrCode chunk. findByRole's default 1 s timeout was racing a cold chunk fetch. On WebKit this story took 1.4 s and 2.3 s in the two green runs before it and 2.6 s when it failed. The play function now runs import('../components/QrCode') before the click, so the panel's lazy() import resolves from the module cache. The rendered component is unchanged.

Terminal-context stories. Every story that opens the terminal context captured whichever helper step it had reached: "Waiting for shell…", "Running git status…", or "autoran". So main's baseline and a PR's run could each catch a different step. This caused the 7 Chromium diffs Argos reported on this PR. The new settleTerminalContext in lib/src/stories/settle-terminals.ts waits for the status row's spinner to clear, then runs settleTerminals so the helper has painted. It is used by the six contextDialogStory stories, Wall → Alert Modal Open, and Wall → Terminal Context, where it replaces the one-off autoran check from #770.

Verification: all 23 RemoteControlSection stories pass under the chromium Argos project, and tsc --noEmit is clean. Two full local Chromium runs differ only by ±1 colour-level antialiasing in SettingsDialog, which is below Argos's threshold. WebKit could not run locally, so this PR's Argos run is the WebKit check.

On a loaded WebKit runner the lazily-imported QrCode chunk can take longer
than findByRole's 1 s default to arrive after the click, failing the Argos
run on main (run 35907472490). Importing it in the play function first lets
the panel's own lazy import resolve from the module cache.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 23, 2026

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a5289e
Status: ✅  Deploy successful!
Preview URL: https://21d99a86.mouseterm.pages.dev
Branch Preview URL: https://fix-ci-35907472490.mouseterm.pages.dev

View logs

@nedtwigg
nedtwigg marked this pull request as ready for review September 23, 2026 19:42
@argos-ci

argos-ci Bot commented Sep 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
storybook-chromium (Inspect) 👍 Approved by Ned Twigg 7 changed Sep 23, 2026, 8:20 PM
storybook-webkit (Inspect) ✅ No changes detected - Sep 23, 2026, 8:20 PM
Deployment Status Branch Updated (UTC)
preview (Open) Ready fix/ci-35907472490 Sep 23, 2026, 8:20 PM

Every story that opens the terminal context captured whichever helper step
the runner had reached ("Waiting for shell…", "Running git status…", or
"autoran"), so Argos, rendering 550 captures at once on CI, saw a different
frame from its baseline. `settleTerminalContext` waits for the status
spinner to clear and the helper to paint; the six context-dialog stories,
Wall's alert modal, and Wall's TerminalContext (replacing its one-off gate)
all use it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@nedtwigg

Copy link
Copy Markdown
Member

Added 6a5289e. The 7 Chromium changes Argos reported here came from a separate race, not from this PR.

Every story that opens the terminal context captured whichever helper step it had reached: "Waiting for shell…", "Running git status…", or "autoran". Main's baseline caught a different step than this PR's run did.

The new settleTerminalContext in lib/src/stories/settle-terminals.ts waits for the status spinner to clear and the helper to paint. It's used by the six contextDialogStory stories, Wall → Alert Modal Open, and Wall → Terminal Context, where it replaces the one-off check from #770.

Two full local Chromium runs differ only by ±1 colour-level antialiasing in SettingsDialog, which is below Argos's threshold.

@dormouse-bot dormouse-bot changed the title Preload the QR chunk before the SetupPhoneQr story waits for it Wait for the QR chunk and terminal-context autorun before Storybook snapshots Sep 23, 2026
@nedtwigg
nedtwigg merged commit e5e0c07 into main Sep 23, 2026
18 checks passed
@nedtwigg
nedtwigg deleted the fix/ci-35907472490 branch September 23, 2026 20:38

This branch is waiting to be deployed

1 waiting deployment
hosted-preview 6a5289e1 Waiting Sep 23, 2026 by nedtwigg via cleanup #327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants