Provision a world's life allocator from the owner provisioner
Foundation / checks (ecs) (push) Successful in 2m27s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / checks (tsan) (push) Successful in 9m29s
Foundation / checks (client) (push) Successful in 16m59s
Foundation / checks (network) (push) Successful in 19m31s
Foundation / checks (postgres) (push) Failing after 21m13s
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 24m4s

The DEV cellular region reported every first-life request as unknown:
world 100 had no life_allocators row, and life-reservations-v1 leaves
that row to the owner with no runtime initializer. evo-world-clone
provision now accepts --life-allocator-start N with the primitive-v1
and cellular-v1 openings. It creates the allocator once before the
genesis check, leaves it untouched on reruns, and refuses a start above
the existing counter.

ADR-0123 records the DEV cellular region bring-up: region 100/2, schema
v33, the trial opening, the allocator start and the 300 s grant ceiling.
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 11:30:16 -04:00
co-authored by Claude Opus 5.5
parent 6615e4325c
commit a3939bda4e
7 changed files with 221 additions and 5 deletions
+40 -3
View File
@@ -17,6 +17,9 @@
// cellular-v1 also requires --width-um N --height-um N --ambient-temperature-mk N
// and one or more ordered --patch X,Y,SOURCE,ENERGY,C,N,P,O values plus a stable --commit
// HEX32.
// primitive-v1 and cellular-v1 accept --life-allocator-start N (ADR-0123): the world's
// life-identity allocator is created once at the operator-audited start N; a later run
// leaves it untouched and refuses one that is below N.
// evo-world-clone compare --world A --region R --other-world B --pg-* ...
// --objects DIR [--other-objects DIR] --retained HEX... [--max-commits N]
//
@@ -103,6 +106,7 @@ struct Options {
std::vector<server::SpawnSite> primitive_sites;
std::optional<std::uint32_t> cellular_width_um, cellular_height_um, cellular_temperature_mk;
std::vector<biology::CellularPatch> cellular_patches;
std::optional<std::uint64_t> life_allocator_start;
std::optional<persistence::Sha256Digest> build;
bool retain_build{};
bool crash{};
@@ -302,7 +306,10 @@ std::optional<Options> parse(int argc, char** argv) {
if (!parsed || o.cellular_patches.size() == biology::max_cellular_patches)
return std::nullopt;
o.cellular_patches.push_back(*parsed);
} else if (o.command == "provision" && flag == "--build" && hex<32>(value))
} else if (o.command == "provision" && flag == "--life-allocator-start" && n && *n > 0 &&
*n < std::numeric_limits<std::uint64_t>::max())
o.life_allocator_start = n;
else if (o.command == "provision" && flag == "--build" && hex<32>(value))
o.build = hex<32>(value);
else if (o.command == "provision" && flag == "--retain-build" && value == "true")
o.retain_build = true;
@@ -350,8 +357,8 @@ std::optional<Options> parse(int argc, char** argv) {
!o.cellular_width_um || !o.cellular_height_um || !o.cellular_temperature_mk ||
o.cellular_patches.empty() || !has_stock || !o.commit)
return std::nullopt;
} else if (primitive_options || cellular_options) {
return std::nullopt;
} else if (primitive_options || cellular_options || o.life_allocator_start) {
return std::nullopt; // The development opening has no lives to allocate.
}
}
if (!complete(o.source) || (needs_builds && o.retained.empty()) ||
@@ -475,6 +482,36 @@ int provision(const Options& o) {
return 3;
}
}
// ADR-0123: the world's life-identity allocator is owner state, created once at the
// operator-audited start before any genesis check, so an already provisioned region
// still gets it. It only ever advances, so one below the start is a conflict.
if (o.life_allocator_start) {
const std::array<std::string, 2> p{std::to_string(o.source.key.world),
std::to_string(*o.life_allocator_start)};
const std::array<std::string, 1> world{p[0]};
auto rows = db->query("INSERT INTO evolution.life_allocators(world_id, next_identity) "
"VALUES ($1::evolution.u64, $2::evolution.u64) "
"ON CONFLICT (world_id) DO NOTHING",
p, timeout);
if (rows)
rows = db->query("SELECT next_identity FROM evolution.life_allocators "
"WHERE world_id = $1::evolution.u64",
world, timeout);
const auto next = rows && rows->size() == 1 && (*rows)[0].size() == 1 && (*rows)[0][0]
? number(*(*rows)[0][0])
: std::nullopt;
if (!next) {
std::puts("life-allocator refused");
return 3;
}
if (*next < *o.life_allocator_start) {
std::puts("life-allocator refused existing below start");
return 4;
}
std::printf("life-allocator world=%llu next=%llu\n",
static_cast<unsigned long long>(o.source.key.world),
static_cast<unsigned long long>(*next));
}
std::unique_ptr<server::PrimitiveLives> primitive_opening;
std::unique_ptr<server::CellularLives> cellular_opening;
if (primitive || cellular) {