Repository navigation
ci(test-shards): place Test Core bins by predicted wall, and cut the CLI into 4 slices on the refreshed dataset - #25968
Merged
Conversation
…ce shard carries no whole-package leg ahead of its serial slice A shard runs its whole packages four at a time and then each file-level slice alone, so its tests step reads ~wholeSum / 2.9 + slice (the #25376 wall model). partition() balanced plain sums, which filled every slice shard up to the mean with whole packages that ran before the slice. It now places by load (a slice counts 2.9x its weight); a split with no slice is placed byte-identically. Claude-Session: https://claude.ai/code/session_01NPH84ZP1jWcst3tpRwfrJL Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
席位核对Verdict: ACCEPT at head Checklist
Gate readings at head
Seat's own readings, in a detached worktree at
Deviations / follow-ups (named, not fixed here)
Generated by Claude Code |
Regenerated by .github/workflows/shard-timings-refresh.yml from the test-core-run-summary artifacts of 14 accumulated run(s) (40272142430 40266979145 40262173089 40257470166 40242835329 40238189261 40233481335 40228747755 40223991179 40219252911 40214410982 40209651657 40204927516 40200279306), newest 40272142430 at 2a728ba. Generated, never hand-edited.
…he 2026-10-26 refresh
The refreshed dataset measures @objectstack/cli at 2697.45s. At 3 slices one
slice is 899s, past 1.3x the heaviest other serial task
(@objectstack/metadata-protocol, 670.12s, so 871s), and pin 3c refuses the
refresh. At 4 a slice is 674s and meets; 3 does not, so 4 is the smallest.
PREVIOUS_FILE_SHARDED_PACKAGES carries the outgoing {cli: 3}, so the refresh
lane still decodes the 3-slice summaries retained from before this change.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPH84ZP1jWcst3tpRwfrJL
Contributor
Author
席位核对 (delta re-review)Verdict: ACCEPT at head The delta
Gate readings at head
Seat's own readings at
Still open on #25870 (named, not done here)
Generated by Claude Code |
os-zhuang
pushed a commit
that referenced
this pull request
Oct 26, 2026
…6-10-23 dataset (undo #25968) (#26077) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D5ZEhycrEz6EHUjW1whANXQ)_ Fixes #26074 Clause-②: no Metadata-protocol: none ## What This is a clean revert of f36f619 (#25968). It changes two files and nothing else: `scripts/partition-test-shards.mjs` goes back to plain-sum bin placement, and `scripts/test-shard-timings.json` goes back to the 2026-10-23 dataset with cli in 3 slices. Neither file has a later commit on `main`. No other file imports the exports this removes (`WHOLE_LEG_PARALLELISM`, `loadOf`, `wallOf`). ## Why Since the first queue build on the #25968 layout (08:16Z), full Test Core `merge_group` builds have gone red 5 times in 27. On the old layout, 05:00–08:10Z, they went red 0 times in 19. Every red ejects its PR and rebuilds every entry queued behind it, so throughput fell from 12–13 merges an hour to 6. The failing tests are all load-sensitive: - objectql `src/hook-run-as.test.ts` (cold `import('./index.js')`): Test timed out in 5000ms - plugin-security `src/objects/shipped-sets-identity-default-row-scope.test.ts`: Test timed out in 5000ms - cli `test/hook-timeout-override-refusal.test.ts` CONTROL: the `vitest list` child exits 1 The heads that failed passed when they went back in unchanged. The #25870 thread replayed `planRun()` on both trees. Before, five whole-package shards carried about 1866 s of four-wide work each, and plugin-security sat on a cli-slice shard with 899 s. After, four whole-package shards carry about 2141 s each, and objectql and plugin-security share one shard. The suite-duration ceiling annotations show the effect: plugin-security reads 605–611 s against a ceiling of 474, plugin-auth 617–928 s against 600, driver-sql 603–612 s against 451, and objectql 1102 s against 952. ## Cost and rollback The slowest spec-PR shard goes back to about 25–29 min, from about 20. #25870 stays open for a placement that takes contention into account. Rollback means re-landing f36f619 as it is. ## Verification - `node scripts/partition-test-shards.mjs --self-test`: OK. 75 measured packages, 77 items, 8 shards, max/mean 1.00x, bins about 1866 s, all within the 2899.02 s density cap, cli x3. - `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD`: pass. - The other gates are left to this PR's own CI run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SrpCjPfYv8N9P9EJvoDyN9 Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Oct 26, 2026
Nenzyz
pushed a commit
to Nenzyz/objectstack
that referenced
this pull request
Dec 1, 2026
…ve shards (objectstack-ai#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 objectstack-ai#36646 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:合并队列里"核心测试"这一项从十台机器分到十二台,带命令行切片的那几台不再先跑一堆别的包,预计全量构建的这一项提前约三分钟结束。 - 属于"合并队列速度预算"这张每周自动生成的提速卡(队列中位数 22.9 分钟,预算 22 分钟),本单只做其中两项已裁定的措施。 - 出错时表现为某台测试机变慢或测试分配报错,不会漏测;只改了流水线配置和分配脚本,整单回退即可撤回。 - 要你做的:这是受管的流水线文件,需要你审阅并亲手合并。 ## What changes Levers A and B of the routing in the release comment on objectstack-ai#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 objectstack-ai#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 (objectstack-ai#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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Elon · project thread
Part of #25870. This PR carries two steps: (1) wall-based bin placement, and (2) the refreshed dataset with the CLI cut into 4 slices. #25870 stays open, because its acceptance is measured on 3 consecutive spec-touching PRs after landing. The prediction below is not that measurement.
Supersedes #25960. It carries the shard-timings-refresh lane's commit 92343f5 (
chore(ci): refresh the Test Core shard-timings dataset) unchanged. That refresh cannot land alone, because pin 3c refuses it at 3 slices (step 2).Diagnosis — which of the three, with run ids
The long shards are always the three that carry a
@objectstack/clifile-level slice. Read fromgh api …/runs/N/jobsstep timings on 56pull_requestruns (2026-10-25 18:54Z – 2026-10-26 05:44Z), and from the slice leg's ownDuration/ turboTime:lines on the 18 slice-shard jobs of sixpackages/spec-touching runs.The slowest shard on a spec-touching PR breaks down like this (minutes):
Time:)(whole-package leg =
Run this shard's testsminus the slice leg's turboTime:.)Three causes, all real, in this order of size:
BaseSequencer.shard: sha1 of the path, then equal-count chunks), so the three slices are not equal: across the six runs they measured 518–1047 s, the heaviest ~1.27× the mean (~820 s). Total cli 2406–2542 s against a pinned 2899 s (0.83–0.88×).@objectstack/cliis in ci.yml'sDTS_READERS, so every slice shard builds the whole cli closure WITH.d.ts, and a PR run reads no remote cache, so that build is cold (ci.yml: local cold closure 5m59s with declarations, 1m24s without).partition()balanced bins by their SUM of predicted seconds. A slice runs serially after the four-wide whole leg, so the step is ~ wholeSum / 2.9 + slice (the ci(test-shards): widen Test Core from 6 to 8 shards once@objectstack/specis file-sharded — the "6 is enough" arithmetic predates the cli slices (full-battery slowest shard ≈ 1937 s → ≈ 1452 s) #25376 wall model). Balancing sums filled every slice shard up to the mean with ~900 s of whole packages: predicted step 1277 s on the three slice shards against 643 s on the other five (committed dataset, full list).Stale weights are not the cause: on the refreshed dataset (#25960, the shard-timings-refresh lane's 2026-10-26 output) the sum-placed split still predicts 1107 s on the slice shards against 518 s elsewhere — the same 2.1× gap.
Step 1: wall-based placement (cause 3)
In
scripts/partition-test-shards.mjs, with no workflow or package edit:partition()places bins by load — the wall model in whole-package seconds, a slice countingWHOLE_LEG_PARALLELISM(2.9, the ci(test-shards): widen Test Core from 6 to 8 shards once@objectstack/specis file-sharded — the "6 is enough" arithmetic predates the cli slices (full-battery slowest shard ≈ 1937 s → ≈ 1452 s) #25376 constant, reused rather than re-derived) times its weight. A list with no slice is placed by exactly the same additions and comparisons as before, so every non-sliced run (and the nightly, which slices every package on every shard) gets a byte-identical split.totalstays the plain sum, so the density cap and the drift report mean what they meant.refineToCap()keepsloadin step withtotal.balanceOf()also reports the walls; pin 2 grades the wall ratio (with a slice in the split the sums are unequal by design); new pin 2b is a fixture where sum-placement and wall-placement differ.Predicted test steps, full list (
turbo ls, dogfood excluded), viaplanRun():Measured-based expectation for the six spec runs above: removing the whole-package leg takes the slowest shard from 25.7–28.8 min to ~22.3–25.1 min. The other five shards absorb the moved packages (their slowest was 17.5 min; +~2.5 min of four-wide work each).
Step 2: the refreshed dataset, and the CLI at 4 slices
The refresh (92343f5, 14 runs, newest 40272142430) measures
@objectstack/cliat 2697.45s. Pin 3c (sliceCountProblems, the serial-floor derivation of #22075) then refuses 3 slices:@objectstack/metadata-protocol670.12s; spec and runtime run as two tasks)So the change is
FILE_SHARDED_PACKAGEScli 3 → 4, withPREVIOUS_FILE_SHARDED_PACKAGESset to the outgoing{cli: 3}per the map's own rule, so the refresh lane still decodes the 3-slice summaries retained from before the change. The docblocks carry the new derivation table. The bin-sum floor and the wall model agree on this dataset, and no ratio or bound moved. Predicted test-step walls on the full list are 738s on all 8 shards (max/mean 1.00x), and every bin is within the density cap.Predicted from measurement, not from the model. vitest's
BaseSequencer.shard(sha1 of the path relative to the package root, sorted, equal-count chunks) reproduced locally overvitest list --filesOnly(506 files) matches run 40274911131's three slice jobs file for file: 169/169/168 files on jobs 121415631670/…679/…708. From those jobs' per-file times, with the wall taken as 0.39 × the per-file sum (vitest'sDurationover itstestssum on the same jobs: 0.403/0.381/0.390):Duration)The heaviest slice falls 27%. Applied to the six spec runs (slowest = setup ~1.5 + that run's cold DTS closure + ~1.1 min of whole leg, the wall model's 738 − 674 s, + 0.727 × that run's heaviest slice):
That gives 18.5–20.9 min, with three of six at or under 20. The cost: a fourth shard now builds the CLI's DTS closure (~5.8 min cold). The 738s walls above count test time only, not that build. The per-file read of 5/8 lacks 11 files that print before the 5,000-line log tail; their 172.2s (vitest
testsminus the captured sum) is spread evenly over them.If the readings stay above ~20 min
What is left on a slice shard is the cold DTS closure (5.5–6.3 min) plus the heaviest slice. The next steps, neither taken here:
.d.ts. With the split now reproducible, a slice holding none of them could build DTS-off (~1 min instead of ~5.8). This editsci.yml, so it is Tier H.Acceptance notes
.github/workflows/ci.yml(Tier H, untouched): the Test Core header still says each slice is "placed at its PLAIN weight so every bin keeps the whole-package split's density", and its "3 slices" wording (the drift-step comment, "a shard carrying one of its 3 slices is predicted a third of that"; the timeout history) is now stale. Correcting either makes a PR Tier H, so both are left for whichever step edits ci.yml. The partitioner's own headers carry the corrected statements.Tests
node scripts/partition-test-shards.mjs --self-testat b323410 →self-test OK (75 measured packages -> 78 shard items, 8 shards, predicted test-step walls 738/738/738/738/738/738/738/739s, max/mean 1.00x <= 1.3x, …, file-level slices: @objectstack/cli x4).scripts/ablation-replace.mjs, bin choice back tototal, on the committed dataset): the self-test reds withbalance: at 8 shards the slowest predicted test step is 1.45x the mean (1277s vs 881s). Restored blob == HEAD, andgit diff HEADis empty.@objectstack/cli: sliced 3 ways at 2697.45s, one slice is 899s -- past 1.3x the heaviest other serial task (670s, so 871s) … Raise it to 4.(the same red as chore(ci): refresh the Test Core shard-timings dataset #25960's job 121437007857).scripts/test-shard-timings.jsonis byte-identical to 92343f5 (git diff 92343f5b b3234103 -- scripts/test-shard-timings.jsonis empty).measure-test-shard-timings(decodes through both maps),check-test-completeness,ci/select-shard-timings-run,nightly-tiers,check-test-suite-ceilings,ci/select-shard-packages.selftest.sh.Gates
node scripts/pm/dispatch-gates.mjs --commands, merge-base origin/main cdd4eea): all 35 families exit 0. The--ranreconciliation reads35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED. Step 1 alone (8ca31e0) ran its 33 families the same way.Clause-②: no
Metadata-protocol: none
🤖 Generated with Claude Code
https://claude.ai/code/session_01NPH84ZP1jWcst3tpRwfrJL
Generated by Claude Code