Monday night a deploy of Binderdex, my Pokémon card price and collection app, failed in a way I had to read twice. After every deploy, a health probe checks whether the new version is serving. This one called the web service healthy, two of two new tasks (running copies of the service) up, seconds after the deploy finished. The rollout itself was still in progress. The probe had looked at the one moment when "some tasks exist" and "the rollout works" look identical.
That failure sent me through the whole pipeline with a meter, and most of what I found was waste I had built myself.
The probe said healthy, the rollout wasn't
The release identity, the commit the running service reports it was built from, had already matched, which made the snapshot convincing. What came next was worse. The run never recorded which commit had deployed, so the next deploy saw unknown state and redeployed web all over again. Two of six failed deploys that day failed this way.
The fix is boring on purpose. The probes for the web service and for the developer site now poll for up to five minutes, and they fail at once when the service reports a failed or inactive rollout. A test against a fake AWS CLI proves all three endings: a completed rollout exits zero, a failed one exits nonzero immediately, and a rollout that never finishes gives up after thirty polls.
Re-proving what every pull request already proved
The second leak was a habit. Every merge to main re-ran my strict quality job, the full set of lint, type and test checks, on its own commit. That came to about twenty-five merges a day and roughly an hour of four-vCPU time, all spent re-proving commits that had just passed the same gate as pull requests.
Main now shares one concurrency group, which is the CI setting that decides what happens when several runs of the same kind pile up. A run in progress is never cancelled, and a burst of merges collapses into the newest commit. The job that picks which groups of tests to run for a change diffs from the last main commit whose run survived, so a collapsed commit's changes still get their tests.
A cache only your own PR can read
This is the leak I'd check for in any repo. The quality job saved a build cache entry on every run. GitHub Actions scopes a cache saved under a pull request ref to that same pull request, so PR runs kept dutifully writing entries that no other run could ever restore.
The step is now split in two: restore everywhere, save only on pushes to main. Pull requests fall back to main's newest entry when their own key has no match. The save condition does the work:
- name: Save Turborepo cache
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.turbo-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v6.1.0
with:
path: monorepo/.turbo
key: ${{ steps.turbo-cache.outputs.cache-primary-key }}
The speedup that lied
Some ideas failed measurement, and I kept the receipts in the commit on purpose. Running the web library tests without test isolation took 11 seconds instead of 65. It also ran 1,091 of 1,628 tests and failed 137 of them on colliding module mocks. I shelved it. Caching the unit-test gates got the same verdict: they run side by side in one job, so caching the fast ones saves nothing while the 97-second suite runs anyway. A speedup that changes what the test measures isn't a speedup.
An audit that became three checks
A sixty-day audit of the pull requests my AI coding agents wrote turned up repeat mistakes, and each one now has a check that carries its incident numbers. A call to the GitHub command line tool, gh api, without --method silently becomes a POST, so a script flags that shape on every PR. Release images get built and proven on every web PR, where before that only happened when Docker inputs changed. A lint rule bans reading the real clock in tests without mock timers, starting from a baseline list of 83 files that already break it, a list that is only allowed to shrink.
The audit ran with a fresh judge model, on the theory that the agent who made the mistake shouldn't grade its own homework. One friction note from the night: node --test treats a path containing square brackets as a glob and happily runs zero tests.
I used to write rules and hope. Now I measure first, then make the machine enforce the measurement. The bill should follow the proof down.