mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 05:30:18 +01:00
* fix(reconciler): make a stale verdict survive being asked twice
Two dry runs twenty-five minutes apart disagreed about datacat. The second
called it STALE and would have dispatched a deploy; the same code path, re-run
immediately afterwards against the same unchanged tip, said DEPLOYED — and the
tip did have a successful Deploy run for its exact SHA, from 05:22 that
morning. Nothing about the repo changed across the three reads.
The likeliest mechanism is the one behind every other bug in these two files:
`actions/workflows/{file}/runs` is eventually consistent, and a reply from a
lagging replica that omits the newest run is indistinguishable from a repo that
never deployed. A window is not an absence; neither is a stale replica.
A wrong STALE is not a wrong report here — it is a redundant deploy of a repo
that is already live, which on a client site is a real production event
triggered by a phantom. So the verdict is re-read immediately before acting and
must still be STALE. Two reads is not a proof, since a replica can lag twice,
but it converts a common transient into a rare one for one API call per repo
actually being shipped. A re-check that cannot be read is not a confirmation
and so is not a deploy.
Dry run after the change: 21 surveyed, 0 to ship, datacat no longer flagged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
* feat(reconciler): re-run CI for a tip that can never go green
loki today: concurrency cancelled BOTH CI runs for main's tip, so all SIX of
its Deploy runs `skipped` — the chained trigger requires
`workflow_run.conclusion == 'success'`, and that green run could never appear,
because nothing in the fleet re-runs a cancelled CI. The tip sat unshipped for
over two hours and would have sat there indefinitely.
shouldDispatch refuses to deploy that, and the refusal is right: shipping an
unverified tip to clear a stalled deploy turns a stall into a bad release. But
refusing is not repairing. A reconciler that only ever declines leaves the repo
exactly as stuck as it found it.
Re-running CI is the remedy that matches the fault, and it is a categorically
cheaper action than deploying: it publishes nothing, changes nothing on the box,
and is idempotent. If it goes green the ordinary chain ships the tip; if it goes
red, the tip SHOULD be stuck and now says so out loud.
It fires only on the no-green-run case. Not on a RED tip — a broken build is not
repaired by running it again, and retrying red every half hour is a CI
amplifier, not a fix. Not while a run is in flight. Not on a repo that is live
or still inside the window. Capped at 3, deliberately tighter than the deploy
cap of 5: a stalled deploy is self-limiting, an org-wide CI re-run loop is not.
The CI workflow filename is discovered per repo (ci.yml, else the workflow whose
`name:` is CI) rather than assumed — hardcoding it would silently re-run nothing
in the repos that spell it differently, the same shape as hardcoding `main` as
the default branch, which reported two repos as never deployed.
25 assertions, 4 mutants killed: re-running a red tip, ignoring the in-flight
guard, making the repair inert, and re-running already-deployed repos. The live
path is not exercised by the dry run because no repo is currently stuck that
way — loki was repaired by hand before this existed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>