Skip to content
Toolkit

ADR-0113 — A fact is stamped, a transition is handed a clock

Status: Accepted · Date: 2026-08-30 · Track: 009 URL lifecycle, phase 01 · Extends: ADR-0089

Context

009's routine carries one rule the four tracks before it did not need: the clock is injected, never waited for. Every previous track could prove its bar by doing a thing and looking at the result. This track's subject is elapsed time, and there are only two ways to test that — wait, which produces a suite nobody can run, or hand the code a clock the test can set.

Phase 00 turned that rule into gate rule L5: no file that writes an enforced lifecycle row may call time.Now(). Phase 01 then had to write the first one.

links.last_used_at (000038) records when a resource was last used — the latest of its creation, its last edit and its last recorded click. It is maintained in two places, and both stamp it with the database's own NOW(), exactly as links.datetime and links.last_datetime have since 000001. Under L5 as phase 00 wrote it, that row could never be enforced: the rule made no distinction between recording that something happened now and deciding that enough time has passed.

Decision

A fact is stamped by the database at the moment the thing happens. A transition is handed a clock.

The ledger already distinguishes a row's kind, so the gate follows it:

  • A fact row — one stored reading that other rows compare against — is exempt from L5. NOW() in the statement that records a click is the wall clock used correctly; there is nothing for a test to move, because the test causes the event whose moment is recorded.
  • A state or a notice row is not exempt, and is what L5 exists for. Such a row's writer decides that a window has elapsed, and that decision is the one a test cannot make true except by waiting. It reads a clock it is handed and a threshold it is given (L4), so the test sets both.

The same phase found a second gap. last_used_at has two writers — the click path and the edit path — because a visitor arriving and an owner working are both use. A ledger row that names one writer does not notice the other being deleted: with only the click path named, removing the stamp from the edit path leaves the gate green and the product silently releasing URLs their owners were editing last week. So a dependency in the lifecycle ledger may be one {file, anchors} or a list of them, and the gate checks every entry.

Consequences

  • Phase 02's transitions cannot be written the way phase 01's maintenance was. They take a clock and a threshold; L5 and L4 refuse them otherwise, and both rules were watched failing on that exact input.
  • The exemption is narrow by construction: it follows the ledger's kind, which is committed data a reviewer reads in the diff. A row cannot buy the exemption by changing its writer — only by claiming to be a fact, which the same diff shows.
  • Naming every writer is the ledger's deleted-reader rule pointed at the other end of the row. It costs a line per writer and it is the only thing standing between a half-maintained fact and a clock that takes something.
  • A test that needs an old resource backdates a row rather than sleeping. Phase 01's suite does exactly that, and a test that sleeps stays what 009's routine calls it: a test that will be deleted for flaking.

Source: docs/decisions/0113-a-fact-is-stamped-a-transition-is-handed-a-clock.md

Library