perf(check-affected): keep the related run out of the unit projects when the unit suite runs
Summary
Since #4025, a production source change runs unit (check:unit), which runs every unit-core and fuzz-worker test. The vitest related run still searched every project, so it ran those tests a second time.
When a narrowed plan also executes unit, the related command now adds --project=!unit-core --project=!fuzz-worker. Fail-open plans and test-only plans (no unit) keep the old related command. scripts/lib/vitest-projects.ts declares the list.
Drift guard: scripts/lib/vitest-projects.test.ts (in check:affected:test) fails if test:unit runs other projects or adds a filter, if check:unit stops calling test:unit, or if a name is not a project in vitest.config.ts.
7 files. No scope expansion. No linked issue.
Validation
Tested SHA: 92b98727cc.
- Related run for
packages/kernel/src/errors.ts, before: 1,718 files (1,555 unit-core, 1 fuzz-worker), 305 s wall. After: 162 files, 78 s wall. Host load averages were 23 to 33 for both runs. - Vitest 5.0.4 honours the exclusion: for
src/cli.ts, the related run drops from 39 files to the 1 provider-integration file. pnpm check:affected:test: 90/90 pass. Planted reds, each reverted, each failed a test: no exclusion; exclusion always on; exclusion on for fail-open plans;fuzz-workerremoved fromtest:unit; a path filter added totest:unit; avitest.config.tsproject renamed.pnpm check:affected --run --head 92b98727cc: passed,exactCommit: true, 41 local checks (fail-open, becausescripts/changed).
CI owns coverage and integration at the PR head.
š¤ Generated with Claude Code