Skip to content

test(dashboard-ipc): 真实 hook 用例的截止时间与用例预算对齐 - #2102

Merged
deepcoldy merged 2 commits into
masterfrom
test/nonce-store-hook-deadline
Oct 21, 2026
Merged

deepcoldy merged 2 commits into
masterfrom
test/nonce-store-hook-deadline

Conversation

@deepcoldy

Copy link
Copy Markdown
Owner

改了什么

test/dashboard-ipc.test.ts 里有两条 native-subagent-runtime 真实 hook 用例,会从 TypeScript 源码冷启动整个 src/cli.ts,但只给了 6 秒的内层截止时间(超时就 SIGKILL 子进程并报 hook timed out),而用例本身的预算是 15 秒。

CI 上一次通过的 master 运行里,第一条用例冷启动就用了 5765ms(同文件的第二条用上了转译缓存,只要 1866ms),离 6 秒只剩 0.2 秒。runner 稍有负载就会超时:#2059、#2065、#2072、#2075 的 CI 都失败在 6.03–6.07 秒。

  • 两条用例改用同一个等待函数。内层截止时间与用例预算挂钩:预算 30 秒,截止时间取预算减 5 秒,即 25 秒。
  • 超时报错里带上子进程 stderr,方便区分「冷启动慢」和「hook 卡住」。
  • 断言一行没动。

Closes #2080

影响面

只改一个测试文件,不影响任何运行行为。

测试验证

  • npx vitest run --project unit test/dashboard-ipc.test.ts:341 条用例,339 通过、2 跳过(跳过的是原本就要手动开启的浏览器用例)。
  • 把截止时间临时改成 1ms 再跑:报错为 hook did not exit within 1ms; stderr: …,确认超时路径和报错内容符合预期;测完已改回。

🤖 Generated with Claude Code

两条 native-subagent-runtime 真实 hook 用例从 TypeScript 源码冷启动整个 src/cli.ts,却只给了 6 秒内层截止时间。CI 上一次通过的运行里,第一条冷启动就用了 5.8 秒,几乎没有余量,runner 稍有负载就超时(#2059、#2065、#2072、#2075 上都在 6.03–6.07 秒失败)。

- 两条用例改用同一个等待函数:内层截止时间取用例预算减 5 秒(25 秒 / 30 秒),不再是拍脑袋的短值。
- 超时报错带上子进程 stderr,便于区分「冷启动慢」与「hook 卡住」。
- 断言不变。

Closes #2080

Co-Authored-By: Claude Opus 5.5 <[email protected]>
评审建议:用例预算从「截止时间 + 5 秒」改为「截止时间 + 15 秒」。其中一条用例在启动子进程前要先打 64 次 IPC 请求填满 proof 配额,负载下 setup 变慢时,应让带 stderr 的 hook 截止报错先触发,而不是被 vitest 的泛化用例超时抢先。截止时间仍为 25 秒。

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🚀 Released in v3.49.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: dashboard-ipc 的 nonce-store 满载用例 6 秒内层截止时间在 CI 高负载下反复超时

1 participant