VARIANCE AUTHORITY
BrowseWhere each checkout's record comes from

Investigate a run

Where each checkout's record comes from, and how old it is

The record is what a test run writes when its runner is wrapped: which tests ran which lines, measured at one commit. variance select, covering and review read it to decide what a change needs. Every branch, a pull request's included, selects from the runs made on that machine plus, when the machine has one, a record of your mainline, the branch the others merge into. This page describes that record's life on a team's machines and CI, and lists every way to get the mainline's record to them: no transport at all, your CI host's cache, or a share, a store your mainline's CI publishes to. An old record never skips a test it should run. It runs more: every mainline commit between the record and your branch counts as part of your change. So the choice in front of you is how many commits behind each machine's record may fall, and what you pay to keep that number small.

What an old record costs

Every selection prints which record it read, and how far that record is from your branch, before the first test starts:

record of "unit": read from mainline main, published at 3f1c9a2…, 2 commit(s) behind the merge base with this checkout.

The execution record names the commit it was measured at, and select diffs from that commit. What that diff contains decides the cost:

The recordWhat select runs
at your merge base with the mainlinethe tests your change needs
behind your merge base, as when a pull request's check merges into a mainline tip newer than the last publishthose, plus the tests the mainline's commits between the record and your merge base change
past your merge base, as when your branch has not taken the mainline's latest commitsthose, plus the tests the mainline's commits between your merge base and the record change
none, or one this version cannot readevery test file

A run made on the same machine since then narrows it again: a test file you ran after the record is selected from the commit it last ran at.

None of these rows skips a test the change needs on the record's word, so a stale record costs time. One case it cannot see: a file added after the record that a test reaches by scanning a directory, not by an import, selects nothing until a record that holds it is read, as sharing describes. How much time depends on which tests the mainline's commits in between change, so one commit to a module every test imports runs every test. Where selection widens lists the other changes that run more than the diff.

How a record changes on one machine

Each checkout keeps one record per suite in the cache, and each wrapped run of that suite writes it. A worktree keeps its own:

WhenWhat happens to the checkout's record
the first run, with nothing to start fromit runs every test file and writes the first record
the first run, on a machine that fetched the mainline's record from a shareit starts from a copy of that record, and says so
a worktree's first run, with nothing fetchedit starts from a copy of the primary checkout's record, and says so
a run of some test filestheir rows are replaced; every other row stays
a newer mainline record is fetched, at a commit your branch containsthe checkout's record changes to it, and keeps the rows of the test files you ran since
a variance upgradethe next run adds to the record, replaces it, or fails after its tests and names it: after an upgrade

A command reads the checkout's own record first, then the mainline's from a share, then, in a worktree, the primary checkout's: a suite your checkout has not recorded has the order and the line each one prints. What is removed, and when lists how long fetched copies stay, and start cold deletes the record.

How other machines get the mainline's record

One run writes the mainline's record: the whole suite, run on a push to the mainline. Every other machine either records for itself or reads a copy of that run. There are three ways:

No transportThe CI host's cacheA share
Who writeseach checkout, for itselfa push to the mainline in CIa push to the mainline in CI
Who reads itthat checkoutCI jobs of the same repositoryCI jobs, laptops, worktrees and agents
What you set upthe wrapped runner configa cache stepa share section, a publish step, and a credential that writes
The record a CI job readsnone: every test file runsthe last mainline push that savedthe latest publish, or with a git share the one at your merge base

No transport: every machine records its own

Wrap the runner and run it. The first run on each checkout runs every test file, and each run after that selects from the record it wrote. A fresh CI machine has none, so in CI every run is the full suite. Choose this to try selection on one machine, or when CI time is not what you are paying for.

The CI host's cache

The mainline's push saves the cache directory, and each pull request restores that save; a pull request never saves over it. In CI has the GitHub Actions workflow; on another CI host, the same save on a mainline push and restore on a pull request use that host's cache. variance carry prints the paths and keys for a suite with "carry": "actions-cache", and review coverage on every pull request uses this transport with no steps of your own. Laptops and agents never read it.

A share

A share is a store your mainline's CI publishes to and every checkout reads from, so a laptop's first selection starts from CI's run of the whole suite. It keeps one line per branch, the latest entries published from that branch, and select reads only the mainline's. Choose the store by what you already run:

  • the repository's own refs, when CI can push to the repository. It also keeps each mainline publish at its commit, so a branch reads the record at its own merge base once that commit's CI has published, and the newest one behind it until then.
  • a directory, when CI and readers share a mount.
  • an HTTP endpoint, including a Tribunal deployment, when you run a store that takes a bearer token. A bucket needs a signing service in front of it.

Publishing says which runs write which line, and what a line keeps says which publish wins and what is never deleted. When a share does not answer, a command reads the record this machine fetched from it earlier, and with none, runs as with no record: when a share fails.

Several suites or projects in one repository

Declare each suite under suites in the root variance.config.json, and each gets its own record and its own carry. Only a suite whose carry is "share" publishes to the share and reads from it; the others keep a record on each machine: one record for each suite. select and review read every suite's record from the share the root config names. A project with a config of its own publishes its run reports to the share that config names, so give each one its own location: what a line keeps.

Options for pull requests, merge queues and shards

Each of these decides which record a CI job selects from, or what it is compared with. The next-push keys and the merge-queue publish work on GitHub Actions only:

Choose by your situation

Your situationWhat to set upThe record each job selects from
One machine, or trying it outnothing beyond the wrapyour own last run; CI runs every test file
CI time onlythe CI host's cache, with a selecting run on pull requeststhe last mainline push that saved; laptops record their own
Laptops and agents should select from CI's runa share, published on each mainline pushthe latest publish; a git share gives each branch the one at or behind its merge base
A busy mainlinea share and carry mergethe mainline's latest, with the pull request merged into its commit, so only the pull request's change counts
A merge queue--from-queue on the pushthe queue's run, from the moment the commit lands
Many pushes per pull requestcarry keep and takethe last push's, over the mainline's
A sharded suitea share, carry hand and receiveone record for every shard and re-run
Pull requests from forksa git sharethe mainline's; an HTTP share has no token there, so the fork runs every test file
GitLab CI, Bitbucket Pipelines or another CIthe CI host's cachethe last mainline push that saved; only GitHub Actions publishes a mainline line to a share, so laptops record their own
A monorepoa suite per runner config under the root config, each with "carry": "share", and a share location per project configeach suite's own last publish