test(infra): serialize integration tests — fileParallelism=false#74
Conversation
#73) Multiple *.integration.test.ts files share a single PostgreSQL instance and race on FK constraints (paragraphs_parent_id_fkey) and unique keys (specs_section_source_unique) when run in parallel. Tests pass in CI by luck (sequential execution) but flake locally. Set `fileParallelism: false` on the integration project in vitest.config.ts to serialize file execution. Unit project untouched. The approved design doc specified `pool: 'forks' + poolOptions.forks.singleFork`, but Vitest 4.1.5 deprecated `test.poolOptions` (warning at runtime, options ignored). `fileParallelism: false` is the v4 equivalent — sets maxWorkers=1 internally. Same intent, current API. Verification: pnpm test:integration green 3 consecutive runs; pnpm test still parallel (1.09s wall); pnpm lint + pnpm build green. Closes #73
📝 WalkthroughWalkthroughAdds three design specification documents (DOCX refs, parse-time warnings, integration-test serialization), disables Vitest integration file parallelism, and updates .gitignore to ignore ChangesDesign planning and test infrastructure
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/superpowers/specs/2026-05-18-issue-027-design.md`:
- Around line 25-39: The fenced code block that begins with the tree listing
starting "src/parser/refs/" is missing a language identifier (triggers MD040);
update the opening fence to include a language tag (e.g., ```text) so the block
becomes ```text and keep the rest unchanged; ensure the closing fence remains
``` and run markdownlint to verify the MD040 warning is resolved.
In `@docs/superpowers/specs/2026-05-18-issue-073-design.md`:
- Around line 86-90: Update the "## Files" section of the design doc to reflect
that this is a newly added file: replace the lines under that heading (the
bullet block containing “- **Modified:** `vitest.config.ts`” and the sentence
“No new files. No deletions. No migrations.”) with accurate metadata indicating
this doc is a new file (e.g., mark as **Added** or **New:** and remove the
contradictory “No new files” statement); ensure the heading text and bullets
consistently state that the design doc itself is a newly added file.
- Around line 26-27: The spec still documents using `pool: 'forks'` and
`poolOptions: { forks: { singleFork: true } }` for the `integration` project
block in vitest.config.ts but the implemented config uses `fileParallelism:
false`; update the spec's Approach, Change snippet, and Acceptance Criteria to
reference `fileParallelism: false` in the `integration` project block (and
remove or replace mentions of `pool`/`poolOptions.singleFork`) so the document
matches the shipped config; search for occurrences in the doc (including the
blocks around the current references and the other affected ranges) and replace
the config example and acceptance text to show `fileParallelism: false` under
the `integration` project.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 202c100d-74a0-4bf4-b8e1-f373fafa8a93
📒 Files selected for processing (5)
.gitignoredocs/superpowers/specs/2026-05-18-issue-027-design.mddocs/superpowers/specs/2026-05-18-issue-068-design.mddocs/superpowers/specs/2026-05-18-issue-073-design.mdvitest.config.ts
- 027 design: add 'text' language tag to architecture fence (MD040) - 073 design: replace Vitest-3 pool/poolOptions syntax with shipped fileParallelism: false; note version-driven divergence and rationale - 073 design: clarify Files section — design doc itself is an added file No code changes.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/superpowers/specs/2026-05-18-issue-073-design.md`:
- Line 1: The document title still references the deprecated "singleFork"
approach but the actual configuration uses fileParallelism: false; update the
heading "Integration Test Race — Serialize via `singleFork`" to accurately
describe the implemented solution (e.g., "Integration Test Race — serialize
tests using fileParallelism: false") and remove or replace any other mentions of
`singleFork` so the doc and the configured behavior (fileParallelism: false) are
consistent.
- Line 66: Update the stale count in the verification line that reads "1.
**Local serial run** — `pnpm test:integration` completes with all 16 integration
files passing." (search for that exact sentence) to reflect the PR's recorded
result (change "16" to "14" and/or include the reported "14 files / 95 tests"
phrasing) so the spec matches the evidence.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b0023f96-ae5d-4d70-96bc-733daa141b6a
📒 Files selected for processing (2)
docs/superpowers/specs/2026-05-18-issue-027-design.mddocs/superpowers/specs/2026-05-18-issue-073-design.md
✅ Files skipped from review due to trivial changes (1)
- docs/superpowers/specs/2026-05-18-issue-027-design.md
- Title: replace 'singleFork' with shipped 'fileParallelism: false' - Verification: 14 integration files / 95 tests (was '16 files')
Status table: add 1c-iii..1c-viii and 1c-sec-i/ii rows covering PRs #69 #70 #71 #72 #74 #75 #76. Updates 'Active development' subtitle to reflect Phase 1c being complete. Parsing section: add plaintext signal hardening (#70), parse-anomaly warnings (#75), and DOCX resilience suite (#72) bullets. MCP section: note POST /mcp rate limiting (#69). Not Yet Built: strike completed items (DOCX cross-ref extraction in PR #76, parse worker concurrency cap in PR #71). Add new known gap: REST persistTree ignores extracted refs (follow-up to #53).
Closes #73
Summary
pnpm test:integrationruns*.integration.test.tsfiles in parallel by default. They share a single PostgreSQL instance and race on FK constraints + unique keys, producing non-deterministic local failures (paragraphs_parent_id_fkey,specs_section_source_unique).fileParallelism: falseon the integration project invitest.config.tsto serialize test file execution. Unit project untouched.docs/superpowers/specs/2026-05-18-issue-073-design.mdspecifiedpool: 'forks' + poolOptions: { forks: { singleFork: true } }. Vitest 4.1.5 (current dep) removedtest.poolOptions; applying the doc's diff verbatim triggers a runtime deprecation warning and is silently ignored — verified by running the failing test under that config first.fileParallelism: falseis the Vitest 4 replacement (setsmaxWorkers=1internally pervitest/dist/chunks/coverage.DM_a_rWm.js:223). Same intent, current API.Test plan
pnpm test:integration— 3 consecutive runs, all 14 files / 95 tests green, no FK / unique-key flakespnpm test(unit) — still parallel, 43 files / 435 tests in 1.09spnpm lint— greenpnpm build— greenSummary by CodeRabbit
Documentation
Chores