Resolve a cellular genesis under the build that wrote it
Foundation / checks (checks) (push) Successful in 40m17s
Foundation / checks (deploy) (push) Successful in 3m54s
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (network) (push) Successful in 18m40s
Foundation / checks (postgres) (push) Successful in 42m11s
Foundation / checks (tsan) (push) Successful in 9m39s
Foundation / checks (client) (push) Successful in 13m33s
Foundation / postgres-tools (push) Successful in 1m13s
Foundation / image (push) Successful in 3m10s
Foundation / server-image (push) Successful in 3m16s

Promoting the dev server image changed --build, and the cellular
provision rerun re-encoded the genesis manifest with the new build, so it
refused region 100/2 as a different genesis. The check could also never
pass once the head moved past genesis. Match an unadvanced cellular
genesis under its recorded build, and accept profile and frame past
genesis as the other openings do. A different commit or opening is still
refused. Add a PostgreSQL process test and record the finding in ADR-0123.
Also refresh the dev session window (3 h).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 13:14:15 -04:00
co-authored by Claude Opus 5.5
parent 7271fa684b
commit 5e45be3b6b
5 changed files with 119 additions and 6 deletions
+16 -4
View File
@@ -580,17 +580,29 @@ int provision(const Options& o) {
// Never re-provision or report success for a different profile/frame. // Never re-provision or report success for a different profile/frame.
auto existing = persistence::load_region_checkpoint(*db, o.source.key, timeout); auto existing = persistence::load_region_checkpoint(*db, o.source.key, timeout);
if (existing) { if (existing) {
const auto manifest = persistence::decode_manifest(existing->manifest);
if (cellular) { if (cellular) {
auto same_genesis = // The genesis records the build that wrote it, and image promotions change
persistence::provision_cellular_region(*db, *store, o.source.key, primitive_frame, // --build, so an unadvanced genesis is matched exactly under its own build
*cellular_opening, commit, build, timeout); // (ADR-0123). Past genesis the head is no longer the genesis manifest; as for
// the other openings, the profile and frame identify the region.
if (!manifest ||
manifest->profile != persistence::CheckpointProfile::cellular_lives_v1 ||
manifest->frame != primitive_frame) {
std::puts("provision refused existing profile/frame mismatch");
return 4;
}
if (manifest->sequence > 0)
return report("already-provisioned", existing->head);
auto same_genesis = persistence::provision_cellular_region(
*db, *store, o.source.key, primitive_frame, *cellular_opening, commit,
manifest->build, timeout);
if (same_genesis) if (same_genesis)
return report("already-provisioned", same_genesis->head); return report("already-provisioned", same_genesis->head);
std::puts("provision refused existing cellular region; use its original --commit to " std::puts("provision refused existing cellular region; use its original --commit to "
"resolve genesis"); "resolve genesis");
return 4; return 4;
} }
const auto manifest = persistence::decode_manifest(existing->manifest);
const auto expected_profile = const auto expected_profile =
primitive ? persistence::CheckpointProfile::primitive_lives_v1 primitive ? persistence::CheckpointProfile::primitive_lives_v1
: persistence::CheckpointProfile::environmental_lineage_v1; : persistence::CheckpointProfile::environmental_lineage_v1;
@@ -12,7 +12,7 @@ spec:
env: env:
- {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION, value: "dev"}
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
- {name: REGION_SESSION_WINDOW, value: "dev-20261013T165600-97691:1791921360"} - {name: REGION_SESSION_WINDOW, value: "dev-20261013T171415-75125:1791922455"}
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
ports: ports:
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
@@ -62,6 +62,16 @@ region in DEV. Bringing one up exposed four gaps:
identity the DEV lineage run could have issued. That run was about 43,000 identity the DEV lineage run could have issued. That run was about 43,000
ticks, with lineage identities held in region-1 checkpoints rather than in ticks, with lineage identities held in region-1 checkpoints rather than in
SQL. Identities are 64-bit, so the gap is free. SQL. Identities are 64-bit, so the gap is free.
- **Cellular reprovisioning survives image promotions.** The genesis manifest
records the build that wrote it, and every promotion changes `--build`, so
the provision hook refused region 2 after the first promotion
(`provision refused existing cellular region`, although the commit was
unchanged). The check also could never have passed once the head moved past
genesis.
- At sequence 0, an existing cellular region is now matched exactly under
its own recorded build, so a different commit or opening is still refused.
- Past genesis, as for the lineage and primitive openings, a matching profile
and frame identify it.
- **Grants for region 2 must be minted with `--region 2 --lifetime 300` or - **Grants for region 2 must be minted with `--region 2 --lifetime 300` or
less.** Longer probe sessions require a separate, reviewed change to the less.** Longer probe sessions require a separate, reviewed change to the
cellular grant ceiling; this ADR does not make it. cellular grant ceiling; this ADR does not make it.
+9
View File
@@ -7169,3 +7169,12 @@ Executed locally: g++-14 `-std=c++23 -fsyntax-only -Wall -Wextra -Wconversion
-Werror` on both changed files, and clang-format 19.1.5. The PostgreSQL process -Werror` on both changed files, and clang-format 19.1.5. The PostgreSQL process
test runs only in CI. The DEV overlay adopts the flag only after CI publishes test runs only in CI. The DEV overlay adopts the flag only after CI publishes
the server image that contains it. the server image that contains it.
The first sync with the promoted image showed the allocator created
(`life-allocator world=100 next=1000000000000`). It then refused region 2,
because the cellular genesis check re-encoded the manifest with the new
`--build`. Provisioning now matches an unadvanced cellular genesis under its
recorded build, and accepts profile and frame once the head is past genesis.
`region_store_tests` adds a cellular case: a rerun under a new build is
already-provisioned, while another commit or opening is refused. Checked
locally with g++-14 `-Werror`, clang-tidy-19 `--warnings-as-errors=*` and
clang-format 19.1.5; the PostgreSQL process tests run in CI.
+82
View File
@@ -427,12 +427,94 @@ void provisioning_creates_the_life_allocator_once() {
CHECK(code == 4 && has(higher, "life-allocator refused existing below start")); CHECK(code == 4 && has(higher, "life-allocator refused existing below start"));
CHECK(next_identity() == "5000"); CHECK(next_identity() == "5000");
} }
// 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();
CHECK(endowed);
evo::accounting::Inventory funding = endowed->body;
funding.energy.value += endowed->reserve.energy.value + endowed->construction.value;
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();
};
const std::string first_build(64, 'c');
const std::string second_build = std::string(63, 'c') + "d";
const std::string commit(32, 'a');
const std::string patch = "3000,3000,2,1000,1000,1000,1000,1000";
int code = -1;
const auto first = run(first_build, commit, patch, code);
CHECK(code == 0 && has(first, "provisioned world=9761 region=1 sequence=0 tick=0"));
const auto promoted = run(second_build, commit, patch, code);
CHECK(code == 0 && has(promoted, "already-provisioned world=9761 region=1 sequence=0 tick=0"));
const auto other_commit = run(second_build, std::string(32, 'b'), patch, code);
CHECK(code == 4 && has(other_commit, "provision refused existing cellular region; use its "
"original --commit to resolve genesis"));
const auto other_opening =
run(second_build, commit, "4000,4000,2,1000,1000,1000,1000,1000", code);
CHECK(code == 4 && has(other_opening, "provision refused existing cellular region; use its "
"original --commit to resolve genesis"));
}
} // namespace } // namespace
void run_region_store_tests() { void run_region_store_tests() {
provisioning_is_idempotent(); provisioning_is_idempotent();
primitive_provisioning_is_explicit_and_profile_safe(); primitive_provisioning_is_explicit_and_profile_safe();
provisioning_creates_the_life_allocator_once(); provisioning_creates_the_life_allocator_once();
cellular_provisioning_survives_a_build_promotion();
full_volumes_publish_nothing(); full_volumes_publish_nothing();
failing_writes_leave_nothing(); failing_writes_leave_nothing();
check_store_qualifies_the_stores(); check_store_qualifies_the_stores();