provisioning: updates-rollback-quarantine — scope-matched auto rollback, retry budget, quarantine #74

Closed
opened 2026-07-25 04:58:09 +00:00 by ben · 1 comment
Owner

Parent

Feature spec: #17 (provisioning).

What to build

The failure side of the P4b rollout, driven by the update orchestrator seam.
When a health check fails during a rollout, the update is rolled back
automatically at the matching scope — a NixOS generation at the host, an earlier
exact revision at the runner, a rolling container bump for a service — and the
fleet returns to its previous revision, healthy (P4b-U4x). A rolled-back update is
retried once at the next maintenance window with the same exact closure. On a
second consecutive failure it is quarantined (ADR 0067): no further automatic
attempts, surfaced at the top of Updates with the failing node and its logs.
Quarantine overrides auto-apply for that release, yet never blocks later releases —
a newer release on the channel is not held back by it. And a rolled-back update
offers the operator manual control: end the attempts early, or retry it by hand
without waiting for the second failure.

Notes: rollback is scope-matched — host generation, runner exact-revision, service
container bump — never a git revert of a non-tip. Attempt state is durable and
survives a control-plane restart. This slice was split from the former
updates-rollout-rollback at the U4/U4x line (to-tickets granularity gate,
2026-07-25). Flow: docs/ux/flows/p4b-updates.mermaid.

Acceptance criteria

  • (story 33) Given a health-check failure during rollout, when it fails, then the update is rolled back automatically at the matching scope — NixOS generation at the host, an earlier exact revision at the runner, a rolling container bump for a service — and the fleet returns to its previous revision, healthy.
  • (story 34) Given a first rollback, when the next maintenance window comes, then the same closure is retried once.
  • (story 35) Given a second consecutive failure, when it rolls back again, then the release is quarantined — no further automatic attempts — and surfaced at the top of Updates with the failing node and its logs.
  • (story 35) Given a quarantined release, when later releases arrive on the channel, then they are not blocked by it; and quarantine overrides auto-apply for the quarantined release.
  • (story 35) Given a rolled-back update, when the operator chooses, then they can end the attempts early or retry it by hand without waiting for the second failure.

Blocked by

  • #70 — rollback branches off the rollout

Task manifest

task: provisioning:updates-rollback-quarantine
implements_flow: p4b-updates
implements_edge: U3→U4x, U4x→U3, U4x→U1
wireframe: docs/ux/wireframes/p4b-updates/p4b-u4x-rolled-back.html
interface: "`update` orchestrator seam — on a health-check failure, rolls back automatically at the matching scope (host generation / runner exact-revision / service container bump); retries the same closure once next window; after a second failure quarantines the release (ADR 0067) — durable attempt state, surfaced with failing node + logs, overriding auto-apply but never blocking later releases; manual end-early / retry-by-hand"
seam: "`update` orchestrator seam tests (control plane, Go) — fake channel, fake clock, fake `clan.Clan` (the three rollback scopes), per-service `HealthCheck` fakes that fail on command; asserts fail→retry→succeed, fail→retry→fail→quarantine, quarantine overriding auto-apply, a later release applying cleanly over a quarantined one, and manual end-early/retry"
acceptance:
  - given: a health-check failure during rollout
    when: it fails
    then: the update rolls back automatically at the matching scope (host generation / runner exact-revision / service container bump) and the fleet returns to its previous revision, healthy
  - given: a first rollback
    when: the next maintenance window comes
    then: the same closure is retried once
  - given: a second consecutive failure
    when: it rolls back again
    then: the release is quarantined (no further automatic attempts), surfaced at the top of Updates with the failing node and its logs, overriding auto-apply but not blocking later releases
  - given: a rolled-back update
    when: the operator chooses
    then: they can end the attempts early or retry it by hand without waiting for the second failure
depends_on: [updates-rollout-happy]
out_of_scope:
  - "story 28–32 the happy-path rollout to applied — updates-rollout-happy's"
  - "story 36–38 policy and channel — updates-policy-channel's"
