feat: durable mutation queue (schema 59)
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m24s
Foundation / postgres-tools (push) Successful in 1m31s
Foundation / server-image (push) Successful in 4m25s
Foundation / image (push) Successful in 4m50s

A mutation choice's reserved tick is now the earliest tick it may bind
at, not the only one (ADR-0121 amendment). With write-behind commits, a
choice reserved for head + 1 landed in ticks already being simulated or
committed: the batch was refused, or the reservation was orphaned for a
past tick and stalled the region.

Schema 59: a bound record carries the tick it applied at and the rest of
its input must equal the reservation's; the "omits a reserved mutation"
refusals are removed. Existing rows are unchanged, so an orphaned
reservation binds at the next commit that carries it.

The host keeps every unbound reservation queued and the open batch binds
those the commit in flight does not carry, at its next tick; the earlier
hold on new choices is removed. A choice that outlives its life binds as
life_died (owner, trace matching and recovery accept it when no life with
that ID remains). Recovery takes a bound choice's tick from its trace.

Tests: a choice skipped by one checkpoint binds a tick late and recovers;
builder late binding, refusal before the earliest tick, and a departed
life's life_died outcome. Full local PostgreSQL qualification passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-22 10:27:09 -04:00
co-authored by Claude Opus 5.5
parent 8a7e944942
commit 71d195d4e8
17 changed files with 409 additions and 114 deletions
@@ -131,3 +131,28 @@ the later 11.4d client action and review UI are complete.
extends v10 before any v10 server reaches DEV; v1-v9 are unchanged.
- Remaining after this: the client choice and review UI (maintainer) and the
11.4d playtest notes.
## Amendment: durable mutation queue (schema 59, 2026-10-22)
The exact-tick rule above assumed that reserving a choice and committing a batch were
serialized on one connection, one tick at a time. Rules-12 regions commit a batch of
ticks on a background thread while the next batch is simulated (ADR-0178 follow-up), so
a choice reserved for "head + 1" could land in ticks already simulated or being
committed. The batch was then refused (losing its ticks), or, when the commit's check ran
before the reservation committed, the reservation was left for a tick that had passed
and stalled the region on DEV (tick 9752).
- A reservation's tick is now the earliest tick the choice may bind at. The region
binds a queued choice at the first tick it simulates after admitting it; the
mutation record carries the tick it bound at, and the rest of its input must equal
the reservation's. Stored rows are unchanged, so a reservation whose tick already
passed binds at the next commit that carries it.
- The "omits a reserved mutation" refusals are removed: an unbound reservation waits in
the queue. The host keeps every unbound reservation queued (and reloads them on
recovery), and the open batch binds those the commit in flight does not carry.
- A choice can outlive its life while it waits. Its selection then names a life that is
gone; the owner records `life_died` and changes nothing, and trace matching and
recovery accept such a selection when no life with its ID remains.
- Recovery takes each bound choice's tick from its trace selection, not from the stored
input.
- Births still enter only a fresh batch on the durable head.