Repository navigation
Commit 8b23ee5
test(dogfood): build the commit revert cases' publish fixtures in hooks, so each case's clock times the revert it pins (#34323)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_
Fixes #34271
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:只改一个 dogfood 测试文件。两个用例在用例体内现场发布对象来造夹具,现把这些发布移到嵌套 describe 的
beforeAll 里,断言一字未改。
- 为什么改:合并队列里该文件的「可写包的编辑提交原位恢复」用例三次超时(5.0–5.1 秒,默认 5 秒上限),把三条 PR
踢出队列。测量证明是慢 runner 上的计时悬崖,不是产品变慢。
- 风险与回滚:只动测试,产品代码与已发布包零改动;回滚就是 revert 这一个提交。用例的 5 秒上限没有放宽。
-
先看:`packages/qa/dogfood/test/package-commit-revert-path-package.dogfood.test.ts`
末尾的嵌套 describe(编辑提交夹具),以及第四个用例外层的嵌套 describe(已卸载包夹具)。
- 两分钟验证:`pnpm --filter @objectstack/dogfood exec vitest run --project
isolated --reporter=verbose
test/package-commit-revert-path-package.dogfood.test.ts`,预期 12/12
通过,末尾用例约 0.7 秒(原约 2.6–3.0 秒)。
- 需要你做的:无,席位落地。
## What changes
`packages/qa/dogfood/test/package-commit-revert-path-package.dogfood.test.ts`
only (a private package; nothing publishes, hence `skip-changeset`).
- `[#29414] control: a writable package's edit commit restores its own
row in place`: its two object publishes (the create, then the edit that
records the edit commit) move into the `beforeAll` of a nested
`describe`, with a 60 s hook budget. The case now times the revert it
pins and the label read after it.
- `an uninstalled package's commit is refused 404 …`: the package create
and its object publish move the same way. The uninstall, both refusals
and every read stay in the case.
- Every assertion is unchanged, and so is the order the suite writes
state in: each nested suite runs at the position its case had. No
per-case timeout is raised, and nothing is skipped or quarantined.
## Diagnosis: (a) a load/timing cliff, not a product regression and not
a conflict between the roots
<details><summary>Failing queue builds: the reason line is a timeout, in
the same case each time</summary>
Every one fails in `Dogfood Regression Gate (3/3)` with `Error: Test
timed out in 5000ms.` at line 370, the last case of the file:
| queue build | edit-commit control | uninstalled case | B-rollback
control (1 publish) | file |
|---|---|---|---|---|
| 43795201091 (root) | **5098 ms ×** | 3845 ms | 1725 ms | 35.1 s |
| 43792843358 (independent) | **5013 ms ×** | 4020 ms | 1853 ms | 36.9 s
|
| 43797161496 (inherited) | **5068 ms ×** | 4251 ms | 2041 ms | 37.4 s |
None of the roots touches the file, and the cases with no publish in
them stay at 40–190 ms in the same runs.
</details>
<details><summary>Green history: the case's cost follows the runner's
speed, and its ratio to a one-publish control does not move</summary>
The edit-commit control on green runs (scheduled `main` and queue
builds, shard that ran the file):
- 11-04 to 11-13 (8 scheduled runs): 2261 to 3155 ms.
- 11-14 to 11-16 (12 runs): 2244 to 4493 ms. Fast runners on the newest
trees read 2244 ms (`7be32d39fa`) and 2488 ms (`9efb58f1ca`, a later
tree than the failing builds), the same as 11-06's 2350 ms.
- Its ratio to the one-publish `B rolls back` control stays 2.2 to 2.6
on every run read, so the product did not get slower on this path. What
changed is runner load: the file's total runs from 18 s to 37 s across
runners.
</details>
<details><summary>Local measurement (shared 4-core box, under the verify
lock; absolutes are shared-box seconds, ratios carry)</summary>
Per-call wall of the edit-commit control on `origin/main` (instrumented
copy, three runs):
- `publish-drafts` (create): 974 / 1221 / 1476 ms
- `publish-drafts` (edit): 1034 / 1152 / 1478 ms
- the revert under test: 526 / 582 / 700 ms
- all reads: 11 to 17 ms each
So about 80 % of the case's clock went to the two fixture publishes. The
uninstalled case is similar: the package create took 517 to 597 ms and
the object publish 1081 to 1236 ms, against 521 to 596 ms for the
uninstall.
| case | origin/main alone ×2 | this PR alone ×2 | loaded (4 workers,
both files plus 2 neighbours) |
|---|---|---|---|
| edit-commit control | 2611 / 3046 ms | 678 / 655 ms | 3750 → 761 ms |
| uninstalled case | 2226 / 2537 ms | 658 / 612 ms | 2567 → 651 ms |
| B-rollback control (untouched) | 1178 / 1195 ms | 1211 / 1286 ms |
1421 / 1446 ms |
At the failing builds' runner factor (about 1.7 to 1.9 times local
alone), the edit-commit control comes out at about 1.2 to 1.4 s against
its 5 s clock, which was 5.0 to 5.1 s before. The hook does the two
publishes: 2.0 to 3.0 s locally, so about 5 s at that factor, inside its
60 s budget. The file's top-level hook keeps its own 180 s.
</details>
## Tests
<details><summary>Ablation: the moved fixture still feeds a pin that
bites</summary>
The forbidden behaviour is the one that `[#29414]` closed: a revert
restoring a row other than the committing package's own row. It was put
back in the built `@objectstack/metadata-protocol` `dist/index.js`,
which is the file the dogfood isolated project resolves for that
package. That file is untracked build output, so no source file was
touched. The `restoreVersion` call's `packageId: commitPackageId,`
became `packageId: null`. On disk, the marker count went to 1 and the
anchor count went from 2 to 1.
- Run: `vitest run --project isolated -t 'restores its own row in
place'` (the top-level hook and the new nested hook both ran).
- Result, red:
```text
AssertionError: expected 'A edited 2' to be 'A edited 1' // Object.is equality
Tests 1 failed | 11 skipped (12)
```
- Restored from the saved copy. The sha256 equals the pre-mutation copy
(`829c9eb0…`), and the marker count is 0.
- Observation: under that mutation the case's status, `success` and
`action: 'restored'` pins still pass. The label read is the pin that
catches it, and it is kept as it was.
</details>
## Verification
<details><summary>Local gate subset</summary>
- `eslint --no-inline-config` on the file: exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on HEAD `e863d61b84` derived 53 commands,
and each one was run with its exit code captured before any pipe.
Results are in the report on the card.
- `check:dual-build-cjs-loads` answers PREREQUISITE NOT MET (exit 3,
unbuilt packages outside this diff), so it is NOT MEASURED locally and
left to CI.
- `test:repo`, the full dogfood battery and every CI family are left to
CI. Their check-runs are cited in the report.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>1 parent 66f6638 commit 8b23ee5
1 file changed
Lines changed: 56 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | | - | |
159 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
160 | 194 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | 195 | | |
185 | 196 | | |
186 | 197 | | |
| |||
367 | 378 | | |
368 | 379 | | |
369 | 380 | | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
379 | 400 | | |
380 | | - | |
381 | 401 | | |
382 | 402 | | |
0 commit comments