feat(lifecycle): qualify census of funded maturing owners
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m29s
Foundation / checks (network) (push) Successful in 20m54s
Foundation / checks (client) (push) Successful in 22m0s
Foundation / checks (tsan) (push) Successful in 27m5s
Foundation / checks (postgres) (push) Successful in 1h4m20s
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 1h12m23s

This commit is contained in:
dingo
2026-10-19 07:56:58 -04:00
parent 463b091056
commit 274f62cb89
14 changed files with 430 additions and 19 deletions
+90
View File
@@ -380,6 +380,94 @@ void conflicting_regional_genomes() {
require(!result && result.error() == CellularCensusSetError::genome_conflict,
"different immutable records merged under one world genome ID");
}
void maturing_owners() {
auto source = cellular_descendants();
auto boundary = checked(source->migration_upgrade_candidate(), "maturing census boundary");
auto owner = checked(boundary->maturation_upgrade_candidate(), "maturing census owner");
const auto raw = checked(CellularCensus::observe(*owner), "maturing raw census");
verify(raw, *owner);
auto population =
checked(CellularPopulation::create(std::move(owner)), "maturing census population");
const auto wildlife = std::ranges::find_if(population->state().lives(), [](const auto& life) {
return life.account == LifeAccount{};
});
require(wildlife != population->state().lives().end(), "maturing census lacks real juvenile");
const auto genome = wildlife->identity.genome;
checked(population->collapse(genome), "maturing census collapse");
const auto biology = population->state().snapshot();
const auto detached = checked(CellularCensus::observe(*population), "detached maturing census");
verify(detached, population->state(), population.get());
const auto held_rows =
std::vector<CellularCensusRow>{detached.rows().begin(), detached.rows().end()};
checked(population->materialize(genome), "maturing census materialize");
verify(checked(CellularCensus::observe(*population), "materialized maturing census"),
population->state(), population.get());
checked(population->collapse(genome), "maturing census recollapse");
require(population->state().snapshot() == biology, "census conversion changed physical stock");
bool grew = false;
for (unsigned tick = 0; tick < 256; ++tick) {
std::vector<CellularLifeIntent> controlled;
for (const auto& life : population->state().lives())
if (life.account != LifeAccount{}) {
CellularLifeIntent frozen{life.identity.life, {}};
frozen.intent.frozen = true;
controlled.push_back(frozen);
}
const auto executed = checked(population->advance_tick(controlled), "census funded growth");
grew |= !executed.growth.empty();
const auto saved = population->snapshot();
const auto census = checked(CellularCensus::observe(*population), "growing cohort census");
verify(census, population->state(), population.get());
verify(checked(CellularCensus::observe(population->state()), "growing raw census"),
population->state());
require(population->snapshot() == saved && std::ranges::equal(detached.rows(), held_rows),
"census advanced biology or rewrote a detached growth observation");
if (tick == 127) {
const auto& state = population->state();
population = checked(CellularPopulation::restore(saved, state.world(), state.region(),
state.frame(), state.tick()),
"growing census restore");
require(
std::ranges::equal(
checked(CellularCensus::observe(*population), "restored growing census").rows(),
census.rows()),
"restore changed growing census");
}
}
require(grew && detached.boundary().rules == cellular_lives_maturation_rules &&
detached.boundary().owner_format == 7 && detached.boundary().population_format == 2,
"maturation census did not exercise real growth or retained wrong versions");
}
void maturing_regional_sets() {
auto a = checked(
checked(regional_founder(1, 100, 100, 100)->migration_upgrade_candidate(), "set A boundary")
->maturation_upgrade_candidate(),
"set A maturation");
auto old_b = checked(regional_founder(2, 200, 200, 200)->migration_upgrade_candidate(),
"set B boundary");
auto b = checked(CellularPopulation::create(
checked(old_b->maturation_upgrade_candidate(), "set B maturation")),
"set B population");
const auto ca = checked(CellularCensus::observe(*a), "maturing set A");
const auto cb = checked(CellularCensus::observe(*b), "maturing set B");
const auto old = checked(CellularCensus::observe(*old_b), "retained rules-8 set B");
const std::array<std::uint64_t, 2> regions{1, 2};
const auto set =
checked(CellularCensusSet::observe(set_boundary(ca), regions, std::array{cb, ca}),
"complete maturing set");
require(checked(set.query(100, Scope::descendants), "maturing set founder A") ==
direct(*a, 100, true) &&
checked(set.query(200, Scope::exact_genome), "maturing set founder B") ==
direct(b->state(), 200, false, b.get()),
"maturing scoped set invented or lost stock");
const auto mixed = CellularCensusSet::observe(set_boundary(ca), regions, std::array{ca, old});
require(!mixed && mixed.error() == CellularCensusSetError::boundary,
"mixed rules-8/rules-9 owners became a compatible complete set");
const auto converse =
CellularCensusSet::observe(set_boundary(old), regions, std::array{ca, old});
require(!converse && converse.error() == CellularCensusSetError::boundary,
"rules-9 evidence was silently reinterpreted under a rules-8 boundary");
}
} // namespace
int main() try {
presence_and_detachment();
@@ -387,6 +475,8 @@ int main() try {
cohorts_and_death();
regional_sets();
conflicting_regional_genomes();
maturing_owners();
maturing_regional_sets();
std::cout << "PASS local census presence, exact lineage queries, conversion and retention\n";
return 0;
} catch (const std::exception& error) {