fix(e2e): stabilize playwright against Vite dep-optimizer races - #38
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
504 Outdated Optimize Depon the dynamic import ofOSShell.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 viaoptimizeDeps.include, and warm up the island entries (RootShell/OSShell/MobileShell) withserver.warmup.clientFilesso Vite's crawl completes before the first browser request.playwright.config.ts: in CI, serve the built site viaastro preview— no dev optimizer at all, closest to prod. Local dev keepsastro devfor fast iteration.Why two layers?
optimizeDeps.includealone failed on cold caches (reproduced locally 1/5). Addingserver.warmupclosed the dev-mode race too. For CI, switching toastro previeweliminates the Vite dep optimizer entirely — the most robust option for the ~12s build cost per run. The dev-mode fixes still help any localnpm run test:e2eornpm run devsession.Test plan
CI=1 npm run test:e2ewithrm -rf node_modules/.vite node_modules/.astro distbetween runs → 5/5 pass (9 tests each, 1 skipped per iframe-embed note)npm run test:e2ewith same cold-cache wipe → 5/5 pass (10 tests each)npm run format:check,npm run lint,npm run typecheckall green🤖 Generated with Claude Code