Skip to content

perf(ci): run the test row in four shards on four runners - #3517

Merged
dan-petty merged 6 commits into
mainfrom
perf/3050-ci-test-job-time
Nov 4, 2026
Merged

dan-petty merged 6 commits into
mainfrom
perf/3050-ci-test-job-time

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The job Tests & Coverage took 355 s to 528 s on the runner that GitHub gave, over the 300 s of AGENTS.md rule 5. The cause is the speed of the runner and the size of the suite, so no cut of fixed work fixes it.

The test row now runs in four shards on four runners (pytest-split, devops ci --shard N --shards T). A shard checks no coverage floor. The job Tests & Coverage stays the required check: it fails when a shard did not succeed, joins the coverage data with coverage combine, applies fail_under to the whole tree, and runs the changed-line coverage. devops ci job-time times a run from the first shard start to the end of that job. The implement watch reads the log of a failed shard, not of the join.

Closes #3050

Change: openspec/changes/archive/2026-11-04-3050-shard-the-test-job-across-runners/

The Tests & Coverage check averaged 474 s on main over the last 30 pushes, over the 300 s
bound of AGENTS.md rule 5. The same suite took 355 s on a fast runner and 528 s on a slow one,
so no cut of constant work holds the bound on every runner.

The test row now runs in four shard jobs with pytest-split, and the required job Tests &
Coverage joins their coverage data, checks fail_under on the whole and runs the changed-line
coverage. devops ci gets the options --shard and --shards. devops ci job-time times the
check from the first shard to the end of the join, and its window is 20 runs.
The join check Tests & Coverage fails when a shard fails, and its log holds no test output. The watch now names a failed shard check first (#3050).
A late re-run of failed jobs found the one-day artifact gone, and coverage combine then merged fewer shards (#3050).
@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners labels Nov 4, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Proof and test results

Fail-to-pass: uv run devops ci fail-to-pass --base origin/main showed 30 tests failing on the base and 328 passing in the five changed test files (tests/commands/test_ci.py, test_ci_shard.py, tests/github/test_ci_job_time.py, tests/invariants/test_architectural_invariants.py, test_workflow_contracts.py). The new tests fail on the base for the right reasons, for example _resolve_pytest_cmd() got an unexpected keyword argument 'shard' and KeyError: 'test-shard'.

Local checks: actionlint and zizmor pass on the new workflow. The group counts of pytest-split, the empty --cov-report= shard run, and coverage combine plus coverage report failing at 21% against the 85% floor were checked on a subset. The pre-push hook passed.

Review follow-up

  • The roadmap implement watch picked the first failed check, which can be the join check. Its log holds no test output. The watch now names a failed shard check first (new test, spec requirement and task 6.1).
  • The artifact retention of the shard coverage data is now 7 days, so a late re-run of failed jobs still finds the data.
  • A comment of ci.yml was re-wrapped and a stale README.md entry was removed from the archived tasks.
  • Rejected: a count check of the downloaded artifacts. The join job cannot read strategy.job-total of the matrix job, so the count would need a second source of truth.

Open point

The 5-minute figure is an estimate until this PR runs: 30 s setup, 25 s collection, a quarter of the test time and about 70 s for the join gives about 260 s on the slow runner. I will read the wall time of the first runs of this PR. If one is over about 270 s, a fifth shard is one more entry in the matrix. The 20-run mean of Test Job Duration stays open until about 15 new runs of main replace the old single-job runs.

Each shard ran the tests of a quarter of the suite, so syrupy counted the snapshots of the other shards as unused and exited with 1 (#3050).
@dan-petty

Copy link
Copy Markdown
Owner Author

First CI run of this PR (head 28c9760)

All checks pass. The first run of the head before it failed in all four shards: the tests passed, but syrupy exits with 1 on unused snapshots, and each shard holds the snapshots of the tests in the other shards as unused (8 in each shard; the full run on main shows 30 passed and none unused). A shard now runs with --snapshot-warn-unused (commit 28c9760, with the spec and design updated).

Wall time from the first shard start to the end of the join job Tests & Coverage: 277 s. Shard job times: 196 s, 144 s, 200 s and 142 s. The join job took 53 s. This is one sample, and it is under 300 s. It is also over the 270 s margin that the review set for a fifth shard. The shards are uneven (142 s to 200 s), so a fifth shard would cut about 40 s. I did not add one on one sample. A person should read Test Job Duration on main after the merge and add an entry to the matrix shard if the mean stays over 300 s.

@dan-petty
dan-petty marked this pull request as ready for review November 4, 2026 21:34
@dan-petty
dan-petty merged commit 69ee7da into main Nov 4, 2026
23 checks passed
@dan-petty
dan-petty deleted the perf/3050-ci-test-job-time branch November 4, 2026 21:37
dan-petty-release Bot added a commit that referenced this pull request Nov 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.56.1](v0.56.0...v0.56.1)
(2026-11-04)


### Bug Fixes

* **roadmap:** the App token can push a workflow file
([#3521](#3521))
([835fbac](835fbac))


### Performance Improvements

* **ci:** run the test row in four shards on four runners
([#3517](#3517))
([69ee7da](69ee7da))
* **k8s:** embedding-only tiers use one CPU thread
([#3522](#3522))
([c196a54](c196a54)),
closes [#3518](#3518)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(ci): the Tests & Coverage check averages 7 minutes, over the 5 minute bound

1 participant