Repository navigation
ci: run the race gate in 3 parts on 3 runners - #276
Merged
Merged
Conversation
Measured before, on 2026-11-24. The Race detector job ran go test -race -timeout 25m ./... on one runner and took 17m46s on PR #275 (run 45427862610), 13m37s on main (run 45324538062) and 13m44s on PR #274 (run 45322892023). internal/synctest alone took 817 s, 604 s and 617 s of those runs. The other packages took 649 s, 422 s and 435 s of test time summed, and those listed before internal/synctest had all reported 3.5 to 5.6 minutes into the step. Verify ran internal/synctest with no race detector in 47 s. -race also turns on checkptr. On a developer machine, pinned to 4 cores while the machine ran other work, internal/synctest took 380 s and 387 s as the job ran it, 175 s and 189 s with -race and no checkptr in modernc.org's packages (SQLite as C translated to Go), and 232 s with checkptr in every package and no race detector. What changed: - Makefile: make race is the race gate, and make ci runs it in place of its own go test line. Its parts are race-rest (-race on every package but internal/synctest, with the old flags), race-sim (-race on internal/synctest with -gcflags=modernc.org/...=-d=checkptr=0) and race-sim-checkptr (internal/synctest with -gcflags=all=-d=checkptr and no -race). - ci.yml: the race-shards job runs the 3 parts as a matrix, each with make race-<shard>. The job named "Race detector" needs it, runs always and passes only when every shard passed, so the rulesets that require that name need no change. No new action; the shards keep contents: read and the new job has no permission. - internal/workflowcheck: a test fails when make race's parts and the matrix differ, when a part loses the race detector, a package or checkptr, and when the required check could pass without every shard. - ADR-0048 (Proposed) records the decision; AGENTS.md, the README and the development and sync design docs describe the gate. Every package and every test still runs under -race, with no fewer seeds or steps. The checkptr checks in modernc.org's packages during the simulation still run, but in a process with no race detector. Checked here: make check, and make race-rest, race-sim (177 s) and race-sim-checkptr (206 s), all passing. Not measured: the job's time on CI after this change, since no pull request has run it. If CI keeps the ratios above, the slowest shard runs its tests in 6 to 8 minutes where the old step took 12 to 17. make ci's time on a developer machine is not measured either.
6 tasks done
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.
Summary
Shortens the "Race detector" check, by far the slowest gate that every pull request waits on (17m46s on #275, 13m37s and 13m44s on the two runs before it), by running the race gate in 3 parts on 3 runners.
Where the time went (3 CI runs on 2026-11-24):
internal/synctesttook 604 to 817 s under race and ran alone to the end of the job; every other package had reported 3.5 to 5.6 minutes in. A CPU profile of 2 scenario tests under race had 43% of its samples inruntime.checkptr*, almost all frommodernc.org/sqlite:-raceimpliescheckptr. Verify runs the same package without race in 47 s.What changes
make raceis 3 targets, andmake cidepends on it:race-rest:go test -raceon every package butinternal/synctest, with the old flags.race-sim:go test -raceoninternal/synctest, withcheckptroff inmodernc.org/...only.race-sim-checkptr:internal/synctestwithcheckptrin every package and no race detector.race-shards. Jobracekeeps the name "Race detector", needs the shards, runs withif: always()and passes only when their result issuccess. Branch protection needs no change.internal/workflowcheck/racegate_test.go: the Makefile's parts and the matrix must agree, each part keeps its flags, and the aggregate keeps its name,needs,always()and its test. 20 mutations are each caught.AGENTS.md,README.md,docs/development.md,docs/design/sync.md.No test, seed or step changes.
Risk tier
Risk tier: 3 — the change matches L2 paths.
.github/workflows/**(ci.yml): the race job becomes the matrix job and the aggregate job. The shards keepcontents: read, the pinned checkout withpersist-credentials: false, setup-go and the module-download retry; the apt step runs only where desktop tests run. The aggregate job haspermissions: {}and no checkout. No new action; no other job changes.Makefile:cidepends on the newracetarget in place of its owngo test -raceline;verify,checkandbumpare untouched.internal/workflowcheck/**: the new guard, and the module-download check now reads therace-shardsjob.Coverage:
race-resttests 59 of the 60 packages ofgo list ./..., every one butinternal/synctest, which the other 2 parts test.Docs housekeeping
TEMPLATE.mddocs/README.mdADR-0048 is Proposed: merging accepts it, or say what to change.
Verification
make checkgreen (host, exit 0)make race-rest(52 ok, 7 with no test files),make race-simandmake race-sim-checkptr: each passes on the host# vX.Y.Z,permissions: {}, andpersist-credentials: falsemake cias a whole (ui-checkneeds the nsl machine), and anything on GitHub's runners.Measured, on one busy host (4 cores):
internal/synctestunder race took 380 and 387 s with today's flags and 175 and 189 s withcheckptroff in modernc; thecheckptrpass with no race detector took 232 s.Not measured: the job's time on GitHub's runners. This pull request's run is the first. If CI keeps the host's ratios, the slowest shard takes about 7.5 to 9.5 minutes against 13.6 to 17.8 today; that is a projection.
To know
-gcflagsfromrace-sim, deleterace-sim-checkptr, and update the guard's parts and the matrix. It saves about 2.5 to 3.5 minutes.if: always(), a cancelled run posts a failed "Race detector" on the commit it was superseded on.make cion a host now runs the simulation twice; its time there is not measured.t.Parallelin the simulation (19% in 1 sample, but the worlds would share the CPUs their timeouts count on);-shortor fewer seeds under race (less coverage); a race build cache (about 30 s a shard on the host, and it needsactions/cache, which this repository does not use).