Skip to content

ci: four shards, two perf jobs and parallel unit tests - #186

Merged
2 commits merged into
mainfrom
ci/four-shards-perf-split-parallel-units
Nov 22, 2026
Merged

2 commits merged into
mainfrom
ci/four-shards-perf-split-parallel-units

Conversation

@HMarzban

Copy link
Copy Markdown
Contributor

Summary

Gets the slowest CI job under about 6.5 min and checks to about 4.5 min. It also folds in #155, so the parallel unit tests are now real. #155 will be closed in favour of this PR.

  • Four shards. The duration-packed shards go from 3 to 4 (Playwright shard 1/4 … 4/4; e2e-shards.ts plan N/4; fallback --shard=N/4). The suite is now about 3,150 s of browser tests outside perf, so about 790 s per shard.
  • Two perf jobs, each on its own runner with one worker:
    • Playwright perf (typing budget): performance.spec.ts and toolbar-perf.spec.ts, via --test-list. About 300 s of tests.
    • Playwright perf (features): every other perf spec, via --test-list-invert of the same list (today find-perf, page-engine-perf and image-asset-encoder-perf). A new perf spec lands here and can never fall between the two jobs.
    • The gate's needs: perf covers both legs.
  • Parallel unit tests. scripts/unit-tests.ts runs bun test --parallel on every unit file except SERIAL_FILES, then those serially.
    • SERIAL_FILES are the 5 files that read the clock and assert a budget: bubble-controller, find-hits, spawn-hocus, markdown-parse and hocus-document-guard.
    • tests/unit/ci/unit-tests.test.ts scans tests/unit and fails if a file with a clock-based budget is missing from the list.
    • Locally the run takes about 20 s, against about 70 s fully serial.
    • Fallback: the repository variable UNIT_SERIAL=1 (gh variable set UNIT_SERIAL --body 1) runs everything serially.
  • Stress probe to nightly. It took 112 s of the checks job and never gated. The new nightly unit-runs job runs the unit tests fully serially and as CI runs them, compares the two file by file with scripts/compare-unit-runs.ts, then runs the stress probe (continue-on-error). The nightly streak classifies the 4 new steps as test steps.
  • Changed files logs "Shard timings: N files, from run X" instead of the whole JSON.
  • Merge queue: each entry now runs about 17 jobs (11 of CI and 6 of the desktop shell). The runbook therefore recommends build concurrency 1 instead of 2.
  • Docs: TESTING, AGENTS, the runbook and CHANGELOG.

Verification

  • bun test tests/unit/ci tests/unit/scripts/nightly-streak.test.ts passes 203 tests. actionlint, typecheck and Biome are clean.
  • Local, serial vs as-CI: 287 files and 3,845 tests compared. The only differences came from files I was editing between the two runs.
  • Perf selection: --test-list gives 5 tests in 2 files and --test-list-invert gives 7 tests in 3 files: all 12 perf tests.
  • CI timings: below, once green.

🤖 Generated with Claude Code

- The browser suites run in four duration-packed shards.
- Perf splits into the typing budget and the feature budgets, each on its
  own runner with one worker; the gate needs both.
- Unit tests run with bun test --parallel (scripts/unit-tests.ts), the
  files that assert a wall-clock budget serially after; UNIT_SERIAL=1
  runs them all serially. A test keeps that list complete.
- The stress probe moves to a nightly job that also compares a serial
  unit run with CI's, file by file.
- Changed files logs the timings count, not the JSON.
@HMarzban
HMarzban marked this pull request as ready for review November 22, 2026 15:02
@github-merge-queue github-merge-queue Bot closed this pull request by merging all changes into main in 44d48d8 Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant