Skip to content

Commit 96c800a

Browse files
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

File tree

‎ui/scripts/__tests__/check-hand-rolled-comment-mask.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ const JSDOC_PAIR = `const bare = body.replace(${SLASH}${OPEN}${STAR}${ANY}${CLOS
6464
/** The exact projection `LineItemsPanel.parentIdNoCast-9333` carried before this card. */
6565
const HYBRID_PAIR = `const out = src.replace(${SLASH}${OPEN}${ANY}${CLOSE}${SLASH}g, (m) => m).replace(${SLASH}${LINE}[^${B}n]*${SLASH}g, '');`;
6666

67+
// The whole-tree spawn measured 15.1 s and 19.1 s on queue runners, over the 15 s default (objectstack#34523).
68+
const WHOLE_TREE_CASE_MS = 60_000;
69+
// Below the case budget, so a hung sweep fails the assertion as `status: null`, not on vitest's timer.
70+
const SPAWN_TIMEOUT_MS = 50_000;
71+
6772
function run(args: string[]): { status: number | null; stdout: string; stderr: string } {
68-
const r = spawnSync(process.execPath, [SCRIPT, ...args], { encoding: 'utf8', timeout: 300_000 });
73+
const r = spawnSync(process.execPath, [SCRIPT, ...args], { encoding: 'utf8', timeout: SPAWN_TIMEOUT_MS });
6974
return { status: r.status, stdout: r.stdout ?? '', stderr: r.stderr ?? '' };
7075
}
7176

@@ -240,7 +245,7 @@ describe('this tree, today', () => {
240245

241246
it('exits 0 as a process, which is what CI reads', () => {
242247
expect(run([]).status).toBe(0);
243-
});
248+
}, WHOLE_TREE_CASE_MS);
244249
});
245250

246251
describe('wiring -- a gate nobody runs is indistinguishable from a gate that passes', () => {

0 commit comments

Comments
 (0)