Skip to content

Commit ff664d0

Browse files
voidstackloopclaude
andcommitted
fix(server): serialize Postgres-backed test files to stop real deadlocks
The postgres-*.test.ts suites all run against one shared Postgres instance (CI's real service container). vitest's default file-level parallelism runs these files concurrently across worker processes, which is exactly what produced the deadlocks (AccessExclusiveLock/ RowShareLock contention) and foreign-key violations the first real Postgres-backed CI run just surfaced -- these suites never ran against real Postgres in CI before today. Set fileParallelism: false so they serialize instead; correctness over wall-clock time is the right trade for integration tests against genuinely shared, unpartitioned state. Not independently verifiable here (no local Postgres/Redis in this environment) -- the non-Postgres suite (647 tests) still passes unchanged with this config. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 082f877 commit ff664d0

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

server/vitest.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,21 @@ export default defineConfig({
44
test: {
55
environment: "node",
66
include: ["src/**/*.test.ts"],
7+
// The postgres-*.test.ts suites (see e.g. postgres-rls.test.ts's own
8+
// disclosure comment) all run against ONE real shared Postgres
9+
// instance (CI's DATABASE_URL service container; a developer's own
10+
// local instance otherwise) — vitest's default file-level
11+
// parallelism runs these files concurrently across worker
12+
// processes, and real, unrelated-looking Postgres deadlocks
13+
// (AccessExclusiveLock/RowShareLock contention) and foreign-key
14+
// violations (one file's teardown removing a row another file's
15+
// in-flight test still references) are the direct result, first
16+
// surfaced when this package's Postgres suites started actually
17+
// running in CI (see the "server" job's own comment in
18+
// .github/workflows/ci.yml). Serializing files here trades some
19+
// wall-clock time for correctness against genuinely shared,
20+
// unpartitioned state — the correct trade for integration tests,
21+
// not a workaround for a test bug.
22+
fileParallelism: false,
723
},
824
});

0 commit comments

Comments
 (0)