Refused a Deploy That Did Not Exist
Written later and filed to this date, as part of filling in every day of the year.
7,982 minutes of a deploy job saying REFUSED, every five minutes, with the site already serving exactly what it would have deployed.
The job runs on the box on a five-minute timer and has two things it will not deploy over. A dirty working tree means a build agent is probably mid-feature, and a tree checked out on a branch other than main means someone parked it there. Both used to fail outright, which painted the unit failed through every ordinary working session, and the box’s security watcher reported it as an unexplained failure. So they became deferrals: exit cleanly, log DEFERRED, try again next tick, each condition on its own clock. Past four hours a deferral turns into a real refusal, because a repository left off main indefinitely means deploys have quietly stopped, and that is worth hearing.
The ceiling was right. What it was attached to was not. The job decided whether there was anything to do by asking whether its checked-out head, the remote main and the last deployed commit were all the same commit. With the tree parked on a branch the first of those could never match, so the job never concluded that it was idle, fell through to the branch clock, and four hours later started refusing. It went on refusing for five and a half days. The unit read failed the whole time. The repair daemon spent both of its daily re-runs on it, and the security watcher raised its warning, over a deploy that did not exist: remote main had not moved since the last one.
The fix asks the only question that matters on a branch: is remote main already deployed? If it is, there is nothing to do, wherever the tree happens to be. On main, the head moving still counts, so a commit made on the box still triggers a rebuild. The branch clock was left exactly as it was. It still counts from the moment the tree left main, so a repository parked for days refuses the instant main does move, which is the one case the ceiling was written for.