Pin the cellular v4 bundle and admit it in schema v34
Foundation / checks (checks) (push) Successful in 41m8s
Foundation / checks (deploy) (push) Successful in 4m26s
Foundation / checks (ecs) (push) Successful in 2m29s
Foundation / checks (network) (push) Successful in 19m43s
Foundation / checks (postgres) (push) Successful in 44m7s
Foundation / checks (tsan) (push) Successful in 10m5s
Foundation / checks (client) (push) Successful in 13m57s
Foundation / postgres-tools (push) Successful in 1m24s
Foundation / image (push) Successful in 3m20s
Foundation / server-image (push) Successful in 3m23s

ADR-0124: checkpoints pin cellular bundle v4 (rules 3, owner envelope 4,
revision archive) with the revision history profile and format-3 traces.
A format-4/rules-3 opening provisions on v4, and evo-world-clone accepts
--opening cellular-v2 for it. Migration 34 widens canonical action input
validation to target kind 2 (engulf, no coordinates), admits v4 manifests
through the existing v3 parser chain, and lets birth binding read
format-3 traces for v3 and v4. The migration runner and its checks extend
to version 34, with SQL and provisioning tests for v4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 19:11:43 -04:00
co-authored by Claude Opus 5.5
parent e17ade8cb7
commit bf5c626f19
15 changed files with 380 additions and 95 deletions
+29
View File
@@ -504,6 +504,35 @@ void cellular_profile() {
after_revision_migration->cellular_versions == cellular_v3_versions &&
after_revision_migration->history_profile == cellular_revision_history_profile);
// ADR-0124: a rules-3 owner restores only under the v4 bundle and revision history.
auto engulf_primitive = PrimitiveLives::create({7, 3, 9, 17, funding, {{0, 0}}});
auto engulf_habitat = CellularHabitat::create({7, 3, 9, 1'000, 1'000, {}});
CHECK(engulf_primitive && engulf_habitat);
auto engulf_owner =
CellularLives::create(**engulf_primitive, std::move(*engulf_habitat),
{{1'000, 1'000}, 0, 293'150}, CellularLivesProfile::engulf);
CHECK(engulf_owner);
const auto engulf_payload = (*engulf_owner)->snapshot();
auto v4 = genesis_manifest(key, 9, filled<16>(0x30), 50000, build, engulf_payload.size(),
filled<32>(0x31), CheckpointProfile::cellular_lives_v1);
CHECK(v4);
v4->cellular_versions = cellular_v4_versions;
v4->history_profile = cellular_revision_history_profile;
CHECK(supported(*v4) && cellular_revision_bundle(v4->cellular_versions));
const auto v4_bytes = encode_manifest(*v4);
CHECK(v4_bytes && decode_manifest(*v4_bytes) == *v4);
CHECK(restore_cellular_payload(engulf_payload, *v4));
auto v4_wrong_history = *v4;
v4_wrong_history.history_profile = cellular_history_profile;
CHECK(!supported(v4_wrong_history));
auto as_v3 = *v4;
as_v3.cellular_versions = cellular_v3_versions;
CHECK(!restore_cellular_payload(engulf_payload, as_v3)); // Envelope and rules differ.
const auto v4_next =
successor_manifest(*v4, filled<32>(0x32), filled<16>(0x33), lease(), 1, build,
engulf_payload.size(), filled<32>(0x34), batch_for(1, 1));
CHECK(v4_next && supported(*v4_next) && v4_next->cellular_versions == cellular_v4_versions);
auto bad_identity = *manifest;
bad_identity.key.region = 4;
const auto wrong_identity = restore_cellular_payload(payload, bad_identity);
+11 -1
View File
@@ -212,7 +212,7 @@ void upgrade_across_migration_and_barrier() {
" EVO_PG_RUNTIME_ROLE=evo_runtime_test bash \"$EVO_SOURCE_ROOT/"
"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");
"25,26,27,28,29,30,31,32,33,34");
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 = "
@@ -242,6 +242,16 @@ void upgrade_across_migration_and_barrier() {
"repeat('00', 23), 'hex'), 1)::text") == "true");
CHECK(scalar(*owner_db, "SELECT evolution.valid_cellular_action_input(decode(repeat('00', 24), "
"'hex'), 1)::text") == "false");
// Schema v34 (ADR-0124): target kind 2 is engulf, with no coordinates; kind 3 is unknown.
CHECK(scalar(*owner_db,
"SELECT evolution.valid_cellular_action_input(decode('01' || "
"repeat('00', 11) || '02' || repeat('00', 11), 'hex'), 1)::text") == "true");
CHECK(scalar(*owner_db, "SELECT evolution.valid_cellular_action_input(decode('01' || "
"repeat('00', 11) || '02' || repeat('00', 3) || '01' || "
"repeat('00', 7), 'hex'), 1)::text") == "false");
CHECK(scalar(*owner_db,
"SELECT evolution.valid_cellular_action_input(decode('01' || "
"repeat('00', 11) || '03' || repeat('00', 11), 'hex'), 1)::text") == "false");
CHECK(scalar(*owner_db,
"SELECT evolution.check_cellular_action_block(decode(repeat('01', 16) || "
"'0100000000000000' || '0100000000000000' || repeat('00', 16), 'hex'), "
+84 -54
View File
@@ -431,65 +431,94 @@ void provisioning_creates_the_life_allocator_once() {
// ADR-0123: an image promotion changes --build, but a cellular genesis records the
// build that wrote it. A rerun under a new build still resolves the same genesis,
// while a different commit or opening is refused.
void cellular_provisioning_survives_a_build_promotion() {
using evo::biology::primitive_endowment;
const ServerRegion r{{9761, 1}, fresh("cellular-provision-9761")};
const auto endowed = primitive_endowment();
// One cellular provisioning run for region 1 of `world` with a one-founder opening.
std::vector<std::string> provision_cellular(const ServerRegion& r, const std::string& world,
const std::string& opening, const std::string& build,
const std::string& commit, const std::string& patch,
int& code) {
const auto endowed = evo::biology::primitive_endowment();
CHECK(endowed);
evo::accounting::Inventory funding = endowed->body;
funding.energy.value += endowed->reserve.energy.value + endowed->construction.value;
Child tool{{env("EVO_WORLD_CLONE_BIN"),
"provision",
"--world",
world,
"--region",
"1",
"--opening",
opening,
"--pg-host",
env("PGHOST"),
"--pg-port",
env("PGPORT"),
"--pg-database",
env("PGDATABASE"),
"--pg-user",
env("PGUSER"),
"--objects",
r.root.string(),
"--build",
build,
"--retain-build",
"true",
"--commit",
commit,
"--frame",
"9",
"--source-id",
"1",
"--funding-energy-pj",
std::to_string(funding.energy.value),
"--funding-carbon-fg",
std::to_string(funding.matter[0].value),
"--funding-nitrogen-fg",
std::to_string(funding.matter[1].value),
"--funding-phosphorus-fg",
std::to_string(funding.matter[2].value),
"--funding-other-fg",
std::to_string(funding.matter[3].value),
"--site",
"2500,2500",
"--width-um",
"10000",
"--height-um",
"10000",
"--ambient-temperature-mk",
"293150",
"--patch",
patch}};
code = tool.wait_exit(30s);
return tool.lines();
}
// ADR-0124: cellular-v2 provisions a rules-3 genesis under the v4 bundle (schema v34),
// resolves it again on rerun, and refuses the same region asked for as cellular-v1.
void cellular_v2_provisioning_uses_the_engulf_bundle() {
const ServerRegion r{{9762, 1}, fresh("cellular-v2-provision-9762")};
const std::string build(64, 'e');
const std::string commit(32, 'f');
const std::string patch = "3000,3000,2,1000,1000,1000,1000,1000";
int code = -1;
const auto first = provision_cellular(r, "9762", "cellular-v2", build, commit, patch, code);
CHECK(code == 0 && has(first, "provisioned world=9762 region=1 sequence=0 tick=0"));
const auto again = provision_cellular(r, "9762", "cellular-v2", build, commit, patch, code);
CHECK(code == 0 && has(again, "already-provisioned world=9762 region=1 sequence=0 tick=0"));
const auto older = provision_cellular(r, "9762", "cellular-v1", build, commit, patch, code);
CHECK(code == 4);
auto db = owner();
const auto head = load_region_checkpoint(*db, r.key, 5s);
CHECK(head);
const auto manifest = decode_manifest(head->manifest);
CHECK(manifest && manifest->cellular_versions == cellular_v4_versions &&
manifest->history_profile == cellular_revision_history_profile);
}
void cellular_provisioning_survives_a_build_promotion() {
const ServerRegion r{{9761, 1}, fresh("cellular-provision-9761")};
const auto run = [&](const std::string& build, const std::string& commit,
const std::string& patch, int& code) {
Child tool{{env("EVO_WORLD_CLONE_BIN"),
"provision",
"--world",
"9761",
"--region",
"1",
"--opening",
"cellular-v1",
"--pg-host",
env("PGHOST"),
"--pg-port",
env("PGPORT"),
"--pg-database",
env("PGDATABASE"),
"--pg-user",
env("PGUSER"),
"--objects",
r.root.string(),
"--build",
build,
"--retain-build",
"true",
"--commit",
commit,
"--frame",
"9",
"--source-id",
"1",
"--funding-energy-pj",
std::to_string(funding.energy.value),
"--funding-carbon-fg",
std::to_string(funding.matter[0].value),
"--funding-nitrogen-fg",
std::to_string(funding.matter[1].value),
"--funding-phosphorus-fg",
std::to_string(funding.matter[2].value),
"--funding-other-fg",
std::to_string(funding.matter[3].value),
"--site",
"2500,2500",
"--width-um",
"10000",
"--height-um",
"10000",
"--ambient-temperature-mk",
"293150",
"--patch",
patch}};
code = tool.wait_exit(30s);
return tool.lines();
return provision_cellular(r, "9761", "cellular-v1", build, commit, patch, code);
};
const std::string first_build(64, 'c');
const std::string second_build = std::string(63, 'c') + "d";
@@ -515,6 +544,7 @@ void run_region_store_tests() {
primitive_provisioning_is_explicit_and_profile_safe();
provisioning_creates_the_life_allocator_once();
cellular_provisioning_survives_a_build_promotion();
cellular_v2_provisioning_uses_the_engulf_bundle();
full_volumes_publish_nothing();
failing_writes_leave_nothing();
check_store_qualifies_the_stores();