perf(test): cap vitest worker fan-out to keep dashboard responsive

On high-core dev machines (e.g. 28-core M-series), per-package vitest
defaulted to cpus().length - 1 workers (27), and `pnpm test` ran 4
workspace packages concurrently — easily 100+ vitest threads per sweep.
When the dashboard had agents running tests, 2+ concurrent sweeps would
saturate CPU and the UI became sluggish.

- Cap defaultMaxWorkers to min(6, cpus()-1) in cli/dashboard/desktop/
  mobile/plugin-sdk vitest configs (engine and core were already capped)
- Lower root `pnpm test` workspace-concurrency 4 → 2
- VITEST_MAX_WORKERS override still respected for explicit fast runs

Worst-case fan-out drops from ~108 workers to ~12 per `pnpm test`.
CI runners with fewer cores are unaffected (cap doesn't bind).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-02 11:30:02 -07:00
parent c6fcebc14c
commit 50238ae7eb
7 changed files with 20 additions and 8 deletions

View File

@@ -24,7 +24,7 @@
"verify:workspace": "pnpm lint && pnpm test && pnpm build",
"build:exe": "pnpm build && pnpm --filter @runfusion/fusion build:exe",
"build:exe:all": "pnpm build && pnpm --filter @runfusion/fusion build:exe:all",
"test": "pnpm sync:fusion-skill:check && pnpm -r --workspace-concurrency=4 test",
"test": "pnpm sync:fusion-skill:check && pnpm -r --workspace-concurrency=2 test",
"test:serial": "pnpm -r --workspace-concurrency=1 test",
"test:fast": "pnpm -r --workspace-concurrency=4 test",
"test:build": "pnpm --filter @fusion/dashboard test:build",