Carry the engulf intent on v10 sessions and the batch trace
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 6m47s
Foundation / checks (checks) (push) Canceled after 6m58s
Foundation / checks (client) (push) Canceled after 6m59s
Foundation / checks (tsan) (push) Canceled after 4m28s
Foundation / checks (network) (push) Canceled after 6m58s

ADR-0124: byte 12 of the canonical cellular input, the CellularAction
wire message and the batch trace record becomes a target kind (0 none,
1 patch, 2 engulf with zero coordinates). Kind 2 exists only on v10,
which no server admitted before; cellular servers now admit v10 with v9
behaviour plus engulf, and still refuse a v10 mutation choice until
11.4c. Admission, the session-batch adapter, trace codec, matcher and
action-block validator carry the kind.

The client session library accepts v10 and an engulf flag, and its send
no longer reports a message its version cannot encode as sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 19:04:46 -04:00
co-authored by Claude Opus 5.5
parent 02adc35fa2
commit e17ade8cb7
15 changed files with 175 additions and 39 deletions
+40
View File
@@ -116,6 +116,45 @@ void v7_reliable_action_is_stable_and_strict() {
CHECK(!decode_cellular_action_input(malformed_input));
}
// ADR-0124: target kind 2 (engulf) exists only on v10, without coordinates or a patch.
void v10_engulf_action_is_versioned_and_exclusive() {
CellularAction engulf{17, 23, 29, 31, 5, -5, false, 0, 0};
engulf.engulf = true;
const auto bytes = encode_session(SessionMessage{engulf}, session_protocol_v10);
CHECK(bytes.size() == session_header_bytes + 48 && bytes[session_header_bytes + 36] == 2);
std::uint16_t version{};
const auto decoded = decode_session(bytes, &version);
CHECK(decoded && version == session_protocol_v10 &&
std::get<CellularAction>(*decoded) == engulf);
CHECK(encode_session(SessionMessage{engulf}, session_protocol_v9).empty());
CHECK(encode_session(SessionMessage{engulf}).empty()); // The default v7 has no engulf.
auto with_patch = engulf;
with_patch.has_intake_target = true;
CHECK(encode_session(SessionMessage{with_patch}, session_protocol_v10).empty());
// A v9 decoder refuses kind 2 even with a valid layout.
auto as_v9 = bytes;
as_v9[4] = static_cast<std::uint8_t>(session_protocol_v9);
CHECK(!decode_session(as_v9));
// Coordinates are reserved for a patch target.
auto placed = bytes;
placed[session_header_bytes + 40] = 1;
CHECK(!decode_session(placed));
// A patch action on v10 is unchanged.
const CellularAction feed{17, 23, 30, 31, 0, 0, true, 1'000, 2'000};
const auto feed_bytes = encode_session(SessionMessage{feed}, session_protocol_v10);
CHECK(std::get<CellularAction>(*decode_session(feed_bytes)) == feed);
CellularActionInput input{31, 5, -5, false, 0, 0, true};
const auto canonical = encode_cellular_action_input(input);
CHECK(canonical[12] == 2 && decode_cellular_action_input(canonical) == input);
auto coordinated = canonical;
coordinated[16] = 1;
CHECK(!decode_cellular_action_input(coordinated));
auto unknown_kind = canonical;
unknown_kind[12] = 3;
CHECK(!decode_cellular_action_input(unknown_kind));
}
void v8_perception_is_bounded_and_canonical() {
CellularPerception perception{19, 42, {}, std::nullopt};
perception.patches = {
@@ -223,6 +262,7 @@ int main() {
round_trip_and_version_gate();
malformed_frames_are_refused();
v7_reliable_action_is_stable_and_strict();
v10_engulf_action_is_versioned_and_exclusive();
v8_perception_is_bounded_and_canonical();
v9_perception_carries_only_valid_owner_diagnostics();
v10_mutation_choice_is_a_strict_reliable_action();
+22
View File
@@ -80,6 +80,28 @@ void actions_bind_to_owned_life_and_preserve_other_inputs() {
CHECK(prepare_cellular_session_tick(**state, 2, baseline, guessed_actions).error() ==
CellularSessionBatchError::unperceived_target);
// ADR-0124: an engulf action becomes the life's engulf intent, and the trace keeps it.
const auto engulf_input = network::encode_cellular_action_input({2, 1, 0, false, 0, 0, true});
const network::CarriedAction engulf_action{network::AccountId{controlled.account}, 79, 2,
network::ActionKind::cellular, engulf_input};
const std::array engulf_actions{engulf_action};
const auto engulfing = prepare_cellular_session_tick(**state, 2, baseline, engulf_actions);
CHECK(engulfing && engulfing->intents.lives[0].intent.engulf &&
!engulfing->intents.lives[0].intent.intake_target);
CellularBatch engulf_batch;
engulf_batch.header = {(*state)->world(), (*state)->region(), (*state)->frame(), {}, {}, 1, 2};
engulf_batch.header.predecessor.fill(1);
engulf_batch.header.predecessor_digest.fill(2);
engulf_batch.ticks.push_back(engulfing->intents);
CHECK(match_cellular_actions_to_trace(**state, engulf_batch, engulfing->actions));
const auto engulf_bytes = encode_cellular_batch(engulf_batch);
CHECK(engulf_bytes);
const auto engulf_decoded = decode_cellular_batch(*engulf_bytes);
CHECK(engulf_decoded && *engulf_decoded == engulf_batch);
auto stripped = engulf_batch;
stripped.ticks[0].lives[0].intent.engulf = false;
CHECK(!match_cellular_actions_to_trace(**state, stripped, engulfing->actions));
CellularBatch batch;
batch.header = {(*state)->world(), (*state)->region(), (*state)->frame(), {}, {}, 1, 2};
batch.header.predecessor.fill(1);
+13 -1
View File
@@ -637,7 +637,7 @@ void cellular_v5_spawn_and_v7_action_share_region_sessions(const Files& f) {
} actions;
FakeLedger control;
Harness h{
f, 5, 64, &control, [&](server::RegionSessionsConfig& c) {
f, 6, 64, &control, [&](server::RegionSessionsConfig& c) {
c.actions = &actions;
c.accept_cellular_actions = true;
// Like the cellular host, a refusal reports the reserved identity; only a
@@ -687,6 +687,18 @@ void cellular_v5_spawn_and_v7_action_share_region_sessions(const Files& f) {
CHECK(carried.size() == 1 && carried.front().account == account(0xB7) &&
carried.front().kind == ActionKind::cellular);
// ADR-0124: a v10 session carries an engulf action; a v7 session cannot encode one.
auto engulf_client = h.connect(h.issuer.grant(account(0xBB), 1), session_protocol_v10);
CHECK(h.settled(*engulf_client) && engulf_client->state() == RegionSessionState::established);
CHECK(!action_client->send_cellular_action(56, 102, 0, 0, std::nullopt, true));
CHECK(engulf_client->send_cellular_action(66, 102, 0, 0, std::nullopt, true));
CHECK(h.until([&] { return !(receipts = engulf_client->take_action_receipts()).empty(); }));
CHECK(receipts.front().status == AdmitStatus::admitted);
const auto engulfing = h.server->carry(102);
CHECK(engulfing.size() == 1 && engulfing.front().account == account(0xBB) &&
engulfing.front().cellular_input ==
std::optional{encode_cellular_action_input({102, 0, 0, false, 0, 0, true})});
h.server->set_default_interest({0, 0, 0, 7});
h.source = [](const SessionInterest&) {
ReplicationSource source;