Repository navigation
test(worker-budget): 拆分 7 组串行冷启动参数校验为独立用例,消除 CI 30s 超时 flake - #3757
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 23, 2026 22:47
deepcoldy
commented
Nov 24, 2026
deepcoldy
left a comment
Owner
Author
There was a problem hiding this comment.
复核结论:可合,零阻断、零 nit
审查目标为 PR head 05df5135bfd73c243fb8fcb18c2fa39926572962。本地 rebase 后的等价提交与远端 head 中 test/worker-budget-cli.test.ts 的 blob 均为 cf050d5253ba10d5f9756c045913018a276cb79e,审查内容一致。
- 改动边界:仅修改
test/worker-budget-cli.test.ts:63-77,无生产代码变更。7 组参数向量及退出码 1 的断言均保留;it.each让每个场景只承担一次 CLI 冷启动,不再把 7 次启动叠加在同一个 30 秒用例计时器内。 - 新增断言有效:
test/worker-budget-cli.test.ts:76的“拒绝时不创建 config.json”与实际代码路径一致。set 参数先在src/cli.ts:8943完成结构校验,数值/布尔校验也在src/cli.ts:8952-8959完成,直到src/cli.ts:8960才进入写配置;status/unset 的多余参数分别在src/cli.ts:8898、src/cli.ts:8967直接拒绝。 - 用例隔离:
test/worker-budget-cli.test.ts:28-34为每个参数化用例创建并清理独立临时 HOME,新增文件不存在断言不受相邻用例影响。 - 影响面:测试文件内的组织方式变化不影响 daemon、CLI 运行时、其他适配器或各会话后端。
实际验证:
bun run test test/worker-budget-cli.test.ts
→ Test Files 1 passed;Tests 9 passed(22.62s)
bun test test/worker-budget-cli.test.ts
→ 9 pass / 0 fail / 27 expect() calls(7.06s)
git diff --check 8d487f2c9f..HEAD
→ 通过
远端 head 的 CI run 45283064299 为 run_attempt=1、整体 success;19 个 check 均已完成且没有失败项。
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 67ae83e…045ca7551(2 个提交),同批合入的还有 #3740,失败不一定由本 PR 引起。
|
|
🚀 Released in v3.59.31 |
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.
改了什么 & 为什么
Fixes #3756
test/worker-budget-cli.test.ts的rejects unknown, duplicate, missing-value, and trailing unset arguments用例在单个it()块(Vitest 默认 30s 超时)内通过for循环串行起 7 次完整node --import tsx src/cli.ts冷启动。在 CI 2 核 runner 上单次tsx启动约 2.8~3.3s,7 次在 master 基线就已占~20s(run45264909425实测19932ms),一旦 runner 并发负载波动(单次涨到~4.5s)即触发Test timed out in 30000ms(PR #3750 job137890167737实测33099ms)。本 PR 将这 7 组彼此独立的参数拒绝场景拆为独立的
it.each用例,每个用例只承接 1 次 CLI 启动(与 30s 上限留出约 10 倍余量),并补充验证拒绝退出时未写入config.json。影响范围评估
test/worker-budget-cli.test.ts,不改动任何生产代码、配置或运行时行为。spawnSyncTsScript(CLI_PATH, ...)子进程端到端验证。it.each使用固定 2 元参数表,兼容 Vitest 与bun test双腿。实际测试验证