You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Re-enable storybook browser tests in CI (SKIP_STORYBOOK_TESTS since 7544f31) #35
All storybook browser suites are skipped in CI via SKIP_STORYBOOK_TESTS: '1' (ci.yml:55), gated per-package in vitest.config.ts (process.env.SKIP_STORYBOOK_TESTS ? [] : [storybook]). They "run locally" — in practice nobody does, so story tests rot silently.
Two stories were red on main for an unknown period: page-action-cardErrored (real UX bug — JSON-quoted error text) and file-read-cardRead (asserted text Pierre renders into an open shadow root). Both only surfaced during a local full-suite run.
History (commit 7544f31, 2026-06-19)
Root cause then: "upstream vitest/storybook cold dep-optimize reload race that fails only on CI's constrained runners (reproduced in a 2-core Linux container; passes on a warm cache / unconstrained CPU)".
Dead-ends already tried and reverted (don't repeat): per-package browser ports, react devDeps, optimizeDeps include/exclude/noDiscovery, addon removal, a serial-test step.
The same suites flaked locally under full turbo parallelism (browser-session connect timeouts, Cannot read properties of undefined (reading 'map'), failures hopping between solid-diffs / ui-kit-system / ui-kit-tap per run) and were cured completely by turbo --concurrency=3 (root pnpm test now caps it). CI's turbo invocation has NO concurrency cap on a ~4-vCPU runner — contention plus the cold optimizer compound there.
Leads
Cheapest: add --concurrency=2/3 to the ci.yml turbo run and drop SKIP_STORYBOOK_TESTS — the local result suggests contention is the dominant factor. Validate by re-running the CI job several times on a scratch PR.
Tried the cheap fix (lead #1) on branch ci/test-gate-extensions-and-storybook / PR #36: dropped SKIP_STORYBOOK_TESTS and relied on --concurrency=3. It does not hold on CI — ruled out.
Two build + test runs, both failed on the documented cold vite dep-optimizer race:
Run 1 (10m21s): packages/widget/src/page/page-mirror.stories.tsx — Agent Click + Showcase, Test timed out in 15000ms, preceded by Failed to resolve dependency: react … present in client 'optimizeDeps.include' and TypeError: Cannot read properties of undefined (reading 'map').
Run 2 (4m9s): packages/widget/src/presence.stories.tsx > Default — same 15s timeout, same optimizer errors.
The failing suite hops between runs (page-mirror → presence) — matches the "failures hopping between packages" signature. --concurrency=3 cured this locally under full turbo parallelism but not on the ~4-vCPU runner.
Escape hatch (SKIP_STORYBOOK_TESTS) restored and stays. Issue remains open for lead #2 — warm the vite/storybook dep-optimizer cache in a prior CI step (node_modules/.cache/storybook), or confirm whether the storybook 10.x / vitest 4.1.9 pairing fixed the upstream race.
Resolved by #37 (merged, squash ac27929). Storybook browser suites now run in CI — SKIP_STORYBOOK_TESTS is gone.
Root cause (reproduced in a CPU-throttled 2-core container)
Cold vite dep-optimizer reloads the browser page under contention, so an interaction story loads/reloads mid-test:
Intra-package: many story files run in parallel browser workers sharing one cold optimizer → a worker mid-play() gets reloaded → 15s timeout. Consistently ui-kit-system/presence.stories > Default on CI (it has the longest play(), so it's the most-exposed victim).
Cross-package: many packages' optimizers starve each other → a package's page is closed during file setup (createTesters) → "Browser connection was closed". Seen on ui-kit-chat/action-bar.stories.
Same upstream bug as storybookjs/storybook#33091 (preview-annotation files not registered as vite optimizer entries); fixed upstream by storybookjs/storybook#33875, shipping in storybook 10.5.0 (not in the 10.4.x line).
Fix (both parts load-bearing, proven by experiment)
fileParallelism: false on the 7 storybook vitest projects → intra-package.
--concurrency=3 on the turbo test run → cross-package.
Ruled out by experiment (all still failed the reproducing baseline)
Remove @storybook/addon-docs / react — red herring.
Upgrade storybook 10.4.4 → 10.4.6 — #33875 isn't in the 10.4.x line.
optimizeDeps.include (real harness deps) and optimizeDeps.entries — 5-6/6 fail; the failure is optimize timing under contention, not late dep discovery.
test.retry — would work (one-time cold reload) but masks genuine flakes; not adopted.
Follow-up
When storybook 10.5.0 is stable, upgrade and drop both mitigations (the cap slows CI and serial story files are slower). Tracking that here.
Activity
ci: test packages/extensions/* and re-enable storybook suites
ci: keep SKIP_STORYBOOK_TESTS — concurrency cap alone doesn't cure th…
omridevk commentedon Jul 6, 2026
Tried the cheap fix (lead #1) on branch
ci/test-gate-extensions-and-storybook/ PR #36: droppedSKIP_STORYBOOK_TESTSand relied on--concurrency=3. It does not hold on CI — ruled out.Two
build + testruns, both failed on the documented cold vite dep-optimizer race:packages/widget/src/page/page-mirror.stories.tsx— Agent Click + Showcase,Test timed out in 15000ms, preceded byFailed to resolve dependency: react … present in client 'optimizeDeps.include'andTypeError: Cannot read properties of undefined (reading 'map').packages/widget/src/presence.stories.tsx > Default— same 15s timeout, same optimizer errors.The failing suite hops between runs (page-mirror → presence) — matches the "failures hopping between packages" signature.
--concurrency=3cured this locally under full turbo parallelism but not on the ~4-vCPU runner.Escape hatch (
SKIP_STORYBOOK_TESTS) restored and stays. Issue remains open for lead #2 — warm the vite/storybook dep-optimizer cache in a prior CI step (node_modules/.cache/storybook), or confirm whether the storybook 10.x / vitest 4.1.9 pairing fixed the upstream race.ci: run storybook tests at --concurrency=2 instead of skipping them
omridevk commentedon Jul 7, 2026
Resolved by #37 (merged, squash
ac27929). Storybook browser suites now run in CI —SKIP_STORYBOOK_TESTSis gone.Root cause (reproduced in a CPU-throttled 2-core container)
Cold vite dep-optimizer reloads the browser page under contention, so an interaction story loads/reloads mid-test:
play()gets reloaded → 15s timeout. Consistentlyui-kit-system/presence.stories > Defaulton CI (it has the longestplay(), so it's the most-exposed victim).createTesters) → "Browser connection was closed". Seen onui-kit-chat/action-bar.stories.Same upstream bug as storybookjs/storybook#33091 (preview-annotation files not registered as vite optimizer entries); fixed upstream by storybookjs/storybook#33875, shipping in storybook 10.5.0 (not in the 10.4.x line).
Fix (both parts load-bearing, proven by experiment)
fileParallelism: falseon the 7 storybook vitest projects → intra-package.--concurrency=3on the turbo test run → cross-package.Ruled out by experiment (all still failed the reproducing baseline)
@storybook/addon-docs/ react — red herring.optimizeDeps.include(real harness deps) andoptimizeDeps.entries— 5-6/6 fail; the failure is optimize timing under contention, not late dep discovery.test.retry— would work (one-time cold reload) but masks genuine flakes; not adopted.Follow-up
When storybook 10.5.0 is stable, upgrade and drop both mitigations (the cap slows CI and serial story files are slower). Tracking that here.