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
+37 -3
View File
@@ -363,12 +363,12 @@ void session_codec() {
mutated.at(0) ^= 1;
CHECK(refused(decode_session(mutated), SessionCodecError::bad_magic));
mutated = bytes;
mutated.at(4) = 4; // A future version.
mutated.at(4) = 5; // A future version.
CHECK(refused(decode_session(mutated), SessionCodecError::unsupported_version));
mutated = bytes;
mutated.at(7) = 1;
CHECK(refused(decode_session(mutated), SessionCodecError::reserved_flags));
for (const auto type : std::array<std::uint8_t, 3>{0, 16, 255}) {
for (const auto type : std::array<std::uint8_t, 3>{0, 18, 255}) {
mutated = bytes;
mutated.at(6) = type;
CHECK(refused(decode_session(mutated), SessionCodecError::unknown_type));
@@ -377,7 +377,7 @@ void session_codec() {
CHECK(std::get<SessionWelcome>(*decode_session(encode_session(welcome))) == welcome);
CHECK(std::get<SessionHello>(*decode_session(encode_session(SessionHello{0, grant}))).grant ==
grant);
for (const auto reason : std::array<std::uint8_t, 4>{0, 14, 200, 255}) {
for (const auto reason : std::array<std::uint8_t, 4>{0, 16, 200, 255}) {
auto close = encode_session(SessionClose{SessionCloseReason::protocol});
close.back() = reason;
CHECK(refused(decode_session(close), SessionCodecError::invalid_value));
@@ -708,11 +708,45 @@ void handoff_tickets() {
CHECK(control.open(dev.verified(claims(alice, 4)), now + 2));
}
// Session protocol v4 (ADR-0096): HandoffOffer and SessionRedirect.
void handoff_codec() {
HandoffOffer offer;
offer.transfer.fill(0x5C);
offer.destination = {12, "void.aeternalisgames.com:7402", "dev-region.evolution.test"};
offer.ticket.fill(0xA1);
const auto bytes = encode_session(offer);
const auto decoded = decode_session(bytes);
CHECK(decoded && std::get<HandoffOffer>(*decoded) == offer);
const SessionRedirect redirect{{12, "10.0.0.2:7400", "region-12.test"}};
const auto r = decode_session(encode_session(redirect));
CHECK(r && std::get<SessionRedirect>(*r) == redirect);
CHECK(decode_session(encode_session(SessionClose{SessionCloseReason::handed_off})));
CHECK(decode_session(encode_session(SessionClose{SessionCloseReason::moved})));
auto beyond = encode_session(SessionClose{SessionCloseReason::moved});
beyond.back() = static_cast<std::uint8_t>(SessionCloseReason::moved) + 1;
CHECK(refused(decode_session(beyond), SessionCodecError::invalid_value));
// Text fields: printable, no spaces, padded with zeros; region and transfer nonzero.
for (const auto& bad : {RegionAddress{12, "has space:1", "n"}, RegionAddress{12, "", "n"},
RegionAddress{0, "h:1", "n"}, RegionAddress{12, "h:1", ""}})
CHECK(refused(decode_session(encode_session(SessionRedirect{bad})),
SessionCodecError::invalid_value));
auto padded = encode_session(redirect);
padded.at(session_header_bytes + 8 + 20) = 'x'; // A byte after the endpoint's end.
CHECK(refused(decode_session(padded), SessionCodecError::invalid_value));
auto zero = offer;
zero.transfer.fill(0);
CHECK(refused(decode_session(encode_session(zero)), SessionCodecError::invalid_value));
auto longer = bytes;
longer.push_back(0);
CHECK(refused(decode_session(longer), SessionCodecError::wrong_length));
}
void control_tests() {
grants();
identity_adapter();
control_rules();
handoff_tickets();
handoff_codec();
session_codec();
intent_admission();
durable_actions();