Playwright E2E bulk shards flake: webServer OOM → ERR_CONNECTION_RESET / page.goto timeouts
Symptom
The Playwright E2E bulk shards (bulk-1..4) flake on PRs: a RANDOM, diff-unrelated test fails each run with net::ERR_CONNECTION_RESET at http://localhost:3000 or a page.goto 30s timeout. A different test each run is the tell — on PR #1560: issue-detail-flow.spec.ts:485 (remove blocked-by link), then on re-run issue-detail-flow.spec.ts:569 (create with a link). Both pass on main.
Root cause (hypothesis)
The next dev webServer the E2E lane runs against OOMs under a heavy bulk shard's memory pressure (dev holds a resident webpack compiler + compiles routes on demand) and drops the connection mid-test → whichever test is navigating when the server dies fails. It is the harness dying, not any assertion about the code under test.
Impact
- Masks real results and forces repeated
gh run rerun <id> --failedcycles (PR #1560 needed several). - Makes a red check indistinguishable from a real regression — erodes trust that green means green.
Fix directions (investigate)
- Give the E2E webServer more heap headroom (
NODE_OPTIONS=--max-old-space-size=…) and/or a bigger CI runner. - Reduce per-shard weight — more, smaller shards (each with its own PG), not fewer heavy ones.
- Pre-warm the heaviest routes before the shard runs so compile isn't competing with the browser.
- Consider a production build for shards that seed in-process (no
/api/_testroutes) —next startis far lighter thannext dev.
Related lower-severity flakes seen on PR #1560 (logged; don't chase with code)
acceptance-videotest 1 — first-hit cold-compile of/items/[id]; the default 20sexpecttimeout is tight → "Acceptance" heading not found. FIXED in #1560 (bumped that first assertion to 60s; identical-seed test 2 passes warm, proving it's timing).Vitest (integration + coverage)→ProjectRoadmapCanvas.test.tsx— one auto-layout assertion flakes in CI; passes 25/25 locally.bulk-3(and peers) setup —Installation process exited with code: 100(pnpm install died); leg dies at setup, 0 tests run (~1m runtime is the tell). Pure infra.
Filed while shipping MOTIR-1665 (PR #1560), where these flakes repeatedly red-lit an otherwise-green diff.