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
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:
@@ -345,11 +345,92 @@ void primitive_provisioning_is_explicit_and_profile_safe() {
|
||||
recovered->state->config().funding == funding &&
|
||||
recovered->state->config().sites == std::vector<SpawnSite>{{0, 0}, {10000000, 0}});
|
||||
}
|
||||
|
||||
// ADR-0123: provisioning creates the world's life allocator once at the audited
|
||||
// start; reruns leave it untouched, and a start above the existing counter refuses.
|
||||
void provisioning_creates_the_life_allocator_once() {
|
||||
using evo::biology::primitive_endowment;
|
||||
const ServerRegion r{{9760, 1}, fresh("allocator-9760")};
|
||||
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& opening, std::uint64_t start, int& code) {
|
||||
std::vector<std::string> args{
|
||||
env("EVO_WORLD_CLONE_BIN"),
|
||||
"provision",
|
||||
"--world",
|
||||
"9760",
|
||||
"--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",
|
||||
"c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3",
|
||||
"--retain-build",
|
||||
"true",
|
||||
"--life-allocator-start",
|
||||
std::to_string(start)};
|
||||
if (opening == "primitive-v1") {
|
||||
const std::vector<std::string> primitive{"--frame",
|
||||
"3",
|
||||
"--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",
|
||||
"0,0"};
|
||||
args.insert(args.end(), primitive.begin(), primitive.end());
|
||||
}
|
||||
Child tool{args};
|
||||
code = tool.wait_exit(30s);
|
||||
return tool.lines();
|
||||
};
|
||||
const auto next_identity = [] {
|
||||
auto db = owner();
|
||||
auto rows = db->query(
|
||||
"SELECT next_identity FROM evolution.life_allocators WHERE world_id = 9760", {}, 5s);
|
||||
return rows && rows->size() == 1 && (*rows)[0][0] ? *(*rows)[0][0] : std::string{};
|
||||
};
|
||||
int code = -1;
|
||||
const auto development = run("development-v1", 5000, code);
|
||||
CHECK(code == 2 && next_identity().empty()); // No lives, so no allocator.
|
||||
const auto first = run("primitive-v1", 5000, code);
|
||||
CHECK(code == 0 && has(first, "life-allocator world=9760 next=5000") &&
|
||||
has(first, "provisioned world=9760 region=1 sequence=0 tick=0"));
|
||||
const auto retry = run("primitive-v1", 5000, code);
|
||||
CHECK(code == 0 && has(retry, "life-allocator world=9760 next=5000") &&
|
||||
has(retry, "already-provisioned world=9760 region=1 sequence=0 tick=0"));
|
||||
const auto lower = run("primitive-v1", 10, code);
|
||||
CHECK(code == 0 && has(lower, "life-allocator world=9760 next=5000"));
|
||||
const auto higher = run("primitive-v1", 6000, code);
|
||||
CHECK(code == 4 && has(higher, "life-allocator refused existing below start"));
|
||||
CHECK(next_identity() == "5000");
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void run_region_store_tests() {
|
||||
provisioning_is_idempotent();
|
||||
primitive_provisioning_is_explicit_and_profile_safe();
|
||||
provisioning_creates_the_life_allocator_once();
|
||||
full_volumes_publish_nothing();
|
||||
failing_writes_leave_nothing();
|
||||
check_store_qualifies_the_stores();
|
||||
|
||||
Reference in New Issue
Block a user