diff --git a/.changeset/spec-vitest-testtimeout.md b/.changeset/spec-vitest-testtimeout.md new file mode 100644 index 0000000000..ce2f55b2a2 --- /dev/null +++ b/.changeset/spec-vitest-testtimeout.md @@ -0,0 +1,38 @@ +--- +"@objectstack/spec": patch +--- + +fix(spec): give this package's vitest run a 60s `testTimeout` — stop evicting unrelated PRs from the merge queue (#4850) + +`packages/spec/vitest.config.ts` never set `testTimeout`, so every case in the +package ran under vitest's **5000ms** default. Twelve tests in `src/` load the +TypeScript compiler inside the case and type-resolve the whole export surface — +`ts.createProgram` + `getTypeChecker`, then unalias each symbol and chase +`originOf` — which is seconds of work by construction, not a hang: + +``` +api/rest-server · automation/state-machine · automation/sync-retirement · cloud/tenant +data/driver · integration/connector · kernel/package-dependency-dual-source +studio/action-location-retirement · system/environment-artifact · system/notification +ui/app · ui/view +``` + +Measured on an idle runner the slowest of these cases takes **3.4s** against a +5000ms budget — enough margin to stay green on a PR branch, and not enough on a +merge-queue runner building several PRs' batches at once. That is exactly the +observed signature: five failures in one night, all inside the queue, none on a +PR branch, each one evicting a PR that had nothing to do with `spec` (#4755, +#4788, #4823, #4822 twice). + +`testTimeout: 60_000` matches the value PR #4506 gave these same cases +case-by-case, but applied once at the config layer so all twelve are covered — +and so a thirteenth added later is covered on arrival instead of leaking through +the way the per-case list did. 60s is ~17x the slowest measured case, so it +absorbs queue contention without masking a genuine hang. + +This is a **stop-the-bleeding** change, not a fix for the underlying cost: 88% of +those twelve files' test time is TypeScript compilation, ~39s of it, repeated per +run. Hoisting the export-surface resolution into a build-time artifact is tracked +separately in #4796, which stays open. + +No runtime, schema or public API change — test configuration only. diff --git a/packages/spec/vitest.config.ts b/packages/spec/vitest.config.ts index b5ba99a3b8..272d56cad8 100644 --- a/packages/spec/vitest.config.ts +++ b/packages/spec/vitest.config.ts @@ -7,6 +7,12 @@ export default defineConfig({ globals: true, environment: 'node', include: ['src/**/*.test.ts', 'scripts/**/*.test.ts'], + // 12 tests in this package load the TypeScript compiler and type-resolve the + // whole export surface (ts.createProgram + getTypeChecker). That is seconds of + // work per case, and vitest's 5000ms default left no headroom on a loaded merge + // queue runner — see #4850. Set at the config layer so all 12 (and any future + // one) are covered, rather than per-case as PR #4506 did. Related: #4796. + testTimeout: 60_000, coverage: { provider: 'v8', reporter: ['text', 'json', 'html'],