Tell the owner what its engulf and bud did, and why its cell died

M11.8 server half (ADR-0129): v10 diagnostics report the tick's engulf and bud
results in two reserved bytes, and v10 type 27 tells the owner its life ended with
the cause (starved or engulfed). The bridge fills both from the owner's tick
feedback and corpses; v9 views are unchanged. Client presentation stays with the
maintainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-14 07:57:37 -04:00
co-authored by Claude Opus 5.5
parent e74bdf286b
commit 69e3866fd9
14 changed files with 312 additions and 8 deletions
+43
View File
@@ -288,6 +288,48 @@ void v10_mutation_choice_is_a_strict_reliable_action() {
CHECK(std::get<ActionOutcome>(*decode_session(outcome_bytes)) == outcome);
}
// 11.8 (ADR-0129): v10 reports engulf and bud effects and announces a life's end.
void v10_effects_and_life_end_are_owner_only() {
CellularLifeDiagnostics d;
d.reserve_energy_pj = 9;
d.maintenance_cost_pj = 2;
d.movement = CellularMovementResult::no_movement;
d.intake = CellularIntakeResult::not_requested;
d.has_tick_effects = true;
d.engulf = CellularEngulfResult::no_eligible_prey;
d.bud = CellularBudOutcome::insufficient_funding;
const CellularPerception perception{40, 7, {}, d};
const auto bytes = encode_session(SessionMessage{perception}, session_protocol_v10);
CHECK(!bytes.empty() && bytes[session_header_bytes + 77] == 3 &&
bytes[session_header_bytes + 78] == 4);
CHECK(std::get<CellularPerception>(*decode_session(bytes)) == perception);
// v9 has no room for them: an encoder refuses, a decoder refuses non-zero bytes.
CHECK(encode_session(SessionMessage{perception}, session_protocol_v9).empty());
auto as_v9 = bytes;
as_v9[4] = static_cast<std::uint8_t>(session_protocol_v9);
CHECK(!decode_session(as_v9));
auto unknown_bud = bytes;
unknown_bud[session_header_bytes + 78] = 6;
CHECK(!decode_session(unknown_bud));
auto idle = perception;
idle.diagnostics = CellularLifeDiagnostics{};
idle.diagnostics->bud = CellularBudOutcome::budded; // Effects need tick effects.
CHECK(encode_session(SessionMessage{idle}, session_protocol_v10).empty());
const CellularLifeEnded ended{41, 7, CellularDeathReason::engulfed};
const auto ended_bytes = encode_session(SessionMessage{ended});
std::uint16_t version{};
const auto decoded = decode_session(ended_bytes, &version);
CHECK(ended_bytes.size() == session_header_bytes + 24 && decoded &&
version == session_protocol_v10 && std::get<CellularLifeEnded>(*decoded) == ended);
CHECK(encode_session(SessionMessage{ended}, session_protocol_v9).empty());
auto bad_cause = ended_bytes;
bad_cause[session_header_bytes + 16] = 3;
CHECK(!decode_session(bad_cause));
CHECK(encode_session(SessionMessage{CellularLifeEnded{41, 0, CellularDeathReason::starved}})
.empty());
}
// 11.4d: the owner's offer lists unranked candidates in operator order with their tradeoffs.
void v10_mutation_offer_is_owner_only_and_canonical() {
const CellularMutationOffer offer{
@@ -337,6 +379,7 @@ int main() {
v9_perception_carries_only_valid_owner_diagnostics();
v10_mutation_choice_is_a_strict_reliable_action();
v10_mutation_offer_is_owner_only_and_canonical();
v10_effects_and_life_end_are_owner_only();
std::puts(
"PASS cellular protocol: v6 intention, v7 action, v8-v10 perception/action framing");
} catch (const std::exception& error) {