Repository navigation
Commit 96c800a
test(ui): give the whole-tree comment-mask process case a measured budget (#34572)
Fixes #34523
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`check-hand-rolled-comment-mask` 测试里「整棵树跑一遍、进程退出码为 0」这一条用例,给了自己的
60 秒时限;它启动的子进程时限从 300 秒降到 50 秒。只改这一个测试文件。
- 为什么改:这条用例扫描整个仓库,CI 上实测 15.1 秒和 19.1 秒,超过 UI 测试默认的 15 秒,两次把无关的
PR(#34447、#34429)踢出合并队列。
- 风险与回滚:只动测试,不动产品和发布包;不跳过、不隔离、不改全局时限。回滚即 revert 这一个 commit。
- 先看:`ui/scripts/__tests__/check-hand-rolled-comment-mask.test.ts` 第
67–74 行(两个常量)和该用例末尾的 `}, WHOLE_TREE_CASE_MS);`。
- 两分钟验证:`pnpm --dir ui exec vitest run --project unit
scripts/__tests__/check-hand-rolled-comment-mask.test.ts`,预期 22 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
`ui/scripts/__tests__/check-hand-rolled-comment-mask.test.ts`,
test-only:
- The "this tree, today › exits 0 as a process, which is what CI reads"
case spawns `check-hand-rolled-comment-mask.mjs` over the live tree and
had no per-case budget, so `ui/vitest.config.mts` `testTimeout: 15000`
applied. It now carries `WHOLE_TREE_CASE_MS = 60_000`, matching how
sibling gate tests in `ui/scripts/__tests__/` budget their spawns (`},
60_000)` / `}, 120_000)`).
- The spawn's own `timeout` drops from `300_000` to `SPAWN_TIMEOUT_MS =
50_000`, below the case budget, so a hung sweep fails the assertion as
`status: null` rather than on vitest's timer.
- Number chosen from the measurement: 19.1 s worst seen on a queue
runner, about 3x headroom for a loaded runner.
What the case proves is unchanged: it still spawns the real checker over
the real tree and reads the process exit as a number. No skip, no
quarantine, no retry, no global `testTimeout` change, no fixture swap.
Other whole-tree work in the file: `sweep({ root: REPO_ROOT })` at the
`describe` level runs at collection time, not inside a timed case. The
only other `run(...)` call is the usage-error case
(`run(['--all-of-them'])`), which exits on argument parsing (143 ms in
the red run) and does not sweep the tree.
## Tests
Diagnosis, from the red queue run 43980731814, job Test UI (3/16), id
133698990223:
```text
FAIL unit scripts/__tests__/check-hand-rolled-comment-mask.test.ts > this tree, today > exits 0 as a process, which is what CI reads
Error: Test timed out in 15000ms.
❯ scripts/__tests__/check-hand-rolled-comment-mask.test.ts:241:3
```
The same log reads the case at 19146 ms, the self-test line `OK
check-hand-rolled-comment-mask self-test: 13 cases pass`, and the 21
other cases in the file green. The reason is a timeout, not an assertion
on `status`.
Measured durations of the case:
| Where | Head | Case duration |
| --- | --- | --- |
| Queue run 43951019700 (PR #34447), Test UI 3/16 | queue head | 15.1 s,
timed out (triage reading) |
| Queue run 43980731814 (PR #34429), Test UI 3/16 | queue head | 19146
ms, timed out |
| Local, shared container, no budget | origin/main d4c0c12 | 6472 ms,
green |
The post-fix and ablation (budget removed) local readings on this branch
are in the os-dev-report comment on #34523; the local box is not loaded
like a queue runner, so a green ablation there is expected and is
reported as a duration, not as a verdict.
## Acceptance notes
- `ui/AGENTS.md` 测试纪律 forbids raising timeouts to hide a race. This case
is not a race on module loading: its cost is the real work of sweeping
the whole tree in a child process, measured above, and the budget is per
case, not global. Triage 6934114979 chose this route.
- The file's whole-file wall in the red run was 19942 ms, above the 10 s
file line `scripts/measure-test-shard-timings.mjs` reports on
(report-only). No `test-budget:` header was added here; that is outside
this card's file surface.
## Verification
Gate subset derived by `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` at this branch's head; the
per-command exits are in the os-dev-report comment on #34523. CI runs
the full set.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRH4UCX1tvddXMS7cq)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent b3863b7 commit 96c800a
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
67 | 72 | | |
68 | | - | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
240 | 245 | | |
241 | 246 | | |
242 | 247 | | |
243 | | - | |
| 248 | + | |
244 | 249 | | |
245 | 250 | | |
246 | 251 | | |
| |||
0 commit comments