Repository navigation
Commit 59d9815
test(scenarios): give the external-driver crm run a measured 30s budget and a lighter stand-in (#31284)
Fixes #31281
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`@objectstack/scenarios` 的外部驱动端到端用例改为显式 30
秒超时,并在用例旁写明实测数据;测试用的替身命令不再加载 `node:crypto`,key 指纹从 SHA-256 改为
FNV-1a。只改测试,不动 `src/`。
- 为什么改:这个用例每个回合启动一次替身进程,连续 45 次。本地 2.2–2.5 秒,负载高的 Test Core 分片上被 vitest
默认 5 秒超时在 5042ms 截断,把 main 合并队列里别人的 PR 弹出去(#31247 两次)。
- 风险与回滚:只改测试文件与其替身,不发布(skip-changeset)。回滚即 revert。
- 先看:`packages/qa/scenarios/test/runner/external-driver.test.ts`
末尾的超时和注释。
- 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run
test/runner/external-driver.test.ts`,预期 8/8 通过。
- 需要你做的:无,席位落地。
## What changes
- `test/runner/external-driver.test.ts`, the case "a full crm run
through the command…": an explicit 30 000 ms budget instead of vitest's
5 s default, with the measurement written beside it.
- `test/runner/fixtures/fake-external-driver.mjs`: the stand-in no
longer imports `node:crypto`. It fingerprints the key it read with
FNV-1a (32-bit hex) as `keyPrint`. The test computes the same function
and now also asserts that this run's keys have distinct fingerprints, so
the membership check cannot pass by collision.
**Root cause.** The case starts the stand-in once per turn, one after
another: 45 starts (3 author calls; 42 asks over scratch run, scratch
iterate-run and template iterate-run, measured from the call log). Each
start costs about 50 ms locally, and node's own start-up is about 35 ms
of that. On a Test Core shard one start took 212 ms (the `info` case in
the failing job), and this case was cut off at 5042 ms. Both modes are
kept: each mode boots its own app and issues its own keys.
## Tests
- Per-start cost, 30 starts each, on this container: bare node about 35
ms; with `node:fs`/`node:path` about 39 ms; with `node:crypto` added 41
to 45 ms. That is the stand-in's start-up before and after.
- The case, 5 local runs each: before 2374 to 2520 ms; after 2186 to
2425 ms.
- `pnpm --filter @objectstack/scenarios exec vitest run
test/runner/external-driver.test.ts`: Test Files 1 passed (1), Tests 8
passed (8).
## Acceptance notes
- CI evidence: merge-queue run 42414930416, job Test Core (2/8). The
case failed with `Test timed out in 5000ms` (5042 ms). The coordinator
reported the same on #31256 and #31277, and #31247 was dequeued twice
(runs 42414930416 and 42417438743).
- In the same job, `test/runner/codex-driver.test.ts` took 7657 ms for
12 cases. No case failed, and per-case times were not printed for it.
Not touched here (outside the claim's surface).
## Verification
On `31dffb8d`: `pnpm --filter @objectstack/scenarios typecheck` exit 0;
scoped lint `node --stack-size=4000 node_modules/eslint/bin/eslint.js
packages/qa/scenarios/test/runner --no-inline-config` exit 0; `node
scripts/check-nul-bytes.mjs` exit 0.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5mx64pxVGCbKfuxEwi
Co-authored-by: Claude <noreply@anthropic.com>1 parent ea053b4 commit 59d9815
2 files changed
Lines changed: 33 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | | - | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
188 | | - | |
| 192 | + | |
| 193 | + | |
189 | 194 | | |
190 | 195 | | |
191 | | - | |
| 196 | + | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
| |||
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
225 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
226 | 238 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | | - | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
| |||
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
66 | | - | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
0 commit comments