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
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:
@@ -306,7 +306,7 @@ void replicated_markers() {
|
||||
const auto second = encode_record(m, -7, &area);
|
||||
two_own.insert(two_own.end(), second.begin(), second.end());
|
||||
auto bad_flag = encode_record(m, -7, nullptr);
|
||||
bad_flag.back() = 2;
|
||||
bad_flag.back() = 3; // 0 other, 1 own, 2 ghost (v4).
|
||||
m.state.vector = {2000, 0};
|
||||
const auto bad_vector = encode_record(m, -7, nullptr);
|
||||
m = {};
|
||||
@@ -316,6 +316,52 @@ void replicated_markers() {
|
||||
CHECK(refused(c.accept(SnapshotChunk{5, ++t, 0, 0, 0, 0, -7, 0, 1, records}),
|
||||
AssemblyError::malformed));
|
||||
}
|
||||
// Ghosts (ADR-0096): read-only markers of probes being handed to this region, stable per
|
||||
// transfer, replicated as kind 2 to every session whose square holds them; frozen markers
|
||||
// neither move nor take intentions; place and open_at clamp into the area.
|
||||
void ghosts_and_freezing() {
|
||||
ProbeMarkers m;
|
||||
CHECK(m.set_area(area, 0, 0));
|
||||
const auto own = m.open_at(1, 9'000'000, 100);
|
||||
CHECK(own && m.of(1)->state.x == 5'000'000 && m.of(1)->state.y == 100);
|
||||
m.place(1, -9'000'000, 7);
|
||||
CHECK(m.of(1)->state == State{-5'000'000, 7, {}});
|
||||
CHECK(m.schedule(1, 1, 5, {1000, 0}));
|
||||
m.freeze(1);
|
||||
CHECK(m.of(1)->frozen && refused(m.schedule(1, 2, 6, {1000, 0}), motion::MarkerError::invalid));
|
||||
m.advance(10);
|
||||
CHECK(m.of(1)->state.x == -5'000'000); // Frozen: the scheduled motion never happened.
|
||||
motion::Ghost g{};
|
||||
g.transfer.fill(0x61);
|
||||
g.x = 100'000;
|
||||
m.set_ghosts(std::span{&g, 1});
|
||||
const auto ghost_id = std::ranges::find_if(m.markers(), &motion::Marker::ghost)->id;
|
||||
m.set_ghosts(std::span{&g, 1}); // Same transfer, same id.
|
||||
CHECK(std::ranges::count_if(m.markers(), &motion::Marker::ghost) == 1 &&
|
||||
std::ranges::find_if(m.markers(), &motion::Marker::ghost)->id == ghost_id &&
|
||||
!m.of(0)); // Ghosts belong to no session.
|
||||
// Through replication and the codec: kind 2, not own.
|
||||
constexpr world::WorldIdentity identity{11, 12};
|
||||
auto made = ReplicationServer::create({});
|
||||
CHECK(made);
|
||||
auto server = std::move(*made);
|
||||
CHECK(server.open(1, 5) && server.set_interest(1, {0, 0, -7, 7}));
|
||||
const auto out = server.tick(1,
|
||||
[&](const SessionInterest&) {
|
||||
ReplicationSource s;
|
||||
s.identity = identity;
|
||||
s.markers = m.markers();
|
||||
s.marker_area = m.area();
|
||||
return s;
|
||||
},
|
||||
{});
|
||||
SnapshotAssembler a{identity, 5};
|
||||
CHECK(!deliver(a, chunks_of(out, 1)).empty());
|
||||
const auto* seen = marker(a, ghost_id);
|
||||
CHECK(seen && seen->ghost && !seen->own && seen->state.x == 100'000);
|
||||
m.set_ghosts({});
|
||||
CHECK(std::ranges::none_of(m.markers(), &motion::Marker::ghost));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void motion_tests() {
|
||||
@@ -325,5 +371,6 @@ void motion_tests() {
|
||||
predictor_rules();
|
||||
smoothing_and_lead();
|
||||
replicated_markers();
|
||||
ghosts_and_freezing();
|
||||
}
|
||||
} // namespace evo::network_test
|
||||
|
||||
Reference in New Issue
Block a user