Repository navigation
Commit 3ad3b41
ci(test-core): place slice shards by wall and widen Test Core to twelve shards (#38258)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_
Part of #36646
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:合并队列里"核心测试"这一项从十台机器分到十二台,带命令行切片的那几台不再先跑一堆别的包,预计全量构建的这一项提前约三分钟结束。
- 属于"合并队列速度预算"这张每周自动生成的提速卡(队列中位数 22.9 分钟,预算 22 分钟),本单只做其中两项已裁定的措施。
- 出错时表现为某台测试机变慢或测试分配报错,不会漏测;只改了流水线配置和分配脚本,整单回退即可撤回。
- 要你做的:这是受管的流水线文件,需要你审阅并亲手合并。
## What changes
Levers A and B of the routing in the release comment on #36646
(7232820216), on one branch; C and E are not taken, D is left.
- **A — wall-aware slice placement**
(`scripts/partition-test-shards.mjs`, new `placeByWall()` /
`wallOfBin()`, called from `placeItems()`). A split that carries a CLI
slice is no longer balanced on bin sums. Slices go first, one per shard,
then whole packages land on the slice-free shards while each whole leg
stays within `WHOLE_LEG_CAP_SECONDS` (1868 s) and `LOAD_SENSITIVE_APART`
stays apart; only past that do they spill, least modelled wall first (so
onto a non-reader slice shard before the reader slice's, whose
declaration closure is 270 s of serial wall). A split with no slice is
still the plain LPT split, byte for byte, and the density-cap repair
(`refineToCap`) still runs after either placement.
- **B — Test Core 10 → 12 shards** (`.github/workflows/ci.yml`, the
`test` job and `test-gate`): the matrix fallback roster, the job name,
`--shard k/12`, the attestation `--total 12` / artifact names, the
gate's `--leg test/12` and planned-roster fallback, and the
timing-capture/cache-prune labels. `SHARD_COUNT` is read from the matrix
(`scripts/ci-shard-matrix.mjs`), so the partitioner, the planner and the
timings selector follow without a literal of their own.
`scripts/pm/landing-k.mjs`'s self-test pins the shard job's name, so
that pin moves to `/12`.
- Both have to land together: at ten shards, placing by wall pushes
seven whole legs to 1866-1868 s, which is the density PR #25968 was
reverted at. The new self-test pin refuses any whole leg within 5% of
the cap. At twelve, the nine slice-free shards hold every whole package
at 1515-1520 s, below the 1696 s they carry at ten today.
- Comments updated where they state the count (the `test` job header
gains a TWELVE paragraph; `plan-test-core-shards.mjs` header; the
`SHARD_COUNT` docblock carries the figures).
## Tests
<details><summary>Partitioner self-test: new battery and
ablations</summary>
- New battery `a split that carries a slice is placed by wall (#36646)`
(8 cases). 3 cases grade the committed dataset as CI splits it: no whole
package beside a slice except the reader slice's riders; the non-reader
slice shards' heaviest modelled wall falls while the split's heaviest
does not rise; no whole leg within 5% of the cap. 5 are fixtures: the
spill order, the load-sensitive pair, a package that fits no bin, slice
spread, and the no-slice identity. The battery floor goes 18 → 19.
- Two existing pins re-stated for the new placement. (1) The
reader-slice room pin (3e) now asserts the reader shard carries only its
riders, not "300 s less than the other slice shards", which read 53 s
against 0/0 s once those carry nothing. (2) The closure-allowance
refusal fixture now uses a cap under the split's own mean, because the
repair starting from the wall placement can descend below "densest − 1
s".
- `node scripts/partition-test-shards.mjs --self-test`: `self-test OK
(82 measured packages -> 84 shard items, 12 shards, max/mean 1.18x <=
1.3x, floor 1314s, bins
1662.99/827.08/827.08/1514.98/1517.07/1517.11/1517.79/1518.22/1517.51/1518.58/1517.13/1519.68s
within the 2481.24s density cap, whole legs
53/0/0/1515/1517/1517/1518/1518/1518/1519/1517/1520s within 1868s,
file-level slices: @objectstack/cli x3)`.
- Ablation 1, through `scripts/ablation-replace.mjs`: `placeItems`
routed back to `partition()`. The mutation landed (anchor 1 → 0, blob
18e0110 → adfbed35e9c3), the self-test exited 1 on `wall placement:
the committed dataset at 12 shards puts whole packages beside a slice
(@objectstack/service-settings on shard 5, …)`, and the file was
restored to blob 18e0110 with an empty `git diff HEAD`.
- Ablation 2: the whole-leg cap filter dropped from `placeByWall`. The
mutation landed (blob → e76084fdaefa) and the self-test exited 1 on `the
spill fixture split as [c 1/2 | c 2/2 | w,x,y,z]`. Restored the same
way. The committed dataset does not spill at twelve, so only the fixture
can catch this one.
- Other self-tests green on this tree: `plan-test-core-shards` (23
cases), `ci-shard-matrix` (27, `live: test=12`),
`check-shard-attestation` (360), `select-shard-timings-run`, `landing-k`
(47).
</details>
## Acceptance notes
- **Affected job, before and after (advisory, per AGENTS.md).**
- Before, measured: `queue-duration.mjs --since 7d` at 2026-11-28T10:09Z
over 1319 all-green SHAs gives p50 **22.9** and p90 **32.3** min (over
both). Its slowest critical-run job is `Test Core (3/10)` at a 19.6 min
median.
- On the 60 latest green merge_group CI runs (2026-11-28), 42 started
Test Core, and their slowest Test Core job reads p50 21.9 min measured.
- After, modelled, not measured: each run's own package list is replayed
through `planShards()`, before at 10 and after at 12, with a whole-leg
fit from those runs' logs (297 legs: `-45 + 0.326*sum + 0.351*heaviest`,
median error 20.6%) and each run's measured slice legs.
- Result: the slowest Test Core job goes 19.2 → 18.3 min modelled (A+B).
B alone is 19.1, and A alone at ten is 19.1, but A alone puts the whole
legs at the cap. On the 28 runs that started all ten shards: 22.1 → 19.1
modelled.
- Applied to those runs' measured job ends, the CI run wall over all 60
goes p50 25.7 → 25.0 and p90 34.1 → 29.1. Projected onto the 7-day
reading: queue p50 about 22.2 min, p90 under the 32-min alarm. That is
not yet under the 22-min budget.
- **A real post-merge reading is owed**: the next weekly
`queue-duration-budget` run, or `node --use-env-proxy
scripts/ci/queue-duration.mjs --since <merge time>` once a few hundred
queue SHAs have run at twelve.
- **What still sets the floor.**
- After this change the reader slice's shard (CLI 1/3 plus its 270 s
declaration closure) is the heaviest modelled Test Core shard.
- In the sample, the runtime shard (`Test Core (3/10)`:
`@objectstack/runtime` alone measured 19.5-22 min) was the slowest on 9
of 28 all-ten runs. Neither lever moves a single package's own wall.
- The Dogfood Regression Gate shards (17 min median) and Test UI also
stay where they are.
- So reaching under 22 needs a separate lever on one of those. That is
not this PR, and `Part of` leaves the card open for the weekly reading.
- **Cost.** Two more runners on a full plan, ~+3.6 runner-min at the
per-shard overhead the `test` job header already measures. Shards 11 and
12 start with a cold per-shard Turbo cache key until `main`'s push runs
seed them, and every shard's package set moves once, so the first queue
runs after merge read slower than steady state.
- The shard-timings refresh judges each run at its own `Test Core (k/N)`
width, so the ten-wide runs stay readable. Its next refresh needs
twelve-wide runs to accumulate.
- `scripts/ci/queue-budget.json` is untouched.
- `skip-changeset`: the diff ships nothing from any published package
(root `scripts/` and `.github/` only).
## Verification
Read first:
1. `scripts/partition-test-shards.mjs`, `placeByWall()` and
`placeItems()`. The risk is the candidate filter: the cap and the apart
pair, then the fallbacks.
2. `.github/workflows/ci.yml`, the `test` job's `strategy.matrix` and
`test-gate`'s `--leg test/12` and `OS_TEST_PLAN`. Every `/10` literal of
the job has to move together.
3. The new 3f battery in the same script's self-test.
Two-minute check: `node scripts/partition-test-shards.mjs --self-test`
prints `12 shards`, and whole legs `53/0/0/1515/…/1520s within 1868s`,
so the three slice shards carry their slices only.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 88ae2f9 commit 3ad3b41
4 files changed
Lines changed: 299 additions & 50 deletions
File tree
- .github/workflows
- scripts
- ci
- pm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
903 | 903 | | |
904 | 904 | | |
905 | 905 | | |
906 | | - | |
| 906 | + | |
907 | 907 | | |
908 | 908 | | |
909 | 909 | | |
| |||
924 | 924 | | |
925 | 925 | | |
926 | 926 | | |
927 | | - | |
| 927 | + | |
| 928 | + | |
928 | 929 | | |
929 | 930 | | |
930 | 931 | | |
| |||
967 | 968 | | |
968 | 969 | | |
969 | 970 | | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
970 | 984 | | |
971 | 985 | | |
972 | 986 | | |
| |||
1037 | 1051 | | |
1038 | 1052 | | |
1039 | 1053 | | |
1040 | | - | |
| 1054 | + | |
1041 | 1055 | | |
1042 | 1056 | | |
1043 | 1057 | | |
| |||
1048 | 1062 | | |
1049 | 1063 | | |
1050 | 1064 | | |
1051 | | - | |
| 1065 | + | |
1052 | 1066 | | |
1053 | 1067 | | |
1054 | 1068 | | |
| |||
1113 | 1127 | | |
1114 | 1128 | | |
1115 | 1129 | | |
1116 | | - | |
| 1130 | + | |
1117 | 1131 | | |
1118 | 1132 | | |
1119 | 1133 | | |
| |||
1124 | 1138 | | |
1125 | 1139 | | |
1126 | 1140 | | |
1127 | | - | |
1128 | | - | |
| 1141 | + | |
| 1142 | + | |
1129 | 1143 | | |
1130 | 1144 | | |
1131 | 1145 | | |
| |||
1149 | 1163 | | |
1150 | 1164 | | |
1151 | 1165 | | |
1152 | | - | |
| 1166 | + | |
1153 | 1167 | | |
1154 | 1168 | | |
1155 | 1169 | | |
| |||
1218 | 1232 | | |
1219 | 1233 | | |
1220 | 1234 | | |
1221 | | - | |
| 1235 | + | |
1222 | 1236 | | |
1223 | 1237 | | |
1224 | 1238 | | |
| |||
1348 | 1362 | | |
1349 | 1363 | | |
1350 | 1364 | | |
1351 | | - | |
| 1365 | + | |
1352 | 1366 | | |
1353 | 1367 | | |
1354 | 1368 | | |
| |||
1473 | 1487 | | |
1474 | 1488 | | |
1475 | 1489 | | |
1476 | | - | |
| 1490 | + | |
1477 | 1491 | | |
1478 | 1492 | | |
1479 | 1493 | | |
| |||
1842 | 1856 | | |
1843 | 1857 | | |
1844 | 1858 | | |
1845 | | - | |
| 1859 | + | |
1846 | 1860 | | |
1847 | 1861 | | |
1848 | 1862 | | |
| |||
1886 | 1900 | | |
1887 | 1901 | | |
1888 | 1902 | | |
1889 | | - | |
| 1903 | + | |
1890 | 1904 | | |
1891 | 1905 | | |
1892 | 1906 | | |
| |||
1968 | 1982 | | |
1969 | 1983 | | |
1970 | 1984 | | |
1971 | | - | |
| 1985 | + | |
1972 | 1986 | | |
1973 | 1987 | | |
1974 | 1988 | | |
1975 | | - | |
| 1989 | + | |
1976 | 1990 | | |
1977 | 1991 | | |
1978 | 1992 | | |
| |||
2102 | 2116 | | |
2103 | 2117 | | |
2104 | 2118 | | |
2105 | | - | |
| 2119 | + | |
2106 | 2120 | | |
2107 | 2121 | | |
2108 | 2122 | | |
| |||
2115 | 2129 | | |
2116 | 2130 | | |
2117 | 2131 | | |
2118 | | - | |
| 2132 | + | |
2119 | 2133 | | |
2120 | 2134 | | |
2121 | 2135 | | |
| |||
2158 | 2172 | | |
2159 | 2173 | | |
2160 | 2174 | | |
2161 | | - | |
| 2175 | + | |
2162 | 2176 | | |
2163 | 2177 | | |
2164 | | - | |
| 2178 | + | |
2165 | 2179 | | |
2166 | 2180 | | |
2167 | 2181 | | |
| |||
2194 | 2208 | | |
2195 | 2209 | | |
2196 | 2210 | | |
2197 | | - | |
| 2211 | + | |
2198 | 2212 | | |
2199 | 2213 | | |
2200 | 2214 | | |
2201 | 2215 | | |
2202 | 2216 | | |
2203 | 2217 | | |
2204 | | - | |
| 2218 | + | |
2205 | 2219 | | |
2206 | 2220 | | |
2207 | 2221 | | |
| |||
2317 | 2331 | | |
2318 | 2332 | | |
2319 | 2333 | | |
2320 | | - | |
2321 | | - | |
| 2334 | + | |
| 2335 | + | |
2322 | 2336 | | |
2323 | 2337 | | |
2324 | 2338 | | |
| |||
2330 | 2344 | | |
2331 | 2345 | | |
2332 | 2346 | | |
2333 | | - | |
| 2347 | + | |
2334 | 2348 | | |
2335 | 2349 | | |
2336 | 2350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments