Complete M7.3 fenced region ownership

ADR-0060 and schema v2 add database-time region leases and a fenced head
advance. Acquire/renew/release/advance lock the lease row, check holder,
epoch and expiry with clock_timestamp() after the lock wait, and the
advance compares the exact predecessor. Holders are DB-generated tokens;
epochs never wrap or repeat. The runtime group role gets EXECUTE on five
SECURITY DEFINER functions only - no table, provisioning or CREATE rights.
Migration history admits clean->v2, v1->v2 and a v2 no-op, and refuses
privileged runtime roles.

Host side: portable LeaseAuthority fences from send-time deadlines on
CLOCK_BOOTTIME, keeps the earlier deadline on unknown renewal and stays
fenced until a newer epoch. Selected timings: 20s lease, 5s renew, 2s
margin, 2s renew and 5s commit deadlines. Linux evo::postgres wraps the
functions with typed LeaseStoreError results.

Validated: Windows CTest 55/55; WSL Release, clang-tidy and ASan/UBSan
private-PostgreSQL suites (contenders, expiry, paused/queued stale
writers, unknown renewal, exhaustion, bypass denial, upgrade path).
Three SQL mutations were each caught. Docker/Gitea CI, remote TLS and
cluster runs were not executed. No director, host or deployment added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-28 11:14:32 -04:00
co-authored by Claude Opus 5.5
parent 598b3938e6
commit 2496649a9b
22 changed files with 1501 additions and 29 deletions
+11 -2
View File
@@ -48,8 +48,10 @@ process may retain memory but cannot publish a head or originate current output.
The gateway must have bounded-validity registration, not just an epoch number.
M7 has no gateway implementation; readiness alone does not prove remote fencing.
Lease duration, renewal cadence, local safety margin and store deadlines must be
selected/measured at M7.3 together; no arbitrary timing values are locked here.
M7.3 selected lease duration, renewal cadence, local safety margin and store
deadlines together in ADR-0060 (20 s / 5 s / 2 s / 2 s renew / 5 s commit). The
latency behind them was measured only on a local socket. The database functions
and runtime grants in migration v2 implement the guard described here.
Any uncertain lease stops admission, simulation and final output. A commit that
already linearized can remain durable after its writer expires; query can return
its receipt, but does not grant that writer authority to resume.
@@ -159,3 +161,10 @@ resurrect acknowledged deaths. World0 stays gated.
M7.1 verification is a source/state inventory and contract review. Real database,
object-store, process-kill and network partition tests are still required.
M7.3 executed its rows against real PostgreSQL. After lease expiry, a new owner
acquires a newer epoch. The old writer's renew, release and head advance are then
rejected, and the head is unchanged. A paused stale worker resuming past its lease
is fenced both locally and by the database. A writer queued on the lease lock past
expiry is also rejected. These are in-process pauses, not killed pods or network
partitions. The 7.6 parts of those rows remain open.