Add M10.8d two-process handoff fault matrix and recovery fixes
Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Failing after 10m4s
Foundation / checks (network) (push) Successful in 13m3s
Foundation / checks (tsan) (push) Successful in 7m53s
Foundation / checks (checks) (push) Successful in 32m18s
Foundation / checks (postgres) (push) Successful in 43m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

ADR-0096. Two real evo-server processes on PostgreSQL (regions 7/161 and
7/162, adjacent areas) run crossings and crossings back, SIGKILL of the
source after prepare and of the destination after stage and after commit,
duplicate and stale ticket retries, a client that never arrives and a
destination that is down. After every scenario SQL checks one owner per
probe, the conserved inventory and frozen-iff-open-transfer.

The matrix found two recovery gaps, now fixed:
- a source restarted after a prepare left the probe frozen for good (its
  abort deadline was in memory): schema v14 overdue_probe_transfers and a
  session-layer sweep abort open outgoing transfers past the ticket
  lifetime plus 10 s by the database clock;
- a ticket replayed at a restarted destination after the probe moved on
  took control back: admission of a committed transfer now requires the
  record as that commit left it.

M10.8 is complete. Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-06 23:17:49 -04:00
co-authored by Claude Opus 5.5
parent dabeee8e8b
commit 265163a9a6
26 changed files with 856 additions and 20 deletions
+47
View File
@@ -220,3 +220,50 @@ controllable before M11.
It passed 3 times in a row on Linux and also passes on Windows.
- The test fixture `tests/fixtures/fake_handoff_world.hpp` (the v12 state machine) is
shared by both handoff tests.
## M10.8d two-process fault matrix (2026-10-06)
Real evo-server processes on PostgreSQL found two recovery gaps. Both are fixed within this
ADR's decisions, with no change to the protocol or the ticket format:
- **A source restarted after a prepare left the probe frozen for good.** The abort deadline
for a client that never arrives was kept only in the source process's memory. Schema v14
adds `overdue_probe_transfers`: read-only, under the lease, it lists the caller's open
outgoing transfers prepared more than a given age ago by the database clock. Every
`overdue_poll` (5 s), sessions abort those older than the ticket lifetime plus 10 s,
whichever process prepared them. The in-memory deadline (lifetime plus 5 s) stays as the
fast path. Abort is serialized with the destination's stage and commit, so a transfer
committed meanwhile stays committed: clock skew can only delay an abort.
- **A ticket replayed at a restarted destination could take control back.** The
destination's used-ticket list is in memory. After its restart, a ticket for a transfer
committed earlier (still within its lifetime) was admitted durably even after the probe
had moved on: it moved the account's control away from the live owner and opened a
phantom probe. Ownership in the database stayed unique. `PostgresHandoffLedger::admit`
now admits a committed transfer only while the record is as that commit left it: owned
here, at the transfer's generation plus 1, and not frozen. Otherwise it refuses
(`unauthenticated`). An undecided retry right after the commit still converges.
Evidence: `tests/region_handoff_process_tests.cpp` (in `evo-postgres-tests`, regions 7/161
and 7/162 with adjacent areas, handoff keys and each other as neighbour), with these
scenarios:
1. A crossing and a crossing back (generation 1, 2, 3). A stale grant login at the old
region is redirected (`moved`).
2. Destination SIGKILL after stage (staged under its lease, then killed). The restarted
destination stages again under its new epoch and commits on the ticket. After the probe
crosses back, a replay of that ticket at a destination process that never saw it is
refused, and control stays with the owner.
3. Destination SIGKILL after commit (client admitted). A retry of the same ticket at the
restarted destination converges: same commit, and control moves again. A duplicate in
the same process is refused locally (`stale_grant`).
4. Source SIGKILL after prepare. One client's ticket still commits at the destination. The
other client never arrives, and its probe is refused as frozen (`capacity`) at the
restarted source until the recovery sweep aborts it. Then it logs in where it stopped.
5. Destination down. The ticket cannot be used, and the live source aborts after the
ticket's lifetime. The late ticket at the restarted destination is refused (`expired`).
After every scenario, SQL checks that:
- each probe has one owning region (A or B);
- the inventory total is conserved, in records and in transfers;
- each record is frozen exactly while its single open transfer exists.
Library tests add the v14 call (age bounds, source only, decided transfers excluded), the
refused replay in the ledger test, and the sweep over the fake world (never before the
store reports a transfer overdue).