needs_human_decision: []
## Parent Feature spec: #17 (provisioning). ## What to build The failure side of the P4b rollout, driven by the `update` orchestrator seam. When a health check fails during a rollout, the update is rolled back automatically at the matching scope — a NixOS generation at the host, an earlier exact revision at the runner, a rolling container bump for a service — and the fleet returns to its previous revision, healthy (P4b-U4x). A rolled-back update is retried once at the next maintenance window with the same exact closure. On a second consecutive failure it is quarantined (ADR 0067): no further automatic attempts, surfaced at the top of Updates with the failing node and its logs. Quarantine overrides auto-apply for that release, yet never blocks later releases — a newer release on the channel is not held back by it. And a rolled-back update offers the operator manual control: end the attempts early, or retry it by hand without waiting for the second failure. Notes: rollback is scope-matched — host generation, runner exact-revision, service container bump — never a `git revert` of a non-tip. Attempt state is durable and survives a control-plane restart. This slice was split from the former updates-rollout-rollback at the U4/U4x line (to-tickets granularity gate, 2026-07-25). Flow: `docs/ux/flows/p4b-updates.mermaid`. ## Acceptance criteria - [ ] (story 33) Given a health-check failure during rollout, when it fails, then the update is rolled back automatically at the matching scope — NixOS generation at the host, an earlier exact revision at the runner, a rolling container bump for a service — and the fleet returns to its previous revision, healthy. - [ ] (story 34) Given a first rollback, when the next maintenance window comes, then the same closure is retried once. - [ ] (story 35) Given a second consecutive failure, when it rolls back again, then the release is quarantined — no further automatic attempts — and surfaced at the top of Updates with the failing node and its logs. - [ ] (story 35) Given a quarantined release, when later releases arrive on the channel, then they are not blocked by it; and quarantine overrides auto-apply for the quarantined release. - [ ] (story 35) Given a rolled-back update, when the operator chooses, then they can end the attempts early or retry it by hand without waiting for the second failure. ## Blocked by - #70 — rollback branches off the rollout ## Task manifest ```yaml task: provisioning:updates-rollback-quarantine implements_flow: p4b-updates implements_edge: U3→U4x, U4x→U3, U4x→U1 wireframe: docs/ux/wireframes/p4b-updates/p4b-u4x-rolled-back.html interface: "`update` orchestrator seam — on a health-check failure, rolls back automatically at the matching scope (host generation / runner exact-revision / service container bump); retries the same closure once next window; after a second failure quarantines the release (ADR 0067) — durable attempt state, surfaced with failing node + logs, overriding auto-apply but never blocking later releases; manual end-early / retry-by-hand" seam: "`update` orchestrator seam tests (control plane, Go) — fake channel, fake clock, fake `clan.Clan` (the three rollback scopes), per-service `HealthCheck` fakes that fail on command; asserts fail→retry→succeed, fail→retry→fail→quarantine, quarantine overriding auto-apply, a later release applying cleanly over a quarantined one, and manual end-early/retry" acceptance: - given: a health-check failure during rollout when: it fails then: the update rolls back automatically at the matching scope (host generation / runner exact-revision / service container bump) and the fleet returns to its previous revision, healthy - given: a first rollback when: the next maintenance window comes then: the same closure is retried once - given: a second consecutive failure when: it rolls back again then: the release is quarantined (no further automatic attempts), surfaced at the top of Updates with the failing node and its logs, overriding auto-apply but not blocking later releases - given: a rolled-back update when: the operator chooses then: they can end the attempts early or retry it by hand without waiting for the second failure depends_on: [updates-rollout-happy] out_of_scope: - "story 28–32 the happy-path rollout to applied — updates-rollout-happy's" - "story 36–38 policy and channel — updates-policy-channel's" needs_human_decision: [] ```
Author
Owner

Done — committed as be81c09.

Built the failure side of the P4b rollout on the update orchestrator seam (P4b-U3 → U4x, ADRs 0067/0017/0061).

What shipped

  • Scope-matched automatic rollback (story 33): a new clan.Clan.Rollback(RollbackRequest{Node, Scope, ToRevision}) verb with the three ADR 0017 RollbackScopes — RollbackGeneration (host, instant NixOS generation), RollbackRevision (runner, earlier exact revision), RollbackContainer (service, rolling container bump); never a git revert of a non-tip. On a health-check failure rollout returns every touched node to the fleet's previous revision, each at the mechanic matching how it is deployed (FleetNode.Scope), leaving the fleet healthy on its previous revision (store.current never moved off it).
  • Retry-once-then-quarantine budget (stories 34–35): durable per-release attempt state on the active record in the Store (survives a control-plane restart — not in memory). A first rollback stays applying so the next window retries the same exact closure once; a second consecutive failure → StateQuarantined, surfaced at the top of Updates with the failing node + check + attempts + logs (the see-state QuarantineView now written by the transition).
  • Quarantine overrides auto-apply but never blocks later releases (story 35): rollable refuses a quarantined revision (ErrNotRollable), Poll.knows never re-arms it, and a newer release rolls out cleanly over it.
  • Manual controls (story 35): EndEarly(rev) quarantines a rolled-back release now (the "Don't try again" button) without waiting for the second failure; RetryByHand(ctx, rev) retries immediately, bypassing only the window gate, still counting against the budget.

Tests (the manifest seam): 7 new update seam tests over a real clan.Fake (its new Rollbacks() recorder proving the scope-matched calls) + FakeFleet + fake clock — scope-matched rollback across all three touched-node scopes + fleet-returns-healthy, fail→retry→succeed, fail→retry→fail→quarantine + surfaced + overriding-auto-apply + later-release-applies-over-it, end-early, retry-by-hand-bypasses-window, by-hand-still-budget-bound — plus 2 clan fake tests (scope-matched recording, scripted fault).

Files: internal/clan/clan.go, internal/clan/fake.go, internal/clan/rollback_test.go (new), internal/update/rollback.go (new), internal/update/rollout.go, internal/update/rollback_test.go (new), docs/seams/clan.md, STATUS.md.

Note: the happy-path rollout (#70) is unchanged bar the failure hand-off; WithRollout untouched. gofmt-aligned; logic self-verified by reading — this sandbox has no Go toolchain, so go test/vet run in CI's nix develop.

Done — committed as `be81c09`. Built the failure side of the P4b rollout on the `update` orchestrator seam (P4b-U3 → U4x, ADRs 0067/0017/0061). **What shipped** - **Scope-matched automatic rollback** (story 33): a new `clan.Clan.Rollback(RollbackRequest{Node, Scope, ToRevision})` verb with the three ADR 0017 `RollbackScope`s — `RollbackGeneration` (host, instant NixOS generation), `RollbackRevision` (runner, earlier exact revision), `RollbackContainer` (service, rolling container bump); never a git revert of a non-tip. On a health-check failure `rollout` returns every touched node to the fleet's previous revision, each at the mechanic matching how it is deployed (`FleetNode.Scope`), leaving the fleet **healthy on its previous revision** (`store.current` never moved off it). - **Retry-once-then-quarantine budget** (stories 34–35): durable per-release attempt state on the active `record` in the `Store` (survives a control-plane restart — not in memory). A first rollback stays applying so the next window retries the **same exact closure once**; a second consecutive failure → `StateQuarantined`, surfaced at the top of Updates with the failing node + check + attempts + logs (the see-state `QuarantineView` now written by the transition). - **Quarantine overrides auto-apply but never blocks later releases** (story 35): `rollable` refuses a quarantined revision (`ErrNotRollable`), `Poll.knows` never re-arms it, and a newer release rolls out cleanly over it. - **Manual controls** (story 35): `EndEarly(rev)` quarantines a rolled-back release now (the "Don't try again" button) without waiting for the second failure; `RetryByHand(ctx, rev)` retries immediately, bypassing only the window gate, still counting against the budget. **Tests** (the manifest seam): 7 new `update` seam tests over a real `clan.Fake` (its new `Rollbacks()` recorder proving the scope-matched calls) + `FakeFleet` + fake clock — scope-matched rollback across all three touched-node scopes + fleet-returns-healthy, fail→retry→succeed, fail→retry→fail→quarantine + surfaced + overriding-auto-apply + later-release-applies-over-it, end-early, retry-by-hand-bypasses-window, by-hand-still-budget-bound — plus 2 `clan` fake tests (scope-matched recording, scripted fault). **Files**: `internal/clan/clan.go`, `internal/clan/fake.go`, `internal/clan/rollback_test.go` (new), `internal/update/rollback.go` (new), `internal/update/rollout.go`, `internal/update/rollback_test.go` (new), `docs/seams/clan.md`, `STATUS.md`. Note: the happy-path rollout (#70) is unchanged bar the failure hand-off; `WithRollout` untouched. gofmt-aligned; logic self-verified by reading — this sandbox has no Go toolchain, so `go test`/`vet` run in CI's `nix develop`.
ben closed this issue 2026-07-25 12:44:50 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#74
No description provided.