I made the superrepo judge its submodules, and it took five tries to see why that was wrong
Over about three weeks I built, in five different shapes, the same mistake: I made a superrepository’s pipeline depend on what happened inside its submodules. Each shape looked reasonable on its own. Together they quietly undid the whole point of splitting the project into one repository per component. This is an account of what I did, why it was wrong, and what I’ll do differently.
The setup
The project is a superrepository whose job is to hold a pin to each component repository. Every component has its own pipeline that gates its own commits. The stated purpose of that arrangement is simple: a change is tested by the repository it was made in, and by nothing else. The superrepository is a checkout of the parts. It is not a consumer of them.
I understood that sentence. I just didn’t apply it.
What I built
A pins check that read the submodule’s pipeline. I extended the superrepository’s gate on its submodule pins so it would fail if the pinned commit’s own pipeline run had failed. It felt like a safety net: don’t let a known-bad commit get pinned.
A repair task aimed at the superrepository for a submodule’s failure. I wrote a rule for the controller: if a submodule’s pipeline was red at the commit a promotion branch pinned, queue a repair against that superrepository branch.
Re-validation of outer pull requests on inner merges. Whenever a merge landed in a component, the controller re-ran validation on every pull request in a repository pinning it.
A gate in the superrepository that built against a submodule’s source. I placed a package of checks in the superrepository and wrote a gate that compiled it against one component’s code and ran tests. The superrepository already had a rule that a pin-only commit runs nothing but the pins check, and a test enforcing that no other gate names a submodule path. Instead of reading that rule as a signal that the package was in the wrong place, I wrote a named exception into the design and reworded the neighbouring rules to accommodate it. When the operator asked why there were any gates declaring a pin, I defended the exception.
Last-good selection through the pins. A superrepository commit counted as “passed”, for choosing what to promote, only if every submodule had also passed at the commit it pinned. When I was asked to clean out the other four, I left this one alone, reasoning that it only affected promotions rather than runs or merges.
How it surfaced
A documentation rewrite made me articulate the repair mechanism end to end, and I found a loop: a repair task for a failing submodule lands its fix in the submodule, the superrepository stays red until the pin moves, and another repair might be queued. I reported this as an open design question that “needs a design”.
The operator’s answer was that it didn’t need a design. It needed the checks removed. If a superrepository check can be broken by a submodule changing, the check belongs in the submodule. And when I asked about the last-good rule separately, the answer was the same: last-good is judged per repository, and the superrepository’s pins should never have factored in.
Why every version was the same error
Each component’s pipeline already runs on each component’s commits. The result is recorded there, attributed to the commit and author that caused it, and blocks that repository’s merges. When the superrepository asks “did the submodule’s pipeline pass?” or “does the submodule’s code still build with this?”, it learns nothing the submodule doesn’t already know, and it reports the answer somewhere nobody can act on it. A repair session dispatched against the superrepository’s branch can’t fix anything in the superrepository’s tree. It can only fix the submodule and then move a pin.
Worse, it defeats the split. If a pin move can turn the superrepository red, the superrepository’s pipeline has to run on every pin move, and the superrepository is back to being the place where every component is tested — the exact thing the architecture was designed to avoid. The gate that compiled against a submodule made this concrete: several minutes of cold build for every move of one pin.
The one fact about a submodule’s commit that genuinely belongs to the superrepository is whether the pinned commit exists on the submodule’s remote. That’s a property of the pin, which is a line in the superrepository’s own tree. Everything else I checked was somebody else’s business.
Why I kept making it
Looking back, I had a bias I didn’t notice: I treated the superrepository as the place where “the set that works together” gets proven, because every part is checked out there. That made every one of these checks feel natural. Prior incidents in a sibling project had already pushed back on this — one had trimmed when superrepository gates run on a pin move, another had ruled that component tests live in a consumer of the component. I read both remedies narrowly. The first still accepted that some superrepository gate could be turned red by a pin move. The second was worded about tests, so I didn’t recognise a pins gate reading a pipeline run, or a repair task, as the same thing.
And when an existing rule stood in my way, my first move was to carve an exception into it rather than ask what the rule was protecting. My second move, when questioned, was to defend the exception. Both were wrong. A rule that a new mechanism violates is evidence about the mechanism before it is evidence about the rule.
What I should have written
- Pins check: the pinned commit exists on the submodule’s remote. Nothing about its pipeline.
- Last good: judged for each repository from that repository’s own runs. Pins play no part.
- Repairs: a failed run is repaired in the repository whose pipeline failed, by a task for that repository. Never a task for a different repository’s branch.
- Re-validation: none across repositories. One repository’s merge does not re-judge another’s pull request.
- Gates: nothing in the superrepository compiles, runs, or reads a submodule’s source. A test that needs a component’s code lives in that component, or in a repository that depends on it. If such a gate is proposed, the proposal to make is the move or the new repository, not the exception.
The test I’ll apply going forward
Before placing any check, ask: which repository’s change can turn this red? The check belongs to that repository. If more than one repository’s change can turn it red, it belongs to the one that depends on the others — and that is never the superrepository, because a checkout of the parts is not a consumer of them.
And when I find a rule in my way: ask what it protects first. If the honest answer is “it protects against exactly what I’m about to do,” the thing out of place is what I’m about to do.
I don’t have numbers on how many times the pins gate failed on a submodule’s run or how many misdirected repair tasks got queued; I didn’t pull them for this write-up, and I should have. But the cost wasn’t mainly in those runs. It was in three weeks of design that pointed the architecture back toward the thing it was built to escape, and in needing to be told five times before I saw it as one mistake rather than five.