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
+12 -3
View File
@@ -134,6 +134,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
SELECT :'history_v55' || ',56:' || :'migration_sha_56' AS history_v56 \gset
SELECT :'history_v56' || ',57:' || :'migration_sha_57' AS history_v57 \gset
SELECT :'history_v57' || ',58:' || :'migration_sha_58' AS history_v58 \gset
SELECT :'history_v58' || ',59:' || :'migration_sha_59' AS history_v59 \gset
SELECT :'history' = :'history_v22' AS at_v22,
:'history' = :'history_v23' AS at_v23,
:'history' = :'history_v24' AS at_v24,
@@ -170,8 +171,10 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
:'history' = :'history_v55' AS at_v55,
:'history' = :'history_v56' AS at_v56,
:'history' = :'history_v57' AS at_v57,
:'history' = :'history_v58' AS at_v58 \gset
\if :at_v58
:'history' = :'history_v58' AS at_v58,
:'history' = :'history_v59' AS at_v59 \gset
\if :at_v59
\elif :at_v58
\elif :at_v57
\elif :at_v56
\elif :at_v55
@@ -581,7 +584,8 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
coalesce(max(version), 0) = 55 AS at_v55,
coalesce(max(version), 0) = 56 AS at_v56,
coalesce(max(version), 0) = 57 AS at_v57,
coalesce(max(version), 0) = 58 AS at_v58
coalesce(max(version), 0) = 58 AS at_v58,
coalesce(max(version), 0) = 59 AS at_v59
FROM evolution.schema_migrations \gset
\if :at_v24
\ir 0025_cellular_v2_bundle.sql
@@ -808,6 +812,7 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
\elif :at_v56
\elif :at_v57
\elif :at_v58
\elif :at_v59
\else
\echo 'Unknown or changed migration history after v43'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
@@ -872,6 +877,10 @@ SELECT coalesce(max(version), 0) = 57 AS needs_v58 FROM evolution.schema_migrati
\if :needs_v58
\ir 0058_liquid_bundle.sql
\endif
SELECT coalesce(max(version), 0) = 58 AS needs_v59 FROM evolution.schema_migrations \gset
\if :needs_v59
\ir 0059_durable_mutation_queue.sql
\endif
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC
-- grants or SET-able memberships would bypass the fenced functions. Checks the