Wire M10.8c-1 region handoff: protocol v4, durable probes, crossing, ghosts
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s

ADR-0096. Session protocol v4 (v3 is deployed and frozen) adds HandoffOffer,
SessionRedirect, close reasons handed_off and moved, and ghost marker records.
Sessions use the durable probe record: logins open it where it was saved
(redirected when it lives elsewhere), and session ends save it. A marker
crossing into a neighbour's area is frozen, prepared, its control released
and a signed ticket offered; uncommitted transfers are aborted after the
ticket's lifetime. The destination shows arriving probes as ghosts (schema
v13 incoming_probe_transfers) and opens the marker where it crossed.

Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-06 21:24:42 -04:00
co-authored by Claude Opus 5.5
parent 97a3756e46
commit a7a3d12283
39 changed files with 1315 additions and 68 deletions
+14 -2
View File
@@ -188,6 +188,14 @@ void ownership_and_happy_path(World& w) {
CHECK(state_of(stage_probe_transfer(db, w.b, w.lb, t1, 5s)) == TransferState::staged);
CHECK(state_of(stage_probe_transfer(db, w.b, w.lb, t1, 5s)) == TransferState::staged);
CHECK(failed(commit_probe_transfer(db, w.c, w.lc, t1, 5s), ProbeStoreError::fenced));
// Schema v13: the destination sees the open transfer addressed to it (for a ghost).
const auto incoming = incoming_probe_transfers(db, w.b, w.lb, 5s);
CHECK(incoming && incoming->size() == 1 && incoming->front().transfer == t1 &&
incoming->front().account == alice && incoming->front().source == 1 &&
incoming->front().x == 700'000);
CHECK(incoming_probe_transfers(db, w.c, w.lc, 5s)
.value_or(std::vector<IncomingTransfer>{1})
.empty());
// The one switch: owner B, next generation, the frozen final state, same inventory.
const auto committed = commit_probe_transfer(db, w.b, w.lb, t1, 5s);
CHECK(state_of(committed) == TransferState::committed);
@@ -199,6 +207,9 @@ void ownership_and_happy_path(World& w) {
CHECK(stage_probe_transfer(db, w.b, w.lb, t1, 5s) == *committed);
CHECK(prepare_probe_transfer(db, w.a, w.la, alice, 1, t1, 2, 0, 0, 0, 5s) == *committed);
CHECK(abort_probe_transfer(db, w.a, w.la, t1, 5s) == *committed);
CHECK(incoming_probe_transfers(db, w.b, w.lb, 5s)
.value_or(std::vector<IncomingTransfer>{1})
.empty()); // Decided transfers are no longer incoming.
const auto found = find_probe_transfer(db, w.c, w.lc, t1, 5s);
CHECK(found && *found == std::optional{*committed});
const auto missing = find_probe_transfer(db, w.c, w.lc, id(0x7F), 5s);
@@ -396,12 +407,13 @@ void handoff_ledger(World& w) {
ticket.source = 1;
ticket.destination = 2;
const auto admitted = ledger.admit(ticket, 41);
CHECK(admitted && admitted->generation == 2 && admitted->wait == 0ms);
CHECK(admitted && admitted->lease.generation == 2 && admitted->lease.wait == 0ms &&
admitted->generation == 2 && admitted->x == 3 && admitted->y == 4);
const auto r = w.open(w.b, w.lb, frank);
CHECK(r.region == 2 && r.generation == 2 && r.x == 3 && !r.transfer);
// A retried login after an undecided outcome converges (control moves on again).
const auto again = ledger.admit(ticket, 42);
CHECK(again && again->generation == 3);
CHECK(again && again->lease.generation == 3);
// Refusals: another account, an unknown transfer, an aborted transfer; no lease.
auto wrong = ticket;
wrong.account.bytes = id(0x48);