Repository navigation
Description
Context
Observed on PR #3265, confirmation run 41383510262, job browser (3) (checkout 9bd1eb92047d28951de02491a42f92edefbb030f, base b4b9204e25d5f882deacafe7f166029806f71bf6). The PR changes only packages/ui-server journal code, packages/ui-sdk types and docs; it does not touch packages/ui-react.
Failing test: packages/ui-kit/stories/conversation/ArtifactTheme.stories.tsx (path corrected 2026-11-02; it was cited under ui-react) › "Layout Phone", in both the storybook (chromium) and storybook-light (chromium) projects. The play function's findByRole("heading", { name: "Couldn't open this file." }) (ArtifactTheme.stories.tsx:56) timed out. The DOM dump shows the Storybook preview still on its sb-preparing-story loader, and its sb-errordisplay panel is present but inert with an empty message, so the story never rendered. The other three stories in the same file passed in both projects, as did 2846 of the shard's 2848 tests.
Scope
Diagnosed 2026-11-02 (see the diagnosis comment). The sb-preparing-story loader in the DOM dump is Storybook's static, inert preview template, which is always in the document; the dump is truncated before the story's own markup. The story did render: opened() found the link and the scratch check before the failing wait. The real cause is that FilePanel loads FileViewer (and FileTree) through lazyChunk, and "Layout Phone" is the first story in the file to open the panel. Its findByRole therefore has to absorb a cold Vite transform of the viewer module graph within Testing Library's default 1000 ms budget, which a loaded CI shard can exceed (the failing test took 1804 ms in total). The later stories find the chunk warm.
Fix: after Enter starts the real lazy load, await the same viewer and tree modules before the 1000 ms waits begin. This follows the precedent in destination-press.pointer.tsx. Apply it to both plays that open the panel, so the first story in either project, or under any filter, is never cold.
Out of scope
Raising the timeout or retrying the story without a diagnosed cause.
Acceptance criteria
- Both
ArtifactThemeplays wait for the real lazyFileViewer/FileTreeimports to finish after opening the panel, before any 1000 ms Testing Library wait. - No timeout is raised, and no retry or skip is added.
- A failing-first receipt holds the viewer module request in a real browser: without the fix "Layout Phone" fails on the same
findByRoleheading wait, and with the fix it passes. - Both story projects (
storybookandstorybook-light) pass the file in the pinned browser image.
Contract impact
None expected.
Activity
schlessera commentedon Nov 2, 2026
2026-11-02: second occurrence. This is PR #3282, confirmation run 41446241074, job `browser (3)`, head `beecb74c81e240b45279702e9eaddf005da83b69`, base `b228b1f21c4758ee712e922d12ebbe77cf4b3512`. The PR changes only the `packages/ui-sdk` worker socket test fixture and its test, and touches nothing in `packages/ui-react`. The failure is the same: `ArtifactTheme.stories.tsx` › "Layout Phone" (`storybook-light (chromium)`) timed out in `findByRole("heading", { name: "Couldn't open this file." })` at `:56`, with the preview still on `sb-preparing-story`. 1 of 2906 tests failed in that shard. Every other selected job in the run passed.
Under the 2026-10-25 strict-flake ruling (a repeated suspected flake on one test escalates to real, and a rerun never makes proof green), this now blocks a merge. #2745 (`priority: p0`) is blocked by it, so under the blocker-priority rule this issue is raised to `priority: p0`.
schlessera commentedon Nov 2, 2026
Claimed for implementation (claim token
w3267-c7f2), branchtest/3267-artifact-theme-cold-viewer. Collision check on the story file: proof-closure overlaps only (no path collisions).schlessera commentedon Nov 2, 2026
2026-11-02: readiness review and diagnosis. The body is updated: the corrected path, the diagnosed scope and acceptance criteria.
The preparing loader is a red herring. The
sb-preparing-story,sb-preparing-docs,sb-nopreviewandsb-errordisplayblocks in the dump are Storybook's static preview template. It is always in the document and staysinert, and the dump is cut off (...) before the story's own markup. The story had rendered:opened()had already found the link and thepresentscratch check before the failing wait.ArtifactTheme.stories.tsx:56:7is a bad source-map frame. The failing call is thefindByRolestraight after Enter inLayoutPhone.Root cause.
FilePanelloadsFileViewerandFileTreethroughlazyChunk(packages/ui-react/src/components/files/file-panel.tsx:34-35). "Layout Phone" is the first story in the file, so it is the first to open the panel in each project's page. ItsfindByRole, with Testing Library's default 1000 ms, therefore also absorbs a cold Vite transform of the viewer's module graph. A loaded shard can exceed that: the failing case took 1804 ms in total. The later three stories find the module warm, and that matches the evidence, since only Layout Phone ever failed.destination-press.pointer.tsxalready handles the same thing by awaiting the real lazy imports before its 1000 ms poll.Reproduction. I held the
file-viewer.tsxmodule request for 2.5 s with a temporary Playwright route (receipt only, not committed) and ran the unchanged story file in the pinned Playwright image. "Layout Phone" failed in bothstorybookandstorybook-lightwithUnable to find role="heading" and name "Couldn't open this file.", at the same:56:7frame and with the samesb-preparing-storydump. The other three stories passed.Fix. After Enter, both plays now await the same viewer and tree modules before their 1000 ms waits. No timeout, retry or skip changes. It is implemented on branch
test/3267-artifact-theme-cold-viewer.Same class elsewhere.
packages/ui-react/tests/browser/file-loading.layout.tsxpolls viewer and tree content on the default budget on a cold first render. It has no observed failure, so it is filed as a follow-up instead of widening this PR.test(ui-kit): wait for the cold file viewer chunk in the artifact the…
test(ui-kit): wait for the cold file viewer chunk in the artifact the…
test(ui-kit): wait for the cold file viewer chunk in the artifact the…
schlessera commentedon Nov 2, 2026
Merged in #3286 as
efea2be3edb69c8eb2e95549fb19852afa07b089on main (milestone 0.45.0). The squash parent557b01bc1and tree5cb9ce51fmatch the confirmed candidate checkoutd638b8052.packwas skipped, as intended for a tests-only change. Thestorybookandstorybook-lightArtifactTheme projects ran 4/4, with Layout Phone at 1.7 s and 1.9 s: the cold chunk was waited out instead of being charged to the 1000 ms wait.file-loading.layout.tsx: tests: file-loading layout polls lazy file viewer content on a cold chunk within the default 1000 ms #3285.