M12.6: add scoped multi-region cellular census queries
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m22s
Foundation / checks (network) (push) Successful in 20m57s
Foundation / checks (client) (push) Successful in 22m5s
Foundation / checks (tsan) (push) Successful in 24m37s
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 45m14s
Foundation / checks (postgres) (push) Canceled after 45m8s

This commit is contained in:
dingo
2026-10-18 15:11:51 -04:00
parent a180c41ae7
commit 82568da9cd
20 changed files with 621 additions and 4 deletions
+41
View File
@@ -1,4 +1,5 @@
#include "evo/server/lifecycle/cellular_census.hpp"
#include "evo/server/lifecycle/cellular_census_set.hpp"
#include "evo/server/lifecycle/cellular_migration.hpp"
#include "evo/server/lifecycle/cellular_migration_trace.hpp"
#include "evo/server/lifecycle/cellular_population_batch.hpp"
@@ -440,6 +441,46 @@ void upgrade_and_move() {
require(arrived.resident[0].body == migrant_bodies &&
arrived.resident[0].reserve == migrant_reserves,
"census migrant inventory differs from exact individual stock");
const auto& cut = departure.boundary();
const CellularCensusSetBoundary boundary{cut.world, cut.frame, cut.tick,
cut.owner_format, cut.rules, cut.quantum_microseconds};
const std::array<std::uint64_t, 2> regions{1, 2};
const auto combined =
checked(CellularCensusSet::observe(boundary, regions, std::array{arrival, departure}),
"settled pair census set");
const auto combined_stock = checked(combined.query(genome, CellularCensusScope::descendants),
"settled cross-region lineage");
require(combined_stock.resident[0] == arrived.resident[0] &&
combined_stock.retained_nonresident_records == moved.members.size(),
"cross-region census counted departed history twice");
for (std::size_t kind = 0; kind < combined_stock.resident.size(); ++kind) {
const auto& actual = combined_stock.resident[kind];
const auto& left = departed.resident[kind];
const auto& right = arrived.resident[kind];
require(actual.count == left.count + right.count &&
actual.body == plus(left.body, right.body) &&
actual.reserve == plus(left.reserve, right.reserve),
"combined lineage count/body/reserve differs from settled exact stock");
}
auto arrival_population =
checked(CellularPopulation::create(restore(*moved.destination)), "mixed census population");
checked(arrival_population->collapse(genome), "mixed census collapse");
const auto cohort_arrival =
checked(CellularCensus::observe(*arrival_population), "mixed census cohort arrival");
const auto mixed = checked(
CellularCensusSet::observe(boundary, regions, std::array{departure, cohort_arrival}),
"mixed raw/cohort census set");
const auto mixed_stock = checked(mixed.query(genome, CellularCensusScope::descendants),
"mixed representation lineage");
require(mixed_stock.resident[0] == CellularCensusStock{} &&
mixed_stock.resident[1] == arrived.resident[0] &&
mixed_stock.resident[4] == departed.resident[4],
"mixed classification lost/fabricated stock or suspended parent");
const auto old_source = checked(CellularCensus::observe(*source), "unsettled source census");
const auto double_owned =
CellularCensusSet::observe(boundary, regions, std::array{old_source, arrival});
require(!double_owned && double_owned.error() == CellularCensusSetError::resident_conflict,
"source plus uncommitted destination copy counted twice");
require(moved.destination->next_bud_sequence() == target->next_bud_sequence(),
"import consumed a local bud identity");
auto source_after = decode(*moved.source, moved.source->snapshot());