Run the cellular owner on rules 3 with corpse causes
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (deploy) (push) Successful in 4m21s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 10m41s
Foundation / checks (postgres) (push) Canceled after 10m38s
Foundation / checks (tsan) (push) Canceled after 8m19s
Foundation / checks (client) (push) Canceled after 10m48s
Foundation / checks (checks) (push) Canceled after 10m53s

ADR-0124's engulf profile starts a region on owner format 4 and rules 3,
with the revision-format archive. Ticks pass genome membrane thickness and
source to the region step, record each corpse's cause and predator, insert
detritus patches and validate rules-3 corpses as empty. Format-4 snapshots
carry the cause and predator and refuse an unknown cause, a predator on a
starvation corpse or a non-empty corpse. Mutation selection accepts both
genome-revision formats (3 and 4).

Persistence (version bundle, schema 34), protocol v11 and provisioning
follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 18:54:03 -04:00
co-authored by Claude Opus 5.5
parent 0fb67c3257
commit 02adc35fa2
9 changed files with 217 additions and 37 deletions
+83 -1
View File
@@ -548,6 +548,87 @@ void owner_advances_and_closes_death_atomically() {
CHECK((*terminal_recovery)->heat() == owner.heat());
CHECK((*terminal_recovery)->archive().organism(101) == owner.archive().organism(101));
}
// ADR-0124 rules 3: engulf intents resolve, starvation leaves detritus, corpses keep a cause.
void rules_three_owner_resolves_engulf_and_detritus() {
auto primitive = PrimitiveLives::create({92, 1, 7, 17, founder_price(2), {{0, 0}, {20, 0}}});
CHECK(primitive);
LifeRequest request{};
request.account.back() = 1;
request.action = 1;
CHECK((*primitive)->spawn(request, {1, 101, 201, 301, {1}}));
request.account.back() = 2;
CHECK((*primitive)->spawn(request, {2, 102, 202, 302, {1}}));
evo::biology::CellularHabitatConfig habitat_config{
92, 1, 7, 3'000, 2'000, {{{0, 0}, 29, {{10}, {{{10}, {10}, {10}, {10}}}}}}};
auto habitat = evo::biology::CellularHabitat::create(std::move(habitat_config));
CHECK(habitat);
auto created =
CellularLives::create(**primitive, std::move(*habitat), {{3'000, 2'000}, 1, 293'150},
CellularLivesProfile::engulf);
CHECK(created);
auto& owner = **created;
CHECK(owner.format_version() == cellular_lives_engulf_format &&
owner.rules_version() == cellular_lives_engulf_rules &&
owner.archive().format_version() == evo::biology::lineage_archive_revision_format);
// Equal founders touching at an edge: neither is 1.5x the other.
evo::biology::CellularStepIntent engulf{};
engulf.engulf = true;
const std::array hunt{CellularLifeIntent{1, engulf}, CellularLifeIntent{2, {}}};
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 &&
owner.last_tick_feedback()[1].engulf ==
evo::biology::CellularEngulfStatus::not_requested);
// An engulf intent with an intake target is refused as a whole tick.
auto both = engulf;
both.intake_target = evo::biology::CellularPatchAddress{0, 0};
const std::array conflicting{CellularLifeIntent{1, both}, CellularLifeIntent{2, {}}};
CHECK(!owner.advance_tick(conflicting) && owner.tick() == 2);
const auto patch_before = owner.habitat().patches()[0].stock;
std::size_t steps{};
while (!owner.lives().empty() && steps < 2'000) {
std::vector<CellularLifeIntent> idle;
for (const auto& life : owner.lives())
idle.push_back({life.identity.life, {}});
const auto advanced = owner.advance_tick(idle);
if (!advanced)
std::fprintf(stderr, "rules 3 idle tick %zu refused: %d\n", steps,
static_cast<int>(advanced.error()));
CHECK(advanced);
CHECK(owner.current_total() == owner.opening_total());
++steps;
}
CHECK(owner.lives().empty() && owner.corpses().size() == 2);
for (const auto& corpse : owner.corpses())
CHECK(corpse.cause == evo::biology::CellularDeathCause::starved &&
corpse.predator_life == 0 && corpse.inventory == Inventory{});
// Both founders died inside the (0, 0) cell, so their whole inventories joined that patch.
CHECK(owner.habitat().patches().size() == 1);
CHECK(owner.habitat().patches()[0].stock.matter[0].value >
patch_before.matter[0].value + 2 * founder_price(1).matter[0].value / 2);
const auto saved = owner.snapshot();
auto recovered = CellularLives::restore(saved, 92, 1, 7, owner.tick());
CHECK(recovered && (*recovered)->snapshot() == saved &&
std::ranges::equal((*recovered)->corpses(), owner.corpses()));
// A corpse cause outside the closed set, or a predator on a starvation corpse, is refused.
const auto corpse_at = saved.size() - 8 - owner.habitat().snapshot().size() -
owner.archive().encode().size() - std::size_t{2} * 116;
auto bad_cause = saved;
bad_cause[corpse_at + 100] = 7;
refresh_checksum(bad_cause);
CHECK(CellularLives::restore(bad_cause, 92, 1, 7, owner.tick()).error() ==
CellularLivesError::noncanonical);
auto bad_predator = saved;
bad_predator[corpse_at + 108] = 1;
refresh_checksum(bad_predator);
CHECK(CellularLives::restore(bad_predator, 92, 1, 7, owner.tick()).error() ==
CellularLivesError::noncanonical);
}
} // namespace
int main() {
@@ -556,7 +637,8 @@ int main() {
cellular_profile_migration_is_explicit_and_no_tick();
retained_feeding_earns_a_persistent_mutation_offer();
owner_advances_and_closes_death_atomically();
std::puts("PASS cellular lives: feeding, tick ownership and terminal closure");
rules_three_owner_resolves_engulf_and_detritus();
std::puts("PASS cellular lives: feeding, tick ownership, terminal closure, rules 3");
} catch (const std::exception& error) {
std::fprintf(stderr, "%s\n", error.what());
return 1;