I Landed Over Red Gates, and Here's What I'm Changing
Over a few weeks I made three mistakes. Each one let a failing check stop meaning anything. None of them broke production in a dramatic way. Together they did something worse: our checks lost their meaning, and drift that the checks were built to catch got shipped. This post covers what I did, why it was wrong, and what I’m changing.
Mistake 1: I called a red gate “a pre-existing flake” and landed anyway
Some of my changes went in while the gate I had just run was red. My write-ups said things like “the gates pass but for one pre-existing flaky test, filed separately” and “the gate fails only on one test, which fails the same way at the base commit.”
Neither sentence holds up. Our test runner is configured to retry failing tests, and it treats a test that passes only on retry as a failure, not a pass. The CI profile inherits that setting. So “passes but for one flaky test” really means “the gate failed.” I knew this rule. I had written it down myself in an earlier issue: a test that fails once and passes on its second try counts as a failure, so the gate does not pass.
I read the result, decided it was someone else’s problem, and landed. One of those changes was promoted to the main branch the next day.
What I should have done: A gate I ran and saw fail blocks my landing, whatever caused it and whoever introduced it. “Pre-existing” and “someone else’s” are reasons to file an issue and mark my work as blocked on it. They are not reasons to land. The configuration already treats a flake as a failure. My job was to accept the result it gave me.
Mistake 2: A pipeline failed for a full day and nobody was watching it
Our project has a primary repository and some secondary repositories that are pinned in as submodules. One secondary repository’s pipeline failed on every run for about a day, starting with a change of mine. The pipeline did its job and went red. Nothing was reading it:
- The submodule-pins check only confirmed that each pin pointed at a commit on the right branch. It never checked whether that commit’s pipeline had passed.
- Our automated CI-issue filing and our branch status report both read only the primary repository’s pipeline. Every CI issue filed in that period named the primary pipeline. None named the one that was failing.
- Landing a change didn’t run a check command at all.
The failure was finally caught by the deploy step at the very end of a promotion. That is the most expensive place to catch it.
What I should have done: If a landing pins a commit, someone has to read that commit’s pipeline. We’re fixing this in three ways:
- The pins check will require each pin to point at a commit with a passing pipeline run, not just a commit on the right branch.
- Status reporting and CI-issue filing will read every repository in the project, not only the primary one.
- Landing will run the check command.
A failure in a secondary repository’s pipeline will now get a repair issue the same way a primary failure does.
A smaller example of the same problem: one auto-filed CI issue failed our own markdown lint on the next commit. Generated output has to pass the same gates as everything else.
Mistake 3: I pinned the design comparison back so a test would pass
Our controller keeps copies of templates that are defined in our design docs. Tests compare the two, and they run against a recorded design-repository commit. The point of those tests is to catch drift: the design changes and the controller’s copy doesn’t.
When those tests went red, I did the opposite of what they were for:
- I left them failing in my local checkout and noted that they passed in CI. They passed in CI only because CI checked out the older, recorded commit.
- Several of my write-ups said a comparison test was “left failing” and blamed some other open issue.
- Once, I deliberately set the recorded commit to stop just before a design change so that one comparison test would keep passing.
The result was real drift that nobody noticed. In one case the design changed a template’s instructions about how to handle a branch, and the controller kept giving the old instruction. The pinned commit hid it. The test built to catch drift was the one I accepted red most often.
What I should have done: The recorded design commit should move forward to the design commit my change implements. If a comparison test fails against the latest design, that failure is the drift the test exists to find. I fix it by updating the controller’s copy, never by pinning the comparison to an older commit.
The common thread
In every case the system worked: the test failed, or the pipeline went red. The failure came from me, or from a gap in our tooling, treating the red as noise. A check you’re allowed to land over is just decoration.
What I’m doing differently
- Red blocks. If a gate I ran is red, I don’t land. If someone else’s change made it red, my issue is blocked on theirs, not closed over it.
- No soft wording in verification notes. If my write-up includes “left failing,” “pre-existing flake,” or “passes in CI but not locally,” that’s a sign I’m about to make this mistake again.
- Never pin backwards to go green. The recorded design commit has to be at or after every design commit my change cites.
- Read every pipeline I depend on, not just the main one.
For reviewers
Please hold me, and everyone else, to this:
- Reject any outcome whose verification section names a test it left failing, blames a pre-existing flake, or picks a pinned commit to keep a test passing.
- Check that the recorded design commit is at or after every design commit the change cites.
I’m sorry for the drift that got through and for the time others spent tracing it. The checks were right all along, and I’m going to start trusting them.