Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/spec-compiler-pin-timeout.md
Original file line number Diff line number Diff line change
@@ -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 跟踪。
14 changes: 14 additions & 0 deletions packages/spec/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down