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
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:
@@ -169,8 +169,10 @@ deployment qualification remain open. Portable opt-in
|
||||
[rules-9 maturation](docs/adr/0157-funded-cellular-maturation.md) now funds real
|
||||
juveniles through adulthood and budding in the same raw/cohort kernel.
|
||||
[Schema 53's explicit durable upgrade](schemas/cellular-maturation-upgrade.md)
|
||||
retains both representations and their full recovery evidence. Rules-9 migration,
|
||||
census and autonomous ecological qualification remain separate gates.
|
||||
retains both representations and their full recovery evidence.
|
||||
[Rules-9 census](docs/adr/0159-maturing-cellular-census.md) observes exact growing
|
||||
stock through verified history and registered snapshots; mixed rule cuts fail.
|
||||
Rules-9 migration and autonomous ecological qualification remain separate gates.
|
||||
The microscope client is the M11 playtest path.
|
||||
`evo::simulation` remains
|
||||
graphics-, network- and database-independent.
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# Project status and next steps
|
||||
|
||||
## Census of funded maturing owners - 2026-10-19
|
||||
|
||||
[ADR-0159](adr/0159-maturing-cellular-census.md) admits rules-9/owner-7 retained
|
||||
body/reserve to census projection 1, verified committed history and registered
|
||||
snapshots. Real funded growth, raw/cohort conversion, no-tick version/profile
|
||||
cuts and concurrent snapshot capture are qualified. Mixed rules-8/rules-9 cuts,
|
||||
missing evidence/builds and stale grants refuse complete queries.
|
||||
|
||||
Native Release passes **81/81**, focused GCC Release **3/3**, and the complete
|
||||
affected private database matrix passes in **22 s**. ASan/UBSan portable census
|
||||
and the private matrix (**64 s**), analysis and formatting pass; detailed evidence
|
||||
and limits are in [validation](engineering/VALIDATION.md). No SQL schema or
|
||||
biological rule change. Rules-9 migration, viable-store reconciliation, ecology,
|
||||
actual-days and product gates remain open; M12 is still in progress.
|
||||
|
||||
## Durable funded cellular maturation - 2026-10-19
|
||||
|
||||
[ADR-0158](adr/0158-durable-cellular-maturation.md)/schema 53 admits explicit
|
||||
|
||||
@@ -67,3 +67,6 @@ deployment, World0 operation, extinction or M12 completion is inferred.
|
||||
ADR-0158/schema 53 subsequently admits explicit durable bundle-10 -> 11 upgrades.
|
||||
The maturation rule above is unchanged; migration/census and ecological/product
|
||||
qualification remain separate gates.
|
||||
|
||||
ADR-0159 subsequently qualifies rules-9 census through retained history and
|
||||
registered snapshots. Migration and ecological/product qualification remain open.
|
||||
|
||||
@@ -50,3 +50,7 @@ Run portable Release, sanitizers, analysis and the full persistence/backup/DR
|
||||
matrix. This qualifies the retained biological rule and its storage path, not
|
||||
autonomous multi-generation ecology, linked environmental budgets, actual days,
|
||||
deployment-host costs, product readiness or M12 completion.
|
||||
|
||||
ADR-0159 subsequently qualifies rules-9 census projection 1 through verified
|
||||
history and registered snapshots, preserving the maturation rule and storage
|
||||
contracts above. Mixed rules 8/9 still refuse a complete regional set.
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# ADR-0159: Census of funded maturing cellular owners
|
||||
|
||||
## Status
|
||||
|
||||
Accepted for the scoped M12 maturation census gate, 2026-10-19. Extends
|
||||
ADR-0150–0156/0157/0158. No new biological rule, codec, SQL schema or extinction
|
||||
decision. Migration of rules-9 organisms remains a separate gate.
|
||||
|
||||
## Decision
|
||||
|
||||
Admit rules 9 with owner format 7, raw or population envelope 2, to census
|
||||
projection version 1. Preserve rules-8 support and all existing query meanings.
|
||||
The projection already reads exact retained per-life body/reserve inventories;
|
||||
funded growth changes those quantities, not identity, ancestry or ownership.
|
||||
Count each organism once, with cohort tags classifying the same owned store.
|
||||
Construction heat, food, corpses, nursery and cumulative boundary flows remain
|
||||
outside living stock. Damage, reserves and body size are observations, not a
|
||||
growth forecast or a genome-derived replacement for retained physical state.
|
||||
|
||||
Record the exact source rule at every observation. A no-tick maturation upgrade
|
||||
creates a distinct committed cut even when counts/stocks stay equal. Existing
|
||||
read-only history and registered snapshot adapters use complete supported
|
||||
recovery before projecting. No second census journal, index, write or independent
|
||||
publication window is added. The bound manifest/evidence determines how old
|
||||
biology replays; a newer current head never reinterprets a retained rules-8 cut.
|
||||
|
||||
Scoped/registered sets still require equal frame, completed tick, owner format,
|
||||
rules and quantum across every required region. Mixed rules 8/9 do not provide
|
||||
compatible evidence and fail the complete query; do not filter the older owner,
|
||||
merge unlike biological cuts or turn it into zero stock. Raw and exact cohort
|
||||
representations may coexist when all biological boundaries match. Unknown
|
||||
versions, missing objects/builds, false replay and unavailable required regions
|
||||
still fail without partial/older/zero fallback.
|
||||
|
||||
## Alternatives, qualification and limits
|
||||
|
||||
Re-deriving bodies at target adult size would invent biomass. Treating maturation
|
||||
as another organism duplicates life. A second stored census can diverge from
|
||||
atomic biology. Extend the bounded read-only projection instead; its row layout,
|
||||
work limits, immutable genome checks and resident-identity checks are unchanged.
|
||||
|
||||
Require direct per-life inventory/count oracles during real funded juvenile
|
||||
growth; raw/cohort conversion and restore; detached observations; same-tick
|
||||
rules/profile transitions in committed history; registered capture races with
|
||||
upgrade/materialization; mixed-rule refusal; missing retained/current objects,
|
||||
unretained builds and stale authority. Run Release, ASan/UBSan, analysis and the
|
||||
affected private database history/snapshot/publication matrix. Old goldens and
|
||||
migrations stay unchanged. This admits observations of upgraded owners, not
|
||||
complete viable-store reconciliation, terminal extinction, client permissions,
|
||||
automatic migration, sustainable ecology, target-host cost or actual-days soak.
|
||||
@@ -4,9 +4,12 @@ ADR-0158/schema 53 admits the explicit same-profile bundle-10 -> 11 maturation
|
||||
upgrade through the existing immutable version journal and lease/head fence.
|
||||
Recovery rederives the complete retained transformation; raw trace 3 and population
|
||||
batch 2 keep their layouts. Profile changes preserve the tuple. No new genesis,
|
||||
automatic upgrade or default change. Biological migration and registered census
|
||||
for rules 9 remain unsupported; an unavailable owner projection cannot become
|
||||
zero life. See [the upgrade contract](../../schemas/cellular-maturation-upgrade.md).
|
||||
automatic upgrade or default change. Biological migration for rules 9 remains
|
||||
unsupported. [ADR-0159](../adr/0159-maturing-cellular-census.md) admits its exact
|
||||
retained stocks to census projection 1 and the existing verified history and
|
||||
registered snapshot readers. Mixed rules-8/rules-9 regional cuts fail the complete
|
||||
query. Unavailable evidence cannot become zero life. See
|
||||
[the upgrade contract](../../schemas/cellular-maturation-upgrade.md).
|
||||
|
||||
M12.7c/schema 52 adds [pending migration evidence](../../schemas/ecology/census-pending-migrations-v1.md)
|
||||
to registered snapshots. Pending source/destination pointers, namespace, registry
|
||||
|
||||
@@ -114,9 +114,16 @@ automatic wildlife robustness, balance and actual-days qualification remain open
|
||||
ADR-0158/schema 53 now adds explicit durable bundle-10 -> 11 maturation admission,
|
||||
using the existing immutable version journal and exact same-profile recovery.
|
||||
Raw/cohort publication and representation changes preserve the retained rule.
|
||||
This does not enable rules-9 biological migration/census, autonomous sustainability,
|
||||
This does not enable rules-9 biological migration, autonomous sustainability,
|
||||
joint environmental budgets or actual-days qualification.
|
||||
|
||||
ADR-0159 now qualifies rules-9/owner-7 census projection 1 through the existing
|
||||
committed history and registered snapshot readers. Exact retained body/reserve,
|
||||
real funded growth, same-tick version/profile cuts and concurrent capture are
|
||||
checked. Mixed rules 8/9, unavailable objects/builds and stale grants refuse the
|
||||
complete query. No new SQL schema, redundant census journal or biological rule.
|
||||
This does not close viable-store reconciliation, extinction or M12 ecology gates.
|
||||
|
||||
M12.6a's [regional census projection](../../schemas/ecology/regional-cellular-census-v1.md)
|
||||
independently implements local current-genome and descendant-closure queries.
|
||||
It keeps suspended stock and retained zero-carrier ancestry, separates exact cohort
|
||||
|
||||
@@ -1,5 +1,51 @@
|
||||
# Validation report
|
||||
|
||||
## 2026-10-19 - Census of funded maturing owners
|
||||
|
||||
[ADR-0159](../adr/0159-maturing-cellular-census.md) admits rules 9/owner 7,
|
||||
raw or exact population envelope 2, to census projection 1. The projection reads
|
||||
retained physical stocks with its existing categories and query meanings. History
|
||||
and registered snapshot adapters already recover bundle 11 before projecting;
|
||||
no persistence implementation, SQL migration, biological rule or codec changed.
|
||||
|
||||
Executed locally:
|
||||
|
||||
- MSVC default Release full CTest **81/81 passed, 17.77 s**, with NDEBUG.
|
||||
- GCC 14 Release census, maturation and process continuation **3/3 passed, 2.08 s**.
|
||||
- The complete affected private PostgreSQL population/history/snapshot/ownership
|
||||
fault matrix passed **exit 0, 22 s** (19 s population), including the new
|
||||
dedicated rules-9 world and all retained rules-8 cases.
|
||||
- Clang 19 ASan/UBSan portable census and the same complete private matrix passed,
|
||||
the latter **exit 0, 64 s** (61 s population), without sanitizer reports.
|
||||
- clang-tidy 19 passed on the census implementation and both changed test sources;
|
||||
repository clang-format 19 and `git diff --check` passed.
|
||||
|
||||
The portable oracle enumerates actual per-life counts, bodies and reserves for
|
||||
each exact-genome/descendant query during 256 ticks with real funded juvenile
|
||||
growth. Raw/cohort classification, conversion, midpoint restore and detached
|
||||
observations agree. Rules-9 regional sets accept matching raw/cohort owners and
|
||||
reject mixed rules 8/9 under either declared boundary.
|
||||
|
||||
The database fixture reserves and funds real founders, retains a real bud, then
|
||||
explicitly upgrades through bundle 10 to 11. It publishes an admitted 64-tick
|
||||
growing cohort interval and recovers exact bytes. Six retained cuts cover rules-8
|
||||
source, no-tick maturation, population entry, collapse, growth and materialization.
|
||||
Bounded history pages match every saved manifest, boundary and census row; a
|
||||
pinned pre-growth watermark retains both original rule cuts. Independent writer
|
||||
hooks commit upgrade/materialization after snapshot head capture: the current
|
||||
query retains the captured view and the next query sees the new committed cut.
|
||||
Missing old/current payloads refuse the whole page/snapshot; unretained builds,
|
||||
false watermarks and replaced grants fail. Fresh grants recover the same stock.
|
||||
|
||||
These runs use temporary private Unix-socket databases. The full persistence,
|
||||
backup/DR, TLS relay and SQL privilege/checksum suite was not repeated: this gate
|
||||
changes only census version admission and qualification, leaving those storage
|
||||
contracts unchanged; the preceding schema-53 qualification remains recorded below.
|
||||
TSan was not rerun because shared-memory ownership/scheduling did not change.
|
||||
No live database, deployment or World0 operation occurred. Rules-9 migration,
|
||||
other viable-store reconciliation, terminal extinction, autonomous ecological
|
||||
generations, target-host costs, actual days and product readiness remain open.
|
||||
|
||||
## 2026-10-19 - Durable funded cellular maturation
|
||||
|
||||
[ADR-0158](../adr/0158-durable-cellular-maturation.md)/schema 53 admits bundle 11
|
||||
|
||||
@@ -53,6 +53,8 @@ enum class CellularCensusError : std::uint8_t {
|
||||
};
|
||||
// Detached bounded observation, NOT a committed/world-complete evidence record.
|
||||
// It never owns inventory, changes biology or reports terminal extinction.
|
||||
// ADR-0159: rules 8/owner 6 or 7; rules 9/owner 7 (raw or population envelope 2).
|
||||
// Growth observes retained body/reserve, never an unfunded adult forecast.
|
||||
class CellularCensus {
|
||||
public:
|
||||
[[nodiscard]] static std::expected<CellularCensus, CellularCensusError>
|
||||
|
||||
@@ -38,7 +38,8 @@ allows only the existing fenced entry points. Earlier migration bytes are intact
|
||||
No live/default auto-upgrade or new provisioning mode. An explicitly upgraded
|
||||
owner can recover and continue raw/cohort biology, including interval admission,
|
||||
settlement and materialization before returning-player operations. Biological
|
||||
migration remains bundle 10 only. Rules-9 census is unsupported pending separate
|
||||
qualification; unavailable evidence prevents a complete global result and cannot
|
||||
prove zero life or terminal extinction. Ecology/environment/actual-days/product
|
||||
migration remains bundle 10 only. ADR-0159 subsequently admits rules-9 retained
|
||||
body/reserve to census projection 1 and the verified history/registered snapshot
|
||||
readers. Mixed rule cuts or unavailable evidence prevent a complete result and
|
||||
cannot prove zero life or terminal extinction. Ecology/environment/actual-days/product
|
||||
qualification remains separate.
|
||||
|
||||
@@ -5,7 +5,8 @@ immutable genome records and permanent resident IDs retained privately by these
|
||||
observations. They require exact declared coverage and boundaries before querying
|
||||
multiple regions; no public row, biological codec or rule version changes.
|
||||
|
||||
Authority: [ADR-0150](../../docs/adr/0150-regional-cellular-census-projection.md),
|
||||
Authority: [ADR-0150](../../docs/adr/0150-regional-cellular-census-projection.md)
|
||||
and [ADR-0159](../../docs/adr/0159-maturing-cellular-census.md),
|
||||
under [ADR-0133](../../docs/adr/0133-ecological-identity-and-time-evidence.md).
|
||||
Portable API: `evo::server::CellularCensus`. This is an in-memory observation
|
||||
contract, not a persistent codec, network message or complete world evidence set.
|
||||
@@ -14,10 +15,19 @@ contract, not a persistent codec, network message or complete world evidence set
|
||||
|
||||
The boundary records exact world, region, frame, completed simulation tick,
|
||||
50,000 µs quantum and owner/rules/population versions. Raw observation has
|
||||
population format zero; exact populations retain envelope 1 or 2. Only rules 8,
|
||||
owner 6/7 and those exact representations are supported. Unsupported sources fail.
|
||||
population format zero; exact populations retain envelope 1 or 2. Rules 8 with
|
||||
owner 6/7 retain their support. Rules 9 requires owner 7 and either raw or
|
||||
population envelope 2. Unsupported sources fail.
|
||||
The projection version is 1, separately from every biological/checkpoint format.
|
||||
|
||||
Maturation reads the exact retained body and reserve of each life. It does not
|
||||
substitute adult target size, count a growing organism twice or include spent
|
||||
construction heat. No-tick rule upgrades remain distinct committed history cuts.
|
||||
Existing history/snapshot readers replay each supported cut before projection;
|
||||
they never reinterpret a retained rules-8 cut using the current head's rules.
|
||||
Regional sets still reject mixed rules 8/9, even at equal ticks. Matching raw and
|
||||
cohort observations can coexist when every biological boundary agrees.
|
||||
|
||||
Rows are unique and ascending by immutable genome ID. Each retains its genome
|
||||
schema, development version and exact parent IDs, including ancestors with no
|
||||
resident carriers. These links describe genome ancestry; they do not fabricate
|
||||
@@ -70,10 +80,12 @@ destination ghost can be observed for comparison but cannot be published as owne
|
||||
world stock. Before paired migration commit, the frozen committed source owns
|
||||
migrants; afterwards only the committed destination owns them.
|
||||
|
||||
Durable M12.6 publication must derive this projection from a verified committed
|
||||
payload, bind its manifest/digest and branch, and append evidence atomically with
|
||||
the biological head. M12.7 must reconcile every required owner/store at a complete
|
||||
watermark. Neither operation is implemented by this local projection.
|
||||
The [committed history reader](committed-cellular-history-v1.md) derives this
|
||||
projection from the existing atomic biological journal after complete replay,
|
||||
binding its exact manifest/digest without a redundant census write. Registered
|
||||
snapshots additionally capture database history domain, required region coverage
|
||||
and pending handoffs. M12.7 must still reconcile every required viable store at a
|
||||
complete watermark; that global decision is outside this local projection.
|
||||
|
||||
ADR-0151 now binds projections on read to the existing atomic immutable biological
|
||||
journal through [committed regional history](committed-cellular-history-v1.md).
|
||||
|
||||
@@ -51,7 +51,10 @@ CellularCensus::observe(const CellularPopulation& population) {
|
||||
std::expected<CellularCensus, CellularCensusError>
|
||||
CellularCensus::observe(const CellularLives& state, std::span<const CellularCohortMember> members,
|
||||
std::uint32_t population) {
|
||||
if (state.rules_version() != cellular_lives_foraging_rules ||
|
||||
const bool maturing = state.rules_version() == cellular_lives_maturation_rules &&
|
||||
state.format_version() == cellular_lives_migration_format &&
|
||||
(population == 0 || population == 2);
|
||||
if ((!maturing && state.rules_version() != cellular_lives_foraging_rules) ||
|
||||
(state.format_version() != cellular_lives_presence_format &&
|
||||
state.format_version() != cellular_lives_migration_format) ||
|
||||
(population != 0 && population != 1 && population != 2))
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -195,12 +195,14 @@ void funded_source(Fixture& f) {
|
||||
"ON CONFLICT DO NOTHING",
|
||||
build, 5s),
|
||||
"retain test build");
|
||||
take(f.owner->query("INSERT INTO evolution.life_allocators VALUES(30201,100)", {}, 5s),
|
||||
const std::array<std::string, 1> world{std::to_string(f.key.world)};
|
||||
take(f.owner->query("INSERT INTO evolution.life_allocators VALUES($1::evolution.u64,100)",
|
||||
world, 5s),
|
||||
"test allocator");
|
||||
f.objects = take(
|
||||
FilesystemObjectStore::open(environment("PGHOST"), f.key, max_cellular_population_bytes),
|
||||
"population object namespace");
|
||||
f.raw = opening(30001, true, 4, false);
|
||||
f.raw = opening(f.key.world - 200, true, 4, false, f.key.region);
|
||||
f.head =
|
||||
take(provision_cellular_region(*f.owner, *f.objects, f.key, 1, *f.raw, f.id(), f.build, 5s),
|
||||
"empty cellular genesis");
|
||||
@@ -791,6 +793,176 @@ void history_pages(Fixture& f) {
|
||||
"history transaction requirement changed for read-only callers");
|
||||
std::puts("committed census history pagination, replay, transaction and failure guards passed");
|
||||
}
|
||||
void maturing_census() {
|
||||
Fixture f;
|
||||
f.key = {30202, 1};
|
||||
f.next_id = 40000;
|
||||
funded_source(f);
|
||||
const std::array<Sha256Digest, 1> builds{f.build};
|
||||
const auto recover_raw = [&] {
|
||||
auto recovered =
|
||||
take(recover_cellular_checkpoint(*f.db, *f.objects, f.key, f.lease, builds, 5s),
|
||||
"census raw recovery");
|
||||
f.head = std::move(recovered.committed);
|
||||
f.raw = std::move(recovered.state);
|
||||
};
|
||||
f.head = take(
|
||||
migrate_cellular_boundary_profile(*f.db, *f.objects, f.lease, f.head, f.id(), f.build, 5s),
|
||||
"census boundary source");
|
||||
recover_raw();
|
||||
std::vector<CellularCensusHistoryEntry> expected;
|
||||
expected.push_back({f.head, take(CellularCensus::observe(*f.raw), "old census oracle")});
|
||||
auto reader = connection();
|
||||
std::array<CellularCensusRegionRequest, 1> requests{{{1, f.lease, f.objects.get()}}};
|
||||
const auto snapshot = [&](const CellularCensusSnapshotHooks& hooks = {}) {
|
||||
return load_registered_cellular_census_snapshot(*reader, f.key.world, requests, builds, 5s,
|
||||
hooks);
|
||||
};
|
||||
const auto verify_snapshot = [&](const RegisteredCellularCensusSnapshot& view,
|
||||
const CellularCensusHistoryEntry& oracle) {
|
||||
require(view.catalog.size() == 1 && view.snapshot.cuts.size() == 1 &&
|
||||
view.snapshot.cuts.front().head == oracle.committed.head &&
|
||||
view.snapshot.cuts.front().manifest == oracle.committed.manifest &&
|
||||
view.snapshot.census.boundary().rules == oracle.census.boundary().rules,
|
||||
"maturing snapshot rebound the captured cut");
|
||||
for (const auto& row : oracle.census.rows())
|
||||
for (const auto scope :
|
||||
{CellularCensusScope::exact_genome, CellularCensusScope::descendants})
|
||||
require(take(view.snapshot.census.query(row.genome, scope), "snapshot stock") ==
|
||||
take(oracle.census.query(row.genome, scope), "oracle stock"),
|
||||
"maturing snapshot lost or invented retained stock");
|
||||
};
|
||||
CellularCensusSnapshotHooks upgrade;
|
||||
upgrade.after_head = [&](std::size_t index) {
|
||||
require(index == 0, "unexpected census upgrade capture index");
|
||||
f.head = take(migrate_cellular_maturation_profile(*f.db, *f.objects, f.lease, f.head,
|
||||
f.id(), f.build, 5s),
|
||||
"captured maturation");
|
||||
recover_raw();
|
||||
};
|
||||
const auto old_view = take(snapshot(upgrade), "snapshot spanning maturation");
|
||||
verify_snapshot(old_view, expected.front());
|
||||
expected.push_back({f.head, take(CellularCensus::observe(*f.raw), "mature raw oracle")});
|
||||
require(expected[0].committed.head.end_tick == expected[1].committed.head.end_tick &&
|
||||
expected[0].census.boundary().rules == 8 &&
|
||||
expected[1].census.boundary().rules == 9 &&
|
||||
std::ranges::equal(expected[0].census.rows(), expected[1].census.rows()),
|
||||
"no-tick maturation changed census stock or erased source rules");
|
||||
verify_snapshot(take(snapshot(), "upgraded registered snapshot"), expected.back());
|
||||
f.head = take(migrate_cellular_to_population(*f.db, *f.objects, f.lease, f.head, f.id(),
|
||||
f.build, {true, 1200, 1800}, 5s),
|
||||
"maturing population entry");
|
||||
recover(f);
|
||||
expected.push_back({f.head, take(CellularCensus::observe(*f.population), "population oracle")});
|
||||
const auto wildlife = std::ranges::find_if(f.population->state().lives(), [](const auto& life) {
|
||||
return life.account == LifeAccount{};
|
||||
});
|
||||
require(wildlife != f.population->state().lives().end(), "maturing census lost real juvenile");
|
||||
const auto collapsed = take(prepare_population_conversion(*f.population, f.header(0),
|
||||
{wildlife->identity.genome, true}),
|
||||
"maturing census cohort");
|
||||
f.head = take(publish_population_batch(*f.db, *f.objects, f.lease, f.head, collapsed.batch,
|
||||
*collapsed.state, f.id(), f.build, 5s),
|
||||
"maturing census collapse publication");
|
||||
recover(f);
|
||||
expected.push_back({f.head, take(CellularCensus::observe(*f.population), "cohort oracle")});
|
||||
auto growing = unattended(f);
|
||||
bool grew = false;
|
||||
for (const auto& life : growing.state->state().lives()) {
|
||||
const auto old = std::ranges::find(f.population->state().lives(), life.identity.life,
|
||||
[](const auto& cell) { return cell.identity.life; });
|
||||
grew |= old != f.population->state().lives().end() &&
|
||||
life.growth.realized_per_thousand > old->growth.realized_per_thousand;
|
||||
}
|
||||
require(grew, "committed census never exercised funded juvenile growth");
|
||||
take(admit_population_interval(*f.db, f.key, f.lease, f.head.head,
|
||||
growing.batch.header.end_tick, 5s),
|
||||
"admit census growth interval");
|
||||
f.head = take(publish_population_batch(*f.db, *f.objects, f.lease, f.head, growing.batch,
|
||||
*growing.state, f.id(), f.build, 5s),
|
||||
"publish census growth interval");
|
||||
recover(f);
|
||||
require(f.population->snapshot() == growing.state->snapshot(), "census growth replay differs");
|
||||
expected.push_back(
|
||||
{f.head, take(CellularCensus::observe(*f.population), "grown cohort oracle")});
|
||||
const auto physical = f.population->state().snapshot();
|
||||
CellularCensusSnapshotHooks materialize;
|
||||
materialize.after_head = [&](std::size_t index) {
|
||||
require(index == 0, "unexpected materialization capture index");
|
||||
f.head = take(
|
||||
materialize_population_profile(*f.db, *f.objects, f.lease, f.head, f.id(), f.build, 5s),
|
||||
"captured maturing materialization");
|
||||
recover_raw();
|
||||
};
|
||||
verify_snapshot(take(snapshot(materialize), "snapshot spanning materialization"),
|
||||
expected.back());
|
||||
require(f.raw->snapshot() == physical, "materialization changed observed growing biology");
|
||||
expected.push_back({f.head, take(CellularCensus::observe(*f.raw), "grown raw oracle")});
|
||||
verify_snapshot(take(snapshot(), "materialized registered snapshot"), expected.back());
|
||||
require(expected[4].census.boundary().population_format == 2 &&
|
||||
expected[5].census.boundary().population_format == 0 &&
|
||||
expected[4].committed.head.end_tick == expected[5].committed.head.end_tick,
|
||||
"same-tick materialization lost its distinct source representation");
|
||||
const auto first = expected.front().committed.head.sequence;
|
||||
const auto read = [&](const RegionHead& watermark, std::uint64_t start, std::size_t limit) {
|
||||
return load_cellular_census_history(*f.db, *f.objects, f.key, f.lease, watermark, start,
|
||||
limit, builds, 5s);
|
||||
};
|
||||
for (std::size_t offset = 0; offset < expected.size(); offset += 2) {
|
||||
const auto page = take(read(f.head.head, first + offset, 2), "maturing history page");
|
||||
require(page.watermark == f.head.head && page.entries.size() == 2 &&
|
||||
page.next_sequence == (offset + 2 < expected.size()
|
||||
? std::optional<std::uint64_t>{first + offset + 2}
|
||||
: std::nullopt),
|
||||
"maturing history skipped a cut or changed its watermark");
|
||||
for (std::size_t index = 0; index < page.entries.size(); ++index) {
|
||||
const auto& entry = page.entries[index];
|
||||
const auto& oracle = expected[offset + index];
|
||||
require(entry.committed.head == oracle.committed.head &&
|
||||
entry.committed.manifest == oracle.committed.manifest &&
|
||||
entry.census.boundary() == oracle.census.boundary() &&
|
||||
std::ranges::equal(entry.census.rows(), oracle.census.rows()),
|
||||
"committed growth census differs from exact retained oracle");
|
||||
}
|
||||
}
|
||||
const auto pinned =
|
||||
take(read(expected[1].committed.head, first, 8), "pinned pre-growth history");
|
||||
require(pinned.entries.size() == 2 && !pinned.next_sequence &&
|
||||
pinned.entries[0].census.boundary().rules == 8 &&
|
||||
pinned.entries[1].census.boundary().rules == 9,
|
||||
"later growth reinterpreted a pinned old rules cut");
|
||||
for (const auto cut : {std::size_t{1}, expected.size() - 1}) {
|
||||
const auto manifest =
|
||||
take(decode_manifest(expected[cut].committed.manifest), "denied census manifest");
|
||||
const UnreadableObject denied{f.objects->directory() /
|
||||
hexadecimal(manifest.payload_sha256, false)};
|
||||
require(!read(f.head.head, first + cut - 1, 2),
|
||||
"missing growing object returned a partial history page");
|
||||
if (cut == expected.size() - 1)
|
||||
require(!snapshot(), "missing current growing object became a registered zero census");
|
||||
}
|
||||
require(!load_registered_cellular_census_snapshot(*reader, f.key.world, requests, {}, 5s) &&
|
||||
!load_cellular_census_history(*f.db, *f.objects, f.key, f.lease, f.head.head, first,
|
||||
2, {}, 5s),
|
||||
"unretained growing build returned a census");
|
||||
auto false_cut = f.head.head;
|
||||
false_cut.digest.back() ^= 1;
|
||||
require(!read(false_cut, first, 2), "growing history accepted a false watermark");
|
||||
const auto stale = f.lease;
|
||||
take(release_region_lease(*f.db, f.key, f.lease, 5s), "release census authority");
|
||||
f.lease =
|
||||
take(acquire_region_lease(*f.db, f.key, f.build, 60000ms, 5s), "replace census authority");
|
||||
require(!snapshot() && !load_cellular_census_history(*f.db, *f.objects, f.key, stale,
|
||||
f.head.head, first, 2, builds, 5s),
|
||||
"growing census ignored a stale fence");
|
||||
requests.front().lease = f.lease;
|
||||
verify_snapshot(take(snapshot(), "fresh growing census authority"), expected.back());
|
||||
require(take(load_region_checkpoint(*f.db, f.key, 5s), "read-only growing census head").head ==
|
||||
f.head.head &&
|
||||
f.raw->snapshot() == physical,
|
||||
"census modified committed growth");
|
||||
std::puts("maturing census history, registered capture races, stock and failure guards passed");
|
||||
}
|
||||
void registered_snapshot_coverage(Fixture& f) {
|
||||
constexpr std::uint64_t seed = 31001, world = seed + 200;
|
||||
const std::array<Sha256Digest, 1> builds{f.build};
|
||||
@@ -3300,5 +3472,6 @@ void run_population_publication_tests() {
|
||||
fixture.raw = std::move(maturation_source.state);
|
||||
boundary_upgrades(fixture, true);
|
||||
host_ownership_and_admission(fixture);
|
||||
maturing_census();
|
||||
std::puts("population publication, exact recovery, process loss and fencing passed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user