FORGE-68: run web unit test files in parallel #682

Merged
gmackie merged 1 commit from FORGE-68-web-vitest-parallel into main 2026-10-11 22:18:27 +00:00
Owner

Issue: https://tasks.gmac.io/gmacko/issue/FORGE-68 · follow-up to #680

Why

After #680, unit-web is the longest CI job (342s). 256s of that is one vitest run in apps/web, which had fileParallelism: false: 245 files in a single worker. That setting came in with an unrelated feature commit (414ede6f, April) with no stated reason.

Change

apps/web/vitest.config.ts: fileParallelism: true, maxWorkers: 3. The pin matters because vitest sizes its pool from the host's cores inside a container rather than the job's --cpus cap, and hetzner-worker gives a job 2 CPUs and 3 GB.

Evidence (local, same machine)

Mode Duration Result
sequential (current) 93.5s 245 files / 1680 tests pass
4 workers 28.5s pass
3 workers ×3 runs 35.4s, 34.3s, 35.3s pass every time

Peak RSS of a worker ~480 MB. tsc --noEmit and oxlint are clean.

Risk

Parallel files can expose shared state (temp paths, process.env). Three consecutive parallel runs were green. If CI shows order-dependent failures, revert this one line; nothing else depends on it. Expected CI effect (estimate): unit-web about 342s → ~150s, making checks (~232s) the critical path.

🤖 Generated with Claude Code

Issue: https://tasks.gmac.io/gmacko/issue/FORGE-68 · follow-up to #680 ## Why After #680, `unit-web` is the longest CI job (342s). 256s of that is one `vitest run` in `apps/web`, which had `fileParallelism: false`: 245 files in a single worker. That setting came in with an unrelated feature commit (414ede6f, April) with no stated reason. ## Change `apps/web/vitest.config.ts`: `fileParallelism: true`, `maxWorkers: 3`. The pin matters because vitest sizes its pool from the host's cores inside a container rather than the job's `--cpus` cap, and hetzner-worker gives a job 2 CPUs and 3 GB. ## Evidence (local, same machine) | Mode | Duration | Result | |---|---|---| | sequential (current) | 93.5s | 245 files / 1680 tests pass | | 4 workers | 28.5s | pass | | 3 workers ×3 runs | 35.4s, 34.3s, 35.3s | pass every time | Peak RSS of a worker ~480 MB. `tsc --noEmit` and oxlint are clean. ## Risk Parallel files can expose shared state (temp paths, `process.env`). Three consecutive parallel runs were green. If CI shows order-dependent failures, revert this one line; nothing else depends on it. Expected CI effect (estimate): `unit-web` about 342s → ~150s, making `checks` (~232s) the critical path. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perf(web): run web unit test files in parallel (FORGE-68)
All checks were successful
CI / gitleaks (pull_request) Successful in 11s
CI / storybook (pull_request) Successful in 2m9s
CI / unit-api (pull_request) Successful in 2m17s
CI / web-build (pull_request) Successful in 3m39s
CI / checks (pull_request) Successful in 3m46s
CI / go (pull_request) Successful in 1m20s
CI / database (pull_request) Successful in 3m16s
CI / unit-web (pull_request) Successful in 3m43s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 12s
2087a878c9
apps/web's vitest config had fileParallelism: false, so 245 files ran one
at a time in a single worker. That took 256s in CI, the longest job in
the parallel ci split. With 3 workers the suite passed 3 of 3 local runs
in ~35s, against 93s sequentially on the same machine.

maxWorkers is pinned at 3. In a CI container vitest sizes its pool from
the host's cores rather than the job's --cpus cap, and the smallest
runner gives a job 2 CPUs and 3 GB.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

Preview environment is live: https://pr-682-forgegraph.forgegraf.com

Deployed 2087a878 with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.

Preview environment is live: https://pr-682-forgegraph.forgegraf.com Deployed `2087a878` with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.
Author
Owner

Preview environment is live: https://pr-682-forgegraph.forgegraf.com

Deployed 2087a878 with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.

Preview environment is live: https://pr-682-forgegraph.forgegraf.com Deployed `2087a878` with the beta stage's environment. It redeploys on every push and is destroyed when this PR closes.
Sign in to join this conversation.
No description provided.