feat(cellular): region ticks of up to 4,096 lives for testing (schema 68)
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / postgres-tools (push) Successful in 31s
Foundation / server-image (push) Successful in 4m29s
Foundation / image (push) Successful in 5m43s

ADR-0182 section 17. The plan's 2,000-organism cap became the rules-12
key region.organism_cap, which was parsed but never enforced; the real
bound was max_cellular_tick_lives = 256 (ADR-0106), which rules 13's
organism cap could not exceed. The bound is now 4,096, for testing limits
only; the DEV tuning file keeps 256.

- max_cellular_tick_lives (4,096) bounds the raw region path: step, owner
  state, batch trace (cellular_batch_bytes_for) and current checkpoint
  traces. max_cellular_frozen_lives (256) keeps cohort populations,
  population batches, migration traces and pre-v3 cellular traces, whose
  database checks are fixed.
- Tuning: reproduction.organism_cap and wildlife_cap accept up to 4,096.
- Schema 68: the trace checker under the current publishers
  (cellular_births_v45) accepts 4,096 intents, births and mutations per
  tick; spawn_wildlife takes up to 256 cells a command.
- Region view and portal: the lineage archive's fill (births of 65,536,
  genomes of 4,096), at which a region stops ticking.
- PostgreSQL suite: 256 wildlife spawned in one command, then a 289-life
  tick published and recovered exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-28 17:30:22 -04:00
co-authored by Claude Opus 5.5
parent 8005e7c4ae
commit 3c753970c8
29 changed files with 301 additions and 49 deletions
+4 -2
View File
@@ -96,8 +96,10 @@ void renders_cells_and_deposits() {
"bubble totals");
require(text.find("\"drip\"") == std::string::npos, "a drip before rules 13");
require(text.find("],\"heat\":" + std::to_string(state->heat().energy.value) +
",\"cells_total\":") != std::string::npos,
"heat");
",\"archive\":[" + std::to_string(state->archive().recorded()) +
",65536," + std::to_string(state->archive().archived()) +
",4096],\"cells_total\":") != std::string::npos,
"heat and archive");
}
}
+1 -1
View File
@@ -245,7 +245,7 @@ void trace_contract(bool maturing = false) {
}
altered = trace;
altered.members.clear();
for (std::uint64_t i = 1; i <= biology::max_cellular_tick_lives; ++i)
for (std::uint64_t i = 1; i <= biology::max_cellular_frozen_lives; ++i)
altered.members.push_back(cellular_bud_identity(3, i));
auto maximum = checked(encode_migration_trace(altered), "maximum pair codec");
require(maximum.size() == max_migration_trace_bytes &&
+37
View File
@@ -1593,6 +1593,7 @@ void run_starting_wildlife_publication_tests() {
auto tuned_rules = recovered->state->revamp_rules();
auto& upkeep = tuned_rules.body.essential_upkeep_per_thousand;
upkeep = upkeep == 100 ? 101 : 100;
tuned_rules.organism_cap = 4'096; // Section 17: room for the crowded tick below.
CHECK(evo::server::cellular_revamp_valid(tuned_rules) &&
tuned_rules != recovered->state->revamp_rules());
const auto tuned_digest = checked_value(
@@ -1637,6 +1638,42 @@ void run_starting_wildlife_publication_tests() {
recovered = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
CHECK(recovered && recovered->state->snapshot() == adopted_bytes &&
recovered->state->revamp_rules() == tuned_rules);
// ADR-0182 section 17 (schema 68): 256 wildlife in one command, then a tick of more than
// 256 lives, publish and recover exactly.
const auto [crowd_id, crowd_first] = enqueue(6, 256, 0, 0);
const std::vector<evo::server::CellularAdminCommand> crowd{
{static_cast<std::uint64_t>(crowd_id), Kind::spawn_wildlife, 256, crowd_first, {}}};
auto spawn_batch = admin_batch(crowd);
spawn_batch.header = {key.world, key.region, 1, head.head.commit, head.head.digest, 4, 5};
spawn_batch.ticks.front().lives = checked_value(wildlife_intents(*recovered->state, 5));
CHECK(recovered->state->advance_tick(spawn_batch.ticks.front().lives));
std::vector<evo::server::CellularAdminResult> crowd_results;
auto spawned = recovered->state->admin_candidate(crowd, &crowd_results);
CHECK(spawned && crowd_results.size() == 1 && crowd_results.front().applied &&
(*spawned)->lives().size() > 256);
auto spawn_publish = publish_cellular_batch(*runtime, **objects, *lease, head, spawn_batch,
**spawned, identity(13), build, 5s);
CHECK(spawn_publish);
head = spawn_publish->committed;
recovered = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
CHECK(recovered && recovered->state->snapshot() == (*spawned)->snapshot());
auto& crowded = recovered->state;
CellularBatch crowded_batch{
{key.world, key.region, 1, head.head.commit, head.head.digest, 5, 6}, {{}}};
crowded_batch.ticks.front().lives = checked_value(wildlife_intents(*crowded, 6));
CHECK(crowded_batch.ticks.front().lives.size() > 256);
CHECK(crowded->advance_tick(crowded_batch.ticks.front().lives));
const auto crowded_bytes = crowded->snapshot();
auto crowded_publish = publish_cellular_batch(*runtime, **objects, *lease, head, crowded_batch,
*crowded, identity(14), build, 5s);
CHECK(crowded_publish);
head = crowded_publish->committed;
recovered = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
CHECK(recovered && recovered->state->snapshot() == crowded_bytes &&
recovered->state->lives().size() > 256);
std::printf("crowded tick: %zu lives, %zu snapshot bytes (%zu at 33 lives)\n",
recovered->state->lives().size(), crowded_bytes.size(), applied_bytes.size());
CHECK(release_region_lease(*runtime, key, *lease, 5s));
std::puts("starting wildlife publication and replacement-owner replay passed");
}
+1 -1
View File
@@ -893,7 +893,7 @@ void admin_commands_apply_and_replay() {
{7, Kind::remove_cell, 0, 424'242, {}}, // No such life: refused, nothing changes.
};
for (const auto& bad : {CellularAdminCommand{8, Kind::add_pool, 0, 0, {}},
CellularAdminCommand{8, Kind::spawn_wildlife, 65, 900'000, {}},
CellularAdminCommand{8, Kind::spawn_wildlife, 257, 900'000, {}},
CellularAdminCommand{8, Kind::add_bubbles, 0, 0, pool},
CellularAdminCommand{0, Kind::add_pool, 0, 0, pool}})
require(!cellular_admin_command_valid(bad), "an invalid command shape was accepted");
+1 -1
View File
@@ -560,7 +560,7 @@ void admin_api_tests(const Realm& realm) {
{"/api/regions/1/commands", "/api/regions/1/commands?kind=explode",
"/api/regions/1/commands?kind=add_pool", "/api/regions/1/commands?kind=add_pool&energy=x",
"/api/regions/1/commands?kind=remove_cell&target=7&energy=5",
"/api/regions/1/commands?kind=spawn_wildlife&count=65",
"/api/regions/1/commands?kind=spawn_wildlife&count=257",
"/api/regions/1/commands?kind=take_reserve&target=7",
"/api/regions/1/commands?kind=remove_wildlife&target=7",
"/api/regions/1/commands?kind=remove_wildlife&energy=1"})
+2 -1
View File
@@ -233,6 +233,7 @@ void upgrade_across_migration_and_barrier() {
" -v migration_sha_65=$(s 0065_admin_schedules.sql)"
" -v migration_sha_66=$(s 0066_tuning_revisions.sql)"
" -v migration_sha_67=$(s 0067_admin_take_and_cull.sql)"
" -v migration_sha_68=$(s 0068_larger_region_ticks.sql)"
" -v runtime_role=evo_runtime_test -f migrations/apply.sql"
" > /dev/null 2>&1") != 0);
CHECK(history(*owner_db) == "1,2,3,4,5,6,7");
@@ -250,7 +251,7 @@ void upgrade_across_migration_and_barrier() {
"tools/migrate-postgres.sh\" > /dev/null") == 0);
CHECK(history(*owner_db) == "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,"
"25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,"
"47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67");
"47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68");
CHECK(scalar(*owner_db, "SELECT (c.condeferrable AND c.condeferred AND "
"c.confrelid = 'evolution.region_commits'::regclass)::text "
"FROM pg_catalog.pg_constraint c WHERE c.conrelid = "