Repository navigation
Commit 6d833b5
test(plugin-security): split the three-officer posture cases one per auditor variant (#35452)
repo:objectstack#5 · os-bill · session_01Utp6Ca1jJvsA1dHsPwMiQb
Fixes #35436
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:用户无感;只拆分了一组权限测试,断言一条不少、含义不变。
- 为什么做:这组测试在 CI 负载高时会撞到单条测试 5 秒的默认上限,跟改动无关却让别的修复一直是红的。
- 出错会怎样:只动测试,不动产品代码;撤回即可。
- 要你做什么:无,席位落地。
## 席位核对
### What changes
-
`packages/plugins/plugin-security/src/org-admin-assignment-boundary.posture.test.ts`,
the three-officer describe. The 12 cases (2 postures × 6 callers) each
looped over the 3 auditor variants. They become 36 cases (2 postures × 6
callers × 3 variants). Each case does one variant's grant insert,
removal by id, bulk removal and position holding, then removes every row
it wrote, with the same `finally` as before. Every `expect` line is
unchanged. The only code that moved is the `for (const variant ...)`
loop, lifted from inside the `it` to around it.
- The file's `test-budget:` header line keeps its number (20) and its
class. Its REASON now says 128 cases, thirty-six of them three-officer
cases, and why they were split.
- No global `testTimeout` raise, no per-case timeout, no skip, nothing
deleted.
- Two-minute check: run this one file. You should see 128 green, with
each three-officer case under 0.25 s locally.
### Tests
These were run locally on one shared 4-core box under
`os-verify-lock.sh`. Absolute seconds are shared-box readings; the
ratios are the claim. Head `3de047739a`:
| | before (BASE `a9b36efffa`) | after (`3de047739a`) |
|---|---|---|
| file | 104 passed, tests phase 20.94 s | 128 passed, tests phase 22.27
s |
| three-officer cases | 12, 265 to 611 ms each | 36, 71 to 223 ms each |
The slowest three-officer case drops from 611 ms to 223 ms (×0.36).
Applied to the worst CI reading on the card (5534 ms on #35386's loaded
shard), that is about 2.0 s, which leaves 2.5× headroom under the 5 s
default.
<details><summary>vitest verdict lines</summary>
```text
before: Test Files 1 passed (1) Tests 104 passed (104) Duration 30.67s (tests 20.94s)
after: Test Files 1 passed (1) Tests 128 passed (128) Duration 32.81s (tests 22.27s)
os-verify-lock: VERDICT command-exit 0 (both runs)
typecheck (@objectstack/plugin-security, tsc + scripts + check:test-typecheck): VERDICT command-exit 0
```
</details>
### Acceptance notes
- Mechanism reading: the repo's declared-budget shape is the one-line
file header `test-budget: SECONDS — CLASS: REASON`, which
`scripts/measure-test-shard-timings.mjs` (`readTestBudget`) reads. It
governs the timings report's 10 s per-FILE wall line, not vitest's
per-case timeout, and this file already carries one (20 s). It cannot
hold a single case under 5 s, so splitting is the route.
- The card reports the whole file at 75 to 179 s on loaded CI shards,
against its declared 20 s budget. That was not re-measured here; it is
left for the timings refresh lane.
- Three other cases in the same file (the per-posture hidden-column
cases) run about 0.56 to 0.64 s locally, the same order as the old
three-officer cases. None is reported timing out, and they are
untouched.
### Verification
- Gates: `node scripts/pm/dispatch-gates.mjs --commands` derived 54
commands for this diff. 52 exit 0. 2 exited 3, PREREQUISITE NOT MET
(`check:i18n` and `check:dual-build-cjs-loads` need a full workspace
build); they are recorded NOT MEASURED and left to CI. `--ran`
reconciliation: 54 accounted, 52 run, 2 NOT-MEASURED, 0 UNRUN.
- `skip-changeset`: this is a test-only diff, so nothing is published.
- No ablation: no tested behaviour changed. The assertions are
byte-identical; only their grouping into cases moved.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6Ca1jJvsA1dHsPwMiQb)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 20badae commit 6d833b5
1 file changed
Lines changed: 19 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
1149 | 1149 | | |
1150 | 1150 | | |
1151 | 1151 | | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1152 | 1155 | | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1162 | 1165 | | |
1163 | 1166 | | |
1164 | 1167 | | |
| |||
1206 | 1209 | | |
1207 | 1210 | | |
1208 | 1211 | | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1209 | 1216 | | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
| 1217 | + | |
| 1218 | + | |
1216 | 1219 | | |
1217 | 1220 | | |
1218 | 1221 | | |
| |||
0 commit comments