I Made Every Two-Line Change Run the Whole Test Suite
This is a postmortem about an acceptance criterion I copied into dozens of tasks without thinking about it. It wasted hours of machine time. It also hid the fact that the one check that mattered never ran in CI.
What happened
We needed to pin the base images in several microservice repositories by digest. In each repo that meant changing the two FROM lines in one Dockerfile and nothing else. I filed one task per repository. Every task ended with the same “Done when” section:
## Done when
- No `FROM` line names a base without a digest.
- `make gate` passes.
make gate runs every check the repository has, about fifteen in all: the full Rust test suite (close to 900 tests in one repo), clippy over every target, the docs build, dependency audits, dependency pin checks that fetch from remotes, the shell test suite, pytest over the CI scripts, and the prose and formatting linters.
Only one of those fifteen can fail because of a Dockerfile change: the test file that builds the container image. Nothing else reads the Dockerfile.
The implementers did exactly what the tasks said. They ran everything and reported it as evidence: “make gate passes, all 888 tests among them,” “all 16 gates passed.” Those numbers sound reassuring, but almost all of them came from tests that could not have failed.
It wasn’t just these tasks
When I looked back over one day’s closed work, about four in five tasks ended with “make gate passes.” More than half of those were small, contained changes:
- One or two lines of a Dockerfile. One test file could judge the change.
- One shell script or one Python module in our main repository. There,
make gatetakes roughly 40 minutes of pipeline time. It runs every shell test in the tree, all of pytest, a pixel-by-pixel renderer comparison in a headless browser, and every documentation site’s build. For a change to a deploy script, the renderer and docs gates can’t fail, and even the shell-test gate runs every file instead of the one next to the script. - Test fixture changes in one Rust repository. Running the test suite made sense. The other fourteen gates didn’t.
For the first two groups, a few percent or less of the gate time could actually judge the change.
Some tasks even said “shell-tests among the gates.” So I had already named the right check, then required everything else on top of it.
Why this was wrong
The tools to run less already existed. The gate runner takes a list of gate ids, and the test runner takes a filter. Every pull request also runs the full pipeline on the forge anyway. A full local run did the forge’s job a second time, on a machine shared with other agents, and slowed everyone down. Each of those six two-line tasks took four to six hours to close. Queueing and review are part of that, but it’s still what the team got for a one-minute edit.
Our docs pushed people the wrong way. The developer guide’s headline was “one command runs every gate,” and running a subset appeared only as a trailing comment. Another document called make gate “the commit’s check.” Nothing said when to run less, or that the full run belongs to the pull request’s pipeline. Because these docs are copied into every repository, the habit spread everywhere.
The full run made other problems worse. A few recent incidents, including a container-exec storm that slowed a whole machine, were blamed on expensive tests running in every session’s make gate. We fixed those tests and never asked why every session was running them.
The part that scared me
The image-build test is the only check that proves a pinned digest exists and that the image builds on it. In CI there is no container runtime, so that test prints “skipped” and returns success.
So on every pull request and every nightly run, the one relevant test was reported as passed without running. The pins were verified once, in each implementer’s local session, during the same bloated run I’m criticising. The full run was the wrong tool locally, and the right check was missing remotely.
What I should have written
The “Done when” section should name the check that judges the change and leave the full run to the pipeline:
## Done when
- No `FROM` line names a base without a digest.
- The image test passes on the pinned bases with a container runtime
available (run with a filter that selects just that test binary).
The pull request's pipeline runs every other gate.
For a shell script: “the test file next to the script passes; the PR pipeline runs the rest.” For a CI helper module: “its pytest file and the Python linter pass.” When I honestly can’t say what a change touches, that’s when make gate is the right call, and the task should say why.
What I’m changing
- Tasks name the check that can fail. Before writing a “Done when,” I ask which gate this change could turn red. Gate authors already answer that question when they add a gate. Task authors need to answer it too.
- The docs put selection first. The guide now explains how to run the gates a change can affect, by id.
make gateis described as the fallback for changes whose reach you can’t name. “The commit’s check” will say what it means: the pipeline is the check; the full local run is optional. - Implementers report what they ran and why. “These two gates were run because they read the changed files; the rest are left to the PR pipeline” is better evidence than a big test count. A green result only tells you what was actually exercised.
- Skipped means skipped. Tests that can’t run in an environment must report as skipped through the test runner, not pass by returning early. I’m also either giving the Rust CI job access to a container runtime or naming the image-build pipeline job as where pins get verified.
Warning signs to watch for in review
- A “Done when” that ends with “run everything” on a task whose Work section names one file.
- “X among the gates”: the author knew the relevant check and asked for everything anyway.
- An outcome that cites a total test count for a change that could affect a handful of tests.
- Many identical tasks filed within a minute, each requiring a full run in a different repository.
- Docs whose headline is “one command runs everything,” with the targeted option as a footnote.
- A test that prints “skipped” and returns success, especially when it’s the one test the change can affect.
Running everything feels safe, but here it did two harmful things: it slowed everyone down, and its big passing numbers hid the fact that the check we needed wasn’t running in CI. Next time I’ll name the check that can actually fail.