Skip to content

fix(e2e): stabilize playwright against Vite dep-optimizer races - #38

Merged
schmug merged 1 commit into
mainfrom
claude/crazy-proskuriakova-94766f
Apr 19, 2026
Merged

schmug merged 1 commit into
mainfrom
claude/crazy-proskuriakova-94766f

Conversation

@schmug

@schmug schmug commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • The desktop golden-path e2e intermittently failed in CI with 504 Outdated Optimize Dep on the dynamic import of OSShell.tsx. Vite's dep optimizer was re-bundling mid-flight as it discovered deps reached only through lazy-loaded islands (zustand, zustand/middleware, react-rnd), invalidating in-flight module URLs.
  • astro.config.mjs: pre-bundle the offending deps via optimizeDeps.include, and warm up the island entries (RootShell/OSShell/MobileShell) with server.warmup.clientFiles so Vite's crawl completes before the first browser request.
  • playwright.config.ts: in CI, serve the built site via astro preview — no dev optimizer at all, closest to prod. Local dev keeps astro dev for fast iteration.

Why two layers?

optimizeDeps.include alone failed on cold caches (reproduced locally 1/5). Adding server.warmup closed the dev-mode race too. For CI, switching to astro preview eliminates the Vite dep optimizer entirely — the most robust option for the ~12s build cost per run. The dev-mode fixes still help any local npm run test:e2e or npm run dev session.

Test plan

  • 5× consecutive CI=1 npm run test:e2e with rm -rf node_modules/.vite node_modules/.astro dist between runs → 5/5 pass (9 tests each, 1 skipped per iframe-embed note)
  • 5× consecutive local npm run test:e2e with same cold-cache wipe → 5/5 pass (10 tests each)
  • npm run format:check, npm run lint, npm run typecheck all green
  • GitHub Actions CI green on this PR

🤖 Generated with Claude Code

The desktop golden-path e2e intermittently failed in CI with "504
Outdated Optimize Dep" on the dynamic import of OSShell.tsx. Vite's
dep optimizer was re-bundling mid-flight as it discovered deps reached
only through lazy-loaded islands (zustand, zustand/middleware,
react-rnd), invalidating in-flight module URLs.

- astro.config.mjs: pre-bundle the offending deps via optimizeDeps.include
  and warm up the island entries with server.warmup.clientFiles so
  Vite's crawl completes before the first request.
- playwright.config.ts: in CI, serve the built site via astro preview —
  no dev optimizer at all, closest to prod. Local dev keeps astro dev
  for fast iteration.

Verified: 5/5 cold-cache runs pass in CI mode, 5/5 in local dev mode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@schmug
schmug enabled auto-merge (squash) April 19, 2026 01:53
@schmug
schmug merged commit aa3c761 into main Apr 19, 2026
2 checks passed
@schmug
schmug deleted the claude/crazy-proskuriakova-94766f branch April 19, 2026 01:54
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.

1 participant