From fd968dfb06b941ce8fa7435941bf374f319db3e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 3 Aug 2026 10:42:26 +0000 Subject: [PATCH] =?UTF-8?q?test(spec):=20=E7=BB=99=2013=20=E4=B8=AA=20comp?= =?UTF-8?q?iler-API=20=E5=AF=BC=E5=87=BA=E9=9D=A2=20pin=20=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E7=AC=A6=E5=90=88=E7=9C=9F=E5=AE=9E=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E9=87=8F=E7=9A=84=E8=B6=85=E6=97=B6=20(#4796)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这一族 pin 都要对全部 16 个公共入口建一次 ts.createProgram,天然秒级。 实测:空闲机器 ~2-3s;CI 分片上 turbo 把 spec#build 与 #test 并发跑在 同 4 vCPU 上,争抢推到 5.0-5.6s —— 恰好骑在 vitest 默认 5s 线上。 一个上午三条 pin 超时(state-machine / sync-retirement / tenant), 每次都把不相干的 PR 踢出合并队列,并曾被误诊为构建 OOM(#4845)。 30s 约为实测争抢峰值 5 倍;真挂死仍由 10 分钟 stall guard 兜底。 长期修法(导出面做成构建期产物、pin 只比对)在 #4796 跟踪。 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_0176qgxgCXTJCUv4YFLtusP9 --- .changeset/spec-compiler-pin-timeout.md | 18 ++++++++++++++++++ packages/spec/vitest.config.ts | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .changeset/spec-compiler-pin-timeout.md diff --git a/.changeset/spec-compiler-pin-timeout.md b/.changeset/spec-compiler-pin-timeout.md new file mode 100644 index 0000000000..49719b718d --- /dev/null +++ b/.changeset/spec-compiler-pin-timeout.md @@ -0,0 +1,18 @@ +--- +--- + +test(spec): 给 13 个 compiler-API 导出面 pin 一个符合真实工作量的超时(#4796) + +发布面零变化 —— 只改 `packages/spec/vitest.config.ts` 的 `testTimeout`,不影响任何 +产物内容,故为空 changeset。 + +这一族 pin(每个退役/双源 PR 各留一个,现有 13 个)都要对全部 16 个公共入口建一次 +`ts.createProgram`,天然是秒级工作。实测:空闲机器 ~2-3s;CI 分片上 turbo 把 +`@objectstack/spec#build` 与 `#test` 并发跑在同 4 vCPU 上,争抢把它推到 +5.0-5.6s —— 恰好骑在 vitest 默认 5s 超时线上。一个上午三条 pin 超时 +(state-machine / sync-retirement / tenant),每次都把一个不相干的 PR 踢出合并队列, +并被误诊为构建 OOM(#4845 记录了那次误诊与更正)。 + +30s 约为实测争抢峰值的 5 倍;真挂死仍由 CI 的 10 分钟 stall guard 兜底 —— 这个 +数字只阻止「健康但受争抢」的运行被读成失败。长期修法(把导出面做成构建期产物、 +pin 只比对不现场解析)在 #4796 跟踪。 diff --git a/packages/spec/vitest.config.ts b/packages/spec/vitest.config.ts index b5ba99a3b8..6b92e218fb 100644 --- a/packages/spec/vitest.config.ts +++ b/packages/spec/vitest.config.ts @@ -7,6 +7,20 @@ export default defineConfig({ globals: true, environment: 'node', include: ['src/**/*.test.ts', 'scripts/**/*.test.ts'], + // [#4796] This package carries 13 export-surface pin tests (one per + // retirement/dual-source PR) that each build a ts.createProgram over all + // 16 public entry points — inherently seconds-scale work. Measured cost: + // ~2-3s on an idle machine, 5.0-5.6s on a CI shard where turbo runs + // @objectstack/spec#build CONCURRENTLY on the same 4 vCPUs. vitest's 5s + // default sat exactly on that line: three pins timed out in one morning + // (state-machine / sync-retirement / tenant), each ejecting an unrelated + // PR from the merge queue. 30s is ~5x the measured contended worst case; + // genuine hangs are still caught by CI's 10-minute stall guard + // (run-with-stall-guard.mjs), which is the real hang detector — this + // number only stops healthy-but-contended runs from reading as failures. + // The durable fix — precompute the export surface as a build artifact and + // have the pins compare instead of re-resolving — is tracked in #4796. + testTimeout: 30_000, coverage: { provider: 'v8', reporter: ['text', 'json', 'html'],