From 80570f704009333de4bc015c82915699c09d2d33 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Tue, 23 Jun 2026 23:29:41 -0500 Subject: [PATCH 1/2] fix(db): stop pglite migration tests flaking CI on timeout + WASM OOM packages/db's migrate.test.ts spins up a real PGlite (WASM Postgres) instance per test and applies the full drizzle migration set. Each case takes ~3-5s locally and longer on CI, where turbo runs ~20 packages' suites concurrently. Two failure modes resulted, bouncing between the push/ci and pr/ci pipelines on identical SHAs: FAIL src/migrate.test.ts > runPgliteMigrations > ... Error: Test timed out in 5000ms. -> memory access out of bounds (wasm:/wasm/...) 1. The 5s vitest default timeout expires mid-migration -> phantom 'Test timed out in 5000ms'. Raise testTimeout/hookTimeout to 120s so legitimately-slow migrations finish. 2. Each PGlite WASM heap is multi-hundred-MB (RSS ~705MB for this file alone); parallel forks multiply the peak and tip the runner into the WASM OOM. Pin the package to a single fork so only one instance is resident at a time. Also register packages/db/vitest.config.ts in eslint's allowDefaultProject (alongside the gateway/storage vitest configs) so the typed lint can parse the now-non-trivial config. Verified: full db suite green 3x locally with the new config; each run ~13s, no timeouts, no OOM. eslint clean on both files. Co-Authored-By: Claude Opus 4.8 --- eslint.config.mjs | 1 + packages/db/vitest.config.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/eslint.config.mjs b/eslint.config.mjs index eb57f77..ac2be1a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -28,6 +28,7 @@ export default tseslint.config( 'apps/web/e2e/helpers/*.ts', 'apps/web/playwright.config.ts', 'apps/gateway/vitest.config.ts', + 'packages/db/vitest.config.ts', 'packages/storage/vitest.config.ts', 'packages/mosaic/__tests__/*.ts', 'tools/federation-harness/*.ts', diff --git a/packages/db/vitest.config.ts b/packages/db/vitest.config.ts index 8e730d5..7cdd921 100644 --- a/packages/db/vitest.config.ts +++ b/packages/db/vitest.config.ts @@ -4,5 +4,22 @@ export default defineConfig({ test: { globals: true, environment: 'node', + // The migration suite spins up a real PGlite (WASM Postgres) instance per + // test and applies the full drizzle migration set. Each case legitimately + // takes ~5s locally and considerably longer on CI, where turbo runs many + // packages' test suites concurrently. The 5s vitest default then expires + // mid-migration and the run fails as a phantom "Test timed out in 5000ms" + // (often surfacing the underlying WASM `memory access out of bounds` when + // the heap is starved). Give migrations real headroom. + testTimeout: 120_000, + hookTimeout: 120_000, + // Each PGlite instance carries a multi-hundred-MB WASM heap. Running test + // files in parallel forks multiplies that peak and is what tips the CI + // runner into the WASM OOM. A single fork keeps only one instance resident + // at a time — slightly slower, but deterministic. + pool: 'forks', + poolOptions: { + forks: { singleFork: true }, + }, }, }); -- 2.49.1 From 7210b7391a8870bae476eb5e84f428d7aa64077f Mon Sep 17 00:00:00 2001 From: Jarvis Date: Tue, 23 Jun 2026 23:37:33 -0500 Subject: [PATCH 2/2] fix(ci): gitignore vite/vitest *.timestamp-*.mjs to stop turbo traversal race The push/ci lint step intermittently failed with: x Package traversal error: .../packages/macp/vitest.config.ts.timestamp- .mjs: IO error ... No such file or directory (os error 2) vite/vitest/esbuild write a transient *.timestamp-*.mjs next to a TS config while loading it, then unlink it. The files were untracked but not ignored, so turbo's package traversal hashed them and raced the unlink. Ignoring them excludes them from turbo's input set and removes the race. Same class of fix as the pglite timeout/OOM change in this PR: transient test tooling artifacts destabilising CI. Co-Authored-By: Claude Opus 4.8 --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 27556b3..dd50108 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,10 @@ infra/step-ca/dev-password # Scratch dirs created by the framework git-wrapper shell test harnesses .mosaic-test-work/ + +# Transient config files vite/vitest/esbuild write next to a *.config.ts while +# loading it, then unlink. They are untracked but were not ignored, so turbo's +# package traversal hashed them and intermittently failed CI with "Package +# traversal error: ... .timestamp-*.mjs: No such file or directory" when the +# file vanished mid-scan. Ignoring them removes the race. +*.timestamp-*.mjs -- 2.49.1