Skip to content
Toolkit

ADR-0117 — A rung is claimed off the rung below, and a failed one is handed back to it

Status: Accepted · Date: 2026-08-30 · Track: 009 URL lifecycle, phase 03 · Supersedes: nothing · Related: 0114, 0115, 0116

Context

ADR-0116 landed the first notice and, with it, the mechanism: a notice is a claim, marked in the statement that selects the rows due, so the second run of the day sends nothing and a failed send hands its rung back. That first rung is claimed off an empty column — lifecycle_notice IS NULL — which is the only precondition available when nothing has been said yet.

The second notice is the first one with something below it, and it raises two questions the first could not.

What orders the ladder? The obvious answer is the windows: quiet at 90 days, the warning at 104, the final at 118. But the windows are configuration, and configuration is the owner's (Blocker 3). A deployment that sets LIFECYCLE_NOTICE_WARNING_DAYS=80 has not asked for a warning before the quiet notice — it has made a mistake — and an ordering that lives only in the arithmetic between two numbers cannot tell the difference. Worse, the failure is silent and lands on a person: an owner is told their address is about to be given away, having never been told the resource went quiet.

Where does a failed claim go? ReleaseNoticeClaim clears the column, which is right for the first rung: nothing was said, so the resource stands on nothing. Applied to the second rung it is wrong in a way that looks like recovery. The resource drops off the ladder entirely, the next run sees an empty column, and it sends the quiet notice again — a message that owner already has. The ladder then re-climbs from the bottom while the windows it is measured against have already passed, which is how at-least-once turns into the storm ADR-0116 exists to prevent.

Decision

A later rung's precondition is the rung below it, as a stored fact. ClaimNoticeRung(rung, requires, cutoff, at) claims with WHERE lifecycle_state = 'notified' AND last_used_at < cutoff AND lifecycle_notice = requires. The warning requires quiet; the final will require warning. No window setting can reorder the ladder, because the order is not a comparison — it is a precondition on a column. A deployment that runs the warning task and never the quiet one sends nothing at all, which is the correct behaviour and needs no coordination between the tasks.

A failed rung is handed back to the rung below, never to nothing. RestoreNoticeRung(linkID, claimed, previous) steps the column down one, scoped to the rung it is giving back so a restore arriving after something else has moved the resource on changes nothing. The next run claims the same rung again; no earlier notice is re-sent.

The state scope is part of the sentence. This notice says the resource still serves and will stop, so it is claimed only for notified rows. A resource that has already lapsed is not owed it — that is the next rung's business — and a product that warns somebody about a future it has already delivered has stopped describing itself accurately.

lifecycle_notice_at records when the ladder last moved, not when the current rung was successfully sent. A restore leaves it where the claim put it, because the original send's moment is not recoverable and nothing computes a window from it: every notice window is measured from last_used_at.

ADR-0116's rule about what a notice may say carries up unchanged. Armed, the warning states both dates — when the resource stops serving, and when its address becomes available — each computed from the windows the service was handed. The second is counted from the lapse, not from last use, the same consecutive-windows rule ADR-0115 set for the release transition itself; folding them would name a date a month early. Disarmed, the notice is a second report of quiet and promises nothing, title included.

Consequences

  • The final notice inherits this shape whole: requires: warning, its own window key, and a restore that steps down to warning. It is the last rung, so it is also the last place this can go wrong cheaply.
  • The first rung keeps its own statement. Its precondition is an empty column rather than a rung, which is a different predicate and not worth unifying into one method with a nullable argument.
  • Two claim paths now write lifecycle_notice, and both are claims: neither returns a row it has not already marked.
  • The gate refused the first version of this slice's ledger row, and correctly: naming cron_tasks.go as a writer trips L5, because that file carries three pre-existing tasks that compute their cutoffs from time.Now(). The task registration is a scheduler, not a writer of the row; the writer is the service that is handed a clock. Rule L5 is file-scoped and this is the shape that keeps it meaningful.

Source: docs/decisions/0117-a-rung-is-claimed-off-the-rung-below-and-a-failed-one-is-handed-back-to-it.md

Library