Repository navigation
Commit 2381085
fix(test-shards): judge pin 3c's slice count through a symmetric 5% band (#30138)
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiNjyvCdXYygFqntMNR7S2dW)_
Fixes #29826
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:分片切片数校验(pin 3c)由"只认恰好一个切片数"改为两侧对称 5% 滞回带,一个常量
`SLICE_COUNT_HYSTERESIS = 0.05`。
- 为什么改:CLI 测试时长的周间噪声(1339–1493 s)远大于 20 s 余量,每周自动刷新的计时数据 PR
会随机变红,需席位手工开车道 PR 才能落地。
- 风险与回滚:只改自测接受哪个手写切片数;任何一次 CI 运行的切法、密度上限、整包腿上限都不读它。回滚即 revert 本 PR。
- 先看:`scripts/partition-test-shards.mjs` 的 `sliceCountProblems()`
两个判定分支,其次是自测新增的 4 个带内/带外夹具。
- 两分钟验证:`node scripts/partition-test-shards.mjs --self-test`,预期打印
`self-test OK ... file-level slices: @objectstack/cli x2`。
- 需要你做的:无,席位落地。
## What changes
Option D as ruled in comment 6634084947 on the card. One file:
`scripts/partition-test-shards.mjs`.
- New `SLICE_COUNT_HYSTERESIS = 0.05`, commented as the observed noise
width of the CLI median.
- `sliceCountProblems()` (pin 3c) judges both halves through the band.
RAISE refuses only when `weight / n > (1 + h) x limit`. LOWER (or
Retire) refuses only when `weight / (n - 1)` is at or under `(1 - h) x
limit`. A count inside the band passes. Each refusal names the slice,
the limit and the band edge, to two decimals. The count a RAISE names is
still the smallest one that meets the bare limit, so a raised count
lands with margin.
- `planShards()` (NEEDED / SPREADS / WITHIN CAP), the density cap and
pin 3d are byte-for-byte unchanged.
- Self-test: 4 new pin 3c fixtures on the existing 50 s-filler fixture
(limit 65 s, band 61.75 to 68.25 s). Two are in-band passes: RAISE side
at 134 s / 2, LOWER side at 125 s / 3. Each is also run with no band,
and there it must be refused, so the pass is proven to come from the
band. Two are out-of-band refusals beside the edges: 138 s / 2 must say
`Raise it to 3` with `one slice is 69.00s`, and 122 s / 3 must say
`Lower it to 2` with `one slice (61.00s)`. The balancing-pins battery
floor goes from 25 to 29; it now registers 30 cases.
- The `FILE_SHARDED_PACKAGES` "RE-DERIVED AT 2" paragraph gains one
sentence saying why the band exists.
## Tests
- `node scripts/partition-test-shards.mjs --self-test`: exit 0 on head
`1c0a83b762`.
- The four existing fixtures keep their verdicts at h = 0.05: PASS (120
/ 2), Retire the entry (60 / 2), Lower it to 2 (120 / 3), Raise it to 5
(300 / 2).
- Ablations, each through `scripts/ablation-replace.mjs`, restored to
the HEAD blob with an empty `git diff HEAD`:
<details><summary>Ablation readings (self-test exit code and first
failing case)</summary>
| Mutation | Exit | First failure |
|---|---|---|
| `SLICE_COUNT_HYSTERESIS = 0` | 1 | a count of 2 inside the RAISE band
was not passed by the band alone |
| LOWER branch judged against the bare `limit` | 1 | a count of 3 inside
the LOWER band was not passed by the band alone |
| RAISE branch judged against the bare `limit` | 1 | a count of 2 inside
the RAISE band was not passed by the band alone |
| `SLICE_COUNT_HYSTERESIS = 0.07` | 1 | a count of 2 past the RAISE band
was accepted |
| `SLICE_COUNT_HYSTERESIS = 0.1` | 1 | a package that is not the floor
kept its slicing with no refusal (an existing fixture) |
| battery floor 29 to 99 | 1 | battery "the balancing pins (#10472)"
registered 30 case(s), below its pinned floor of 99 |
</details>
## Acceptance notes
- Thresholds re-measured on the committed dataset (CLI 1432.04 s; floor
`@objectstack/metadata-protocol` 566.50 s; limit 736.45 s). I called the
exported `sliceCountProblems()` on the dataset binned the way the
self-test bins it, varied only the CLI weight on a 0.01 s grid, and they
agree with the ruling's figures. Map 2 is accepted for CLI 699.63 to
1546.54 s (ruling: up to 1546.5). Map 3 is accepted for CLI 1399.26 to
2319.81 s (ruling: over 1399.3 to 2319.8).
- Card bullet 1: the dataset with the map at 2 passes, and so does CLI
at 1480 s with the map at 2 (also 1493 s, the measured high run).
- Card bullet 2: a drift past the band still refuses with the numbers.
At CLI 1546.6 s with map 2: `one slice is 773.30s -- past 1.3x ...
(567s, so 736.45s) by more than its 5% band (773.27s) ... Raise it to
3.` At CLI 1399.2 s with map 3: `at 2 one slice (699.60s) ... with more
than its 5% band to spare (699.63s). Lower it to 2`.
- Floor-side reading by the same formula: with the CLI at 1432.04 s, map
2 holds while the floor stays at or above 524.56 s.
- The nominal RAISE bound in the self-test moves from 1.3x to 1.365x.
The maintainer ruled on that tradeoff (option D). No run's split reads
it.
## Verification
All 31 commands that `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` derives for this diff exited 0. The
exit codes were captured before any pipe, and `--ran` reconciliation
reports `31 derived, 31 run, 0 NOT-MEASURED, 0 UNRUN` (a derived zero:
all 31 recorded an exit code). `pnpm check:pm-dispatch-gates` (fast
tier, 1945 cases) also exited 0. The CI-only `Plan Test Core shards`
step and the type-check lanes are not measured locally; CI runs them.
`skip-changeset`: the diff touches only root `scripts/`, which no
package publishes. `origin/main` was merged once before opening.
Session: https://claude.ai/code/session_017ihL2ebbZkr2QAEG1x7UC8
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2168447 commit 2381085
1 file changed
Lines changed: 89 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| |||
388 | 398 | | |
389 | 399 | | |
390 | 400 | | |
391 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
392 | 405 | | |
393 | 406 | | |
394 | 407 | | |
| |||
845 | 858 | | |
846 | 859 | | |
847 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
848 | 864 | | |
849 | 865 | | |
850 | 866 | | |
| |||
856 | 872 | | |
857 | 873 | | |
858 | 874 | | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
859 | 881 | | |
860 | 882 | | |
861 | 883 | | |
862 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
863 | 890 | | |
864 | 891 | | |
865 | 892 | | |
| |||
885 | 912 | | |
886 | 913 | | |
887 | 914 | | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
888 | 918 | | |
889 | | - | |
| 919 | + | |
890 | 920 | | |
891 | 921 | | |
892 | 922 | | |
893 | | - | |
894 | | - | |
895 | | - | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
896 | 927 | | |
897 | | - | |
| 928 | + | |
898 | 929 | | |
899 | | - | |
| 930 | + | |
900 | 931 | | |
901 | | - | |
| 932 | + | |
| 933 | + | |
902 | 934 | | |
903 | 935 | | |
904 | 936 | | |
| |||
1884 | 1916 | | |
1885 | 1917 | | |
1886 | 1918 | | |
1887 | | - | |
| 1919 | + | |
1888 | 1920 | | |
1889 | | - | |
1890 | | - | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
1891 | 1924 | | |
1892 | 1925 | | |
1893 | 1926 | | |
| |||
2205 | 2238 | | |
2206 | 2239 | | |
2207 | 2240 | | |
2208 | | - | |
| 2241 | + | |
| 2242 | + | |
2209 | 2243 | | |
2210 | 2244 | | |
2211 | 2245 | | |
| |||
2253 | 2287 | | |
2254 | 2288 | | |
2255 | 2289 | | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
2256 | 2332 | | |
2257 | 2333 | | |
2258 | 2334 | | |
| |||
0 commit comments