Repository navigation
Commit 87af852
test(spec): split build-schemas-check-mode.test.ts into six files so the repo project runs them in parallel (#25428)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoPahKKD78gi4RU2syTTB675)_
Fixes #25372
Clause-②: no
Metadata-protocol: none
The card's re-scope (option A, triage comment `6358468116`): split
`packages/spec/scripts/build-schemas-check-mode.test.ts` into several
files so the `repo` vitest project runs them in parallel. Test-only; no
`turbo.json`, partition, `ci.yml` or shard-count change.
## What changes
- **One 5135-line file becomes six test files and one shared module.**
vitest runs a file's tests one at a time, so this file (841.97 s, 92
tests, the slowest file of PR run 39893808670) was spec's `test:repo`
floor on its own. The `repo` project's pool is vitest's default (`cores
- 1`, so 3 workers on a 4-vCPU runner; `VITEST_MAX_WORKERS` from
`scripts/vitest-worker-cap.mjs` only ever lowers it), so separate files
run on separate workers.
- **`build-schemas-check-mode.fixture.ts`** (not a `.test.ts`, so
neither project collects it) carries the family header, the sandbox
builders, the #9068 git discipline, `run()`, and every constant more
than one block reads. The old root `beforeAll`/`afterAll` become
`useSharedSandbox(rootScriptsDir)`, which each test file calls once, so
every file builds its own shared sandbox (an `fs.mkdtemp`, so two files
never share one). Module state stays per file because vitest isolates
each test file's module graph.
- **The 15 `describe` blocks move verbatim**, grouped by subject and
balanced on a measured local run of the original file (seconds are that
run's per-block sums):
| File | Blocks | Tests | Local share (s) |
|---|---|---|---|
| `.manifest.test.ts` | #4711, #16431, #5371, #12588 | 18 | 149.2 |
| `.deleted-baseline.test.ts` | #4650 | 15 | 137.5 |
| `.anchor.test.ts` | #5235, #5358 | 15 | 125.6 |
| `.git-topology.test.ts` | #5370, #5847, #6452 (the three own-sandbox
blocks) | 17 | 157.9 |
| `.retired-keys.test.ts` | #4659, #17969 | 13 | 130.9 |
| `.deletion-proofs.test.ts` | #4725, #5898, #18865 | 14 | 127.1 |
Block-local constants travel with their block; constants two files read
live in the fixture.
- **Each test file names its out-of-package input.**
`check:cross-package-test-inputs` reads a test file's own source, not
the modules it imports, so five of the six files at first stopped
showing that they run against the repo-root `scripts/` and the gate
asked to move them to `local`. Each file now resolves `../../../scripts`
itself and hands it to `useSharedSandbox()`, which is the path the
fixture symlinks into every sandbox. They stay in the `repo` project.
- **`vitest.repo-tests.json`** lists the six files in place of the one.
- **Budget lines.** Each file carries its own `// test-budget:` line. No
CI reading of a split file exists yet, so each figure is apportioned:
the pre-split file's slowest CI reading (983.3 s, run 38798542648, the
reading the old 1230 line rested on) times the file's share of the local
run, times 1.25, rounded up to 10 s (190 to 240 s). Each line says so
and asks to be re-measured once CI has read the file on its own.
- **Prose references** to the old file name in
`packages/spec/scripts/**` (`build-schemas.ts` and eight sibling tests)
point at the split file or the fixture they mean.
- No changeset: `scripts/` ships in no package's `files[]` (spec's
`files` is `dist`, `json-schema`, `liveness`, `prompts`, `llms.txt`,
`README.md`, `src/**/*.zod.ts`, `CHANGELOG.md`).
## Verification (head `78a4221bd`)
- **No case lost.** `vitest list --project repo` on the old file and on
the six new files, file prefix stripped, sorted: 92 and 92 names, `diff`
empty. `vitest list --project local` matches none of the files.
- **Timing, before and after (local, same 4-core box, same lock,
labelled local):** the original file alone took 839.06 s (92/92 passed).
The six split files run together as the `repo` project: 370.44 s wall,
92/92 passed, slowest file `git-topology` 205.4 s. The before figure
from CI is on the card: 841.97 s for the file, spec two-task total
1212.41 s (PR run 39893808670) and 1494.69 s in merge-group run
39894014103. The after figure from CI is this PR's own `Test Core`
timing table, read by the seat at review.
- `pnpm --filter @objectstack/spec build`, `typecheck` (includes
`check:scripts-typecheck`): exit 0. `pnpm --filter @objectstack/spec
test`: 711/711 files, 21634 passed, 1 todo.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 66 families on
the final head `78a4221bd`; all 66 ran and exit 0. `--ran`
reconciliation: 66 run, 0 NOT-MEASURED, 0 UNRUN. On the first sweep
(head `9f2ed009f`, 63 families) `check:cross-package-test-inputs`
answered 1 (fixed above), `check-plugin-teardown-shape --self-test`
answered 3 (its pinned control commit was missing from the shallow
clone; fetched), and `check:dual-build-cjs-loads` /
`check:lean-entry-closure` answered 3 (no built dist); all exit 0 on the
final sweep.
## Acceptance notes
- The card's done-when number ("spec's two-task total in a merge-group
`Test Core` timing table drops") can only be read after this lands in a
merge group; the before figure above is the one to compare against.
- `scripts/git-env.d.mts:9` (repo root, outside this card's file
surface) still names the old file in prose, and
`scripts/report-test-timings.mjs:935/943` uses the old name as a fixture
log line (correct as data). Noted, not changed.
- The cross-package scan does not follow a test file's imports into
same-package helper modules. Here each file now names its input itself;
other tests whose out-of-package reads live only in an imported helper
would be unseen by the same scan. Noted, not filed.
## CI after-numbers (run 39963105499, head `dce4c6406`, `pull_request`,
Test Core aggregate job 120460015448)
- **Slowest file in spec:** 841.97 s before (the one file, PR run
39893808670). After, the six files read 457.69 s (`git-topology`),
420.84 s (`deleted-baseline`), 386.75 s (`deletion-proofs`), 147.50 s
(`retired-keys`), 140.73 s (`manifest`) and 104.13 s (`anchor`). The
slowest is now 457.69 s.
- **Spec's two-task total** (the card's done-when quantity): 1113.11 s
in this PR run, against 1212.41 s in PR run 39893808670 and 1494.69 s in
merge-group run 39894014103. The merge-group comparison can be read only
after this lands.
- **Load cost:** on a shared runner, the files run side by side and each
takes longer than its serial share. The six together are 1657.6 s of
file time, against 842 s for the one file. The wall drops because they
overlap.
- **Shard tests steps in this run:** 10.6 to 20.4 min (slowest shard
4/6). That is a reading of this run, not a comparison of like with like.
- **Budget lines** were re-set from this reading in `ab63b4e7e`: each is
the CI reading × 1.25, rounded up (580, 530, 490, 190, 180 and 140 s).
They replace the first apportioned estimates (190 to 240 s), which
assumed each file keeps its serial share and came in under the three
heaviest readings.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01P8iUGfP2wffkVBD5uSfDgq
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dc3e5b9 commit 87af852
18 files changed
Lines changed: 5542 additions & 5150 deletions
File tree
- packages/spec
- scripts
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
1828 | 1828 | | |
1829 | 1829 | | |
1830 | 1830 | | |
| |||
2022 | 2022 | | |
2023 | 2023 | | |
2024 | 2024 | | |
2025 | | - | |
| 2025 | + | |
2026 | 2026 | | |
2027 | 2027 | | |
2028 | 2028 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| |||
0 commit comments