Show what a mutation costs and why an engulf failed
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m7s
Foundation / checks (tsan) (push) Successful in 9m49s
Foundation / checks (client) (push) Successful in 17m12s
Foundation / checks (network) (push) Successful in 19m34s
Foundation / checks (checks) (push) Successful in 43m5s
Foundation / checks (postgres) (push) Successful in 44m57s
Foundation / server-image (push) Successful in 31s
Foundation / postgres-tools (push) Successful in 1m13s
Foundation / image (push) Successful in 3m24s

After the first M11.9 playtest (ADR-0129 amendment): each offered candidate now
carries its funded cost to the cell, construction energy and matter per channel,
so the client can grey out what the reserve cannot pay; a candidate is affordable
by that cost exactly when the owner would fund it. A failed engulf now reports no
contact, prey too large, or membrane too thick. The v10 candidate record grows to
64 bytes, so v10 clients must be rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-14 15:39:35 -04:00
co-authored by Claude Opus 5.5
parent dba73a97f5
commit 7c16a13dd9
16 changed files with 172 additions and 41 deletions
+7 -3
View File
@@ -332,10 +332,14 @@ void v10_effects_and_life_end_are_owner_only() {
// 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{
120, 9, 2, 100, {{3, 1, 0, 40, 150'000, 9'000}, {7, 2, 2, 1, 160'000, 9'500}}};
const CellularMutationOffer offer{120,
9,
2,
100,
{{3, 1, 0, 40, 150'000, 9'000, 1'200, {300, 70, 35, 140}},
{7, 2, 2, 1, 160'000, 9'500, 2'400, {600, 140, 70, 280}}}};
const auto bytes = encode_session(SessionMessage{offer});
CHECK(bytes.size() == session_header_bytes + 40 + (std::size_t{2} * 24));
CHECK(bytes.size() == session_header_bytes + 40 + (std::size_t{2} * 64));
std::uint16_t version{};
const auto decoded = decode_session(bytes, &version);
CHECK(decoded && version == session_protocol_v10);
+1 -1
View File
@@ -581,7 +581,7 @@ void rules_three_owner_resolves_engulf_and_detritus() {
const auto hunted = owner.advance_tick(hunt);
CHECK(hunted && owner.lives().size() == 2);
CHECK(owner.last_tick_feedback()[0].engulf ==
evo::biology::CellularEngulfStatus::no_eligible_prey &&
evo::biology::CellularEngulfStatus::prey_too_large &&
owner.last_tick_feedback()[1].engulf ==
evo::biology::CellularEngulfStatus::not_requested);
// An engulf intent with an intake target is refused as a whole tick.
+15 -1
View File
@@ -572,12 +572,26 @@ void cellular_host_admits_mutation_choices() {
offer.candidates.front().operator_id};
const auto next = host->state()->tick() + 1;
// 11.4d: the owner's view lists the same candidates in operator order.
const auto view = offer_view(life, next - 1);
const auto view = offer_view(*host->state(), life, next - 1);
CHECK(view.life_identity == life_id && view.event_index == choice.event_index &&
view.offer_tick == choice.offer_tick &&
view.candidates.size() == offer.candidates.size() &&
std::ranges::is_sorted(view.candidates, {},
&evo::network::CellularOfferedCandidate::operator_id));
// ADR-0129: a candidate is affordable by its shown cost exactly when the owner would
// fund it from the current reserve.
const auto parent_genome = host->state()->archive().find(life.identity.genome);
CHECK(parent_genome.has_value());
for (const auto& shown : view.candidates) {
bool covered = life.reserve.energy.value >= shown.cost_energy_pj;
for (std::size_t c = 0; c < shown.cost_matter_fg.size(); ++c)
covered = covered && life.reserve.matter[c].value >= shown.cost_matter_fg[c];
const auto funded = parent_genome
? fund_mutation(*parent_genome, offer.context, offer,
shown.operator_id, 999'999, 999'999, life.reserve)
: std::unexpected{MutationError::development};
CHECK(covered == funded.has_value());
}
auto wrong = choice;
wrong.operator_id = 0xFFFF;
CHECK(host->select_mutation(account, control->generation, 31, wrong).status ==
+5 -2
View File
@@ -170,17 +170,20 @@ void size_and_membrane_contest_engulfment() {
const std::array equal{cell(1, {0, 0}, 1'000, 1, true), cell(2, {0, 0}, 1'000, 1, false)};
const auto same = propose_cellular_region_step(4, {3'000, 2'000}, equal, *map, rules3);
CHECK(same && same->lives.size() == 2 && same->starved.empty());
CHECK(same->lives[0].engulf == CellularEngulfStatus::no_eligible_prey);
// The owner learns why: equal sizes are too large whatever the membrane.
CHECK(same->lives[0].engulf == CellularEngulfStatus::prey_too_large);
// A 3 um membrane raises the required ratio to 4.5; a 3x predator fails.
const std::array armored{cell(1, {0, 0}, 3'000, 1, true), cell(2, {0, 0}, 1'000, 3, false)};
const auto defended = propose_cellular_region_step(4, {3'000, 2'000}, armored, *map, rules3);
CHECK(defended && defended->lives.size() == 2 && defended->starved.empty());
// 3x would beat a 1 um membrane, so the membrane is the reason.
CHECK(defended->lives[0].engulf == CellularEngulfStatus::membrane_too_thick);
// Out of contact: no prey, whatever the size.
const std::array apart{cell(1, {0, 0}, 9'000, 1, true), cell(2, {2'000, 0}, 1'000, 1, false)};
const auto distant = propose_cellular_region_step(4, {3'000, 2'000}, apart, *map, rules3);
CHECK(distant && distant->lives.size() == 2 &&
distant->lives[0].engulf == CellularEngulfStatus::no_eligible_prey);
distant->lives[0].engulf == CellularEngulfStatus::no_contact);
}
void a_taken_cell_neither_acts_nor_is_taken_twice() {