ADR-0115 — A name is held until it is released, and until now nothing held it
Status: Accepted · Date: 2026-08-30 · Track: 009 URL lifecycle, phase 02 · Extends: ADR-0114, ADR-0109
Context
The lifecycle's last transition is lapsed → released, and the ledger says its
reader is "the claim path: a released name can be taken". Writing it meant
finding that path.
There is no claim path. links.url carries no unique index — the only
unique index on the table is its primary key. None of the seven handlers that
create a link checks whether the address is already spoken for, and none of the
seven rename paths does either. GetLinkByURL resolves with
ORDER BY is_enabled DESC, link_id DESC LIMIT 1.
Those three facts compose into something worse than a missing feature. A second account creating a link at somebody else's slug does not collide with them — it replaces them. The newer row wins the address, and the owner's visitors are sent to the stranger's destination. Proved against a live database before any of this was written: two rows, two owners, one slug, and the resolver answers with the second one.
So the release transition could not land alone. A release with no claim path frees nothing, and a claim path with no release makes every name permanent.
Decision
1. A name is held by whoever holds it, in every state but released.
One repository read, SlugTaken, and one handler helper, refuseTakenSlug,
called at all fourteen write paths — seven creates and seven renames. A taken
address is refused with 409, and the refusal names nobody: that an address
is taken is public, since anyone can visit it, but who holds it is not, and a
refusal that says so answers a question the caller had no right to ask
(ADR-0109, ADR-0110).
lapsed holds its name. A lapse takes the serving away (ADR-0114) and leaves
the address with its owner; that is the whole distance between the two states.
2. The claim is scoped exactly the way resolution is.
COALESCE(domain_id, 0) = $2 is the same set GetLinkByURL matches, because a
row carries the default domain as either NULL or 0. A claim scoped any
narrower would call a name free and then resolve it to somebody else, which is
worse than not checking at all — it would be this defect with a green test
beside it.
3. A rename is a claim, and only a rename is.
The check runs when the address actually moves, comparing against the address as stored before the request touched it. Rows that already share a slug exist in every deployment of this product, and refusing to save one of them for a collision it did not create would make legacy data uneditable.
4. This is a check, not a constraint, and the difference is stated rather than hidden.
Two simultaneous creates of the same slug can still both pass. The fix is a
partial unique index on (url, COALESCE(domain_id, 0)) WHERE lifecycle_state <> 'released', and it cannot be added blind: a database with pre-existing
duplicates would reject the migration, so it needs the duplicate audit 004's
grandfathering did first. That is one open item, not this slice's.
A failed check refuses rather than allowing. This is the only thing between an author and somebody else's address; a database hiccup is not a reason to hand one over.
5. The release transition counts its window from the lapse.
lifecycle_state_at, not last_used_at. The charter's window is "so many days
after the lapse", and counting from last use would silently fold the lapse
window into the release window. Armed by ADR-0114's switch, disarmed by default.
Consequences
- A defect that predates this track — one account able to take over another's address — is closed on the write path in the same slice that needed the reader. It is the second time this track has found the thing it was about to build already broken in the tree.
- Nothing may arm the taking transitions yet. A released name is free to
anyone the moment it is released, and the window that makes it the former
owner's first is phase 05's
reclaim-window.LIFECYCLE_TAKING_ENABLEDis off, and phases 03 and 05 both have to land before it is turned on. That is now the switch's documented precondition, not a note. - The unique index is owed, and with it the duplicate audit that has to precede it.
- Phase 02 is complete:
active → notified → lapsed → released, each idempotent by its own predicate, each handed a clock, and each with a serving path that reads what it wrote.
Source: docs/decisions/0115-a-name-is-held-until-it-is-released-and-until-now-nothing-held-it.md