updates: durable-attempt-state — persist the ADR 0067 budget across restarts (#74 ruling + S12) #146

Closed
opened 2026-07-26 23:02:18 +00:00 by ben · 1 comment
Owner

Parent

Feature spec: #17 (provisioning/P4b updates). Filed by the 2026-07-26 wireframe-vs-built rulings (origin ticket #74) plus spec finding S12 from the same review sweep. Ruling: persist — the durability clause stands.

#74's spec requires durable attempt state, but internal/update has zero file I/O: the ADR 0067 attempt budget ("rolled back twice → quarantined, no further automatic attempts") lives only in memory. An agent restart forgets the first failed attempt and resets the quarantine budget — and a restart is most likely exactly during a failing update. The UI half was #112 (closed); nothing owns this seam half.

What to build

  1. Persist tracked-release state — attempt counts, quarantine, history — with the JSON load/mutate/save store shape the founding/rescue packages use (note: #141 go:dedupe-and-types extracts a shared store helper; use it if it has landed, otherwise match the shape). Add a restart test: two rollbacks, restart (new store over the same file), assert the release is still quarantined and no further automatic attempt runs.
  2. Spec finding S12 (internal/update/rollback.go:102): RetryByHand bypasses the maintenance-window queue guard. Reconcile against #74/#62's clauses — if by-hand retry is meant to run immediately, encode that reading in a comment + test; if it must queue for the window, fix it. Read the origin tickets; do not guess.

Acceptance criteria

  • Given a release has rolled back twice, when the agent restarts, then the release is still quarantined and no automatic attempt runs (restart test over the persisted store).
  • Given a release has rolled back once, when the agent restarts, then the second failure still quarantines (the budget survives).
  • RetryByHand's maintenance-window behaviour matches #74/#62's spec text, with a test encoding the ruling either way.

Blocked by

None (soft note on #141's shared store helper — use it if present).

Task manifest

task: updates:durable-attempt-state
implements_flow: p4b-updates
implements_edge: "U3→U4x attempt budget durable across agent restarts (ADR 0067)"
wireframe: none — seam-side durability; the surfaces are built
interface: "a persisted store behind internal/update's existing faces; no API shape change"
seam: "Go tests: restart-survival of attempt/quarantine state; RetryByHand window behaviour per spec"
acceptance: "#74's durable-attempt-state clause becomes true; S12 resolved against the spec text"
depends_on: []
out_of_scope: [U-screen UI (built, #112), rollout mechanics (built)]
needs_human_decision: []
## Parent Feature spec: #17 (provisioning/P4b updates). Filed by the 2026-07-26 wireframe-vs-built rulings (origin ticket #74) plus spec finding S12 from the same review sweep. Ruling: **persist** — the durability clause stands. #74's spec requires durable attempt state, but `internal/update` has zero file I/O: the ADR 0067 attempt budget ("rolled back twice → quarantined, no further automatic attempts") lives only in memory. An agent restart forgets the first failed attempt and resets the quarantine budget — and a restart is most likely exactly during a failing update. The UI half was #112 (closed); nothing owns this seam half. ## What to build 1. Persist tracked-release state — attempt counts, quarantine, history — with the JSON load/mutate/save store shape the founding/rescue packages use (note: #141 go:dedupe-and-types extracts a shared store helper; use it if it has landed, otherwise match the shape). Add a restart test: two rollbacks, restart (new store over the same file), assert the release is still quarantined and no further automatic attempt runs. 2. Spec finding S12 (`internal/update/rollback.go:102`): `RetryByHand` bypasses the maintenance-window queue guard. Reconcile against #74/#62's clauses — if by-hand retry is meant to run immediately, encode that reading in a comment + test; if it must queue for the window, fix it. Read the origin tickets; do not guess. ## Acceptance criteria - [ ] Given a release has rolled back twice, when the agent restarts, then the release is still quarantined and no automatic attempt runs (restart test over the persisted store). - [ ] Given a release has rolled back once, when the agent restarts, then the second failure still quarantines (the budget survives). - [ ] RetryByHand's maintenance-window behaviour matches #74/#62's spec text, with a test encoding the ruling either way. ## Blocked by None (soft note on #141's shared store helper — use it if present). ## Task manifest ```yaml task: updates:durable-attempt-state implements_flow: p4b-updates implements_edge: "U3→U4x attempt budget durable across agent restarts (ADR 0067)" wireframe: none — seam-side durability; the surfaces are built interface: "a persisted store behind internal/update's existing faces; no API shape change" seam: "Go tests: restart-survival of attempt/quarantine state; RetryByHand window behaviour per spec" acceptance: "#74's durable-attempt-state clause becomes true; S12 resolved against the spec text" depends_on: [] out_of_scope: [U-screen UI (built, #112), rollout mechanics (built)] needs_human_decision: [] ```
Author
Owner

Done in 666dad1 (on origin/main).

Durable attempt state (#74 / ADR 0067): internal/update's Store now persists its whole standing document (policy, current, tracked releases with attempt counts + quarantine state, history, last-checked) behind a new Backend — the JSON single-writer load/mutate/save shape founding/rescue use (#141's shared helper had not landed, so the shape is matched, not imported). Adds StoreDoc, OpenStore, MemoryBackend/FileBackend (atomic temp-file rename), and SchemaVersion refuse-or-migrate (ADR 0050). Poll, the rollback (recordFailure), the applied path, and EndEarly (now (bool, error)) persist on every durable mutation; NewStore stays memory-only for the see-state/review/policy seam tests.

Restart tests (rollback_test.go, over a real temp file): two rollbacks → restart (new store over the same file) → still quarantined, no further automatic attempt, no rollback runs; one rollback → restart → the next failure is still attempt 2 and quarantines (the budget survives). Plus store_test.go: seed-then-resume, newer-schema refusal, last-checked persistence.

S12 (rollback.go:102): ruled intended — RetryByHand bypassing the maintenance-window gate is what #74's spec text ("retry it by hand without waiting for the second failure", story 35) and ADR 0015 (the operator is never overridden) require; the window gate defers only automatic retries. Encoded in a strengthened doc comment + TestRollback_RetryByHand_RunsImmediately.

wireframe: none — seam-side durability; the UI half was #112 (built). Not run locally (no go/nix toolchain in the sandbox); the seam suite runs in CI inside nix develop. STATUS.md updated (header + milestone log).

Done in `666dad1` (on `origin/main`). **Durable attempt state (#74 / ADR 0067):** `internal/update`'s `Store` now persists its whole standing document (policy, current, tracked releases with attempt counts + quarantine state, history, last-checked) behind a new `Backend` — the JSON single-writer load/mutate/save shape founding/rescue use (#141's shared helper had not landed, so the shape is matched, not imported). Adds `StoreDoc`, `OpenStore`, `MemoryBackend`/`FileBackend` (atomic temp-file rename), and `SchemaVersion` refuse-or-migrate (ADR 0050). `Poll`, the rollback (`recordFailure`), the applied path, and `EndEarly` (now `(bool, error)`) persist on every durable mutation; `NewStore` stays memory-only for the see-state/review/policy seam tests. **Restart tests** (`rollback_test.go`, over a real temp file): two rollbacks → restart (new store over the same file) → still quarantined, no further automatic attempt, no rollback runs; one rollback → restart → the next failure is still attempt 2 and quarantines (the budget survives). Plus `store_test.go`: seed-then-resume, newer-schema refusal, last-checked persistence. **S12 (`rollback.go:102`):** ruled *intended* — `RetryByHand` bypassing the maintenance-window gate is what #74's spec text ("retry it by hand without waiting for the second failure", story 35) and ADR 0015 (the operator is never overridden) require; the window gate defers only *automatic* retries. Encoded in a strengthened doc comment + `TestRollback_RetryByHand_RunsImmediately`. `wireframe: none` — seam-side durability; the UI half was #112 (built). Not run locally (no go/nix toolchain in the sandbox); the seam suite runs in CI inside `nix develop`. STATUS.md updated (header + milestone log).
ben closed this issue 2026-07-27 08:01:25 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#146
No description provided.