Repository navigation
chore(test): unit 项目统一设置 hookTimeout 30s,收敛 tmux 夹具的单文件补丁 - #2402
Merged
Merged
Conversation
#2400 给 tmux-pipe-exit-code 这一个文件的 beforeEach/afterEach 单设了 30s hook 超时来止血。根因其实在 vitest 配置:unit project 设了 testTimeout 30s 却没设 hookTimeout,hook 退回 vitest 默认 10s,而多个 unit 文件都在 hook 里起/杀真实私有 tmux server(tmux-pipe-backend-retire 11 处、 orphan-tmux-reaper 16 处、session-env-backends 3 处、 kill-worker-orphaned-backend 1 处),同样可能在调度饥饿的 shard 上撞 10s。 - unit project 补 hookTimeout: 30_000,与 testTimeout 对齐,覆盖全部 真 tmux server 的 setup/teardown;e2e 本来就是 360s。 - 移除 #2400 在 tmux-pipe-exit-code 里的单文件 REAL_TMUX_HOOK_TIMEOUT_MS 补丁(现由全局配置承载,单一来源)。 不掩盖真坏:测试仍断言具体结果、并保留各自更短的内部死线。纯测试配置 变更,无生产行为影响。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 27, 2026 02:09
Owner
Author
复审 368481f:可合 ✅这正是我在 #2400 里提的那条 follow-up,落法比我建议的还干净一点(顺手把单文件补丁撤了,改单一来源)。我做了独立核验,其中一条是决定性的。 配置位置正确
决定性验证:配置确实生效(不是"写了但没用")我写了一条临时探针——hook 里 sleep 12s、测试体瞬时完成(正好落在旧的 10s 与新的 30s 之间),然后对照:
这比"读 config 文件确认有一行"强得多:它证明这一行真的把 unit hook 的预算从 10s 抬到了 30s。探针已删,工作区干净。 #2400 的严格断言没有丢我逐行看了被删的部分:只移除了 收紧风险我查了(这是本 PR 唯一可能的坑)新配置是 30s,比根级的 360s 小。如果有 unit hook 依赖根级的 360s 而没显式传参,就会被压到 30s —— 那是收紧,可能引入新红。查下来:
所以这个 tightening 没有实际受害者。 补充验证
一句话配置层收敛是对的方向,验证也够硬。可合。 (唯一提醒还是那条:本地压不出 CI 那种几万测试同机的饥饿,所以"这个 PR 治好了未来所有同类超时"这类话别写进 PR 描述——写"配置一致性修复 + 已有一次真实 10s 失败"就够,我这边口径一致。你没写,只是提醒。) |
This was referenced Oct 27, 2026
|
🚀 Released in v3.54.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#2400 给
test/tmux-pipe-exit-code.test.ts单个文件的beforeEach/afterEach设了 30s hook 超素来止血 master CI 的Hook timed out in 10000ms。根因在 vitest 配置:
unitproject 设了testTimeout: 30_000,却没设hookTimeout,hook 退回 vitest 默认 10s,而根级与 e2e project 都显式设了 360s——唯独 unit 漏了。多个 unit 文件都在 hook 里起/杀真实私有 tmux server,同样可能在调度饥饿的 shard 上撞 10s(由 #2400 复审时排查列出):tmux-pipe-backend-retire(new-session ×11)orphan-tmux-reaper(×16)session-env-backends(×3)kill-worker-orphaned-backend(×1)这些文件目前没压出红,但都处在同一个 10s 默认缺口下。
改动
vitest.config.ts:unitproject 补hookTimeout: 30_000,与testTimeout对齐,覆盖全部真 tmux server 的 setup/teardown。tmux-pipe-exit-code.test.ts里的单文件REAL_TMUX_HOOK_TIMEOUT_MS补丁,改由全局配置承载(单一来源)。不掩盖真坏
hook 给的只是与测试体一致的时间预算;测试仍断言具体结果,且夹具保留各自更短的内部死线(如尸体 setup 必须读到具体
pane_dead_status),真坏照样快速失败而非挂到 30s。纯测试配置变更,无生产行为影响。本地 tsc 0、
tmux-pipe-exit-code21/21(hook 现走全局 30s)。