Compare commits

..
3 Commits
Author SHA1 Message Date
dingoandClaude Opus 5.5 aa65209601 deploy(dev): refresh the session window
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 5m2s
Foundation / checks (tsan) (push) Successful in 45m7s
Foundation / checks (postgres) (push) Successful in 1h4m37s
Foundation / checks (checks) (push) Successful in 1h44m18s
Foundation / server-image (push) Successful in 5s
Foundation / postgres-tools (push) Successful in 20s
Foundation / image (push) Successful in 6m22s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 16:07:50 -04:00
dingoandClaude Opus 5.5 d1030b7dd1 test(postgres): a cellular-v8 player feeds, is offered and chooses a mutation
A provisioned bundle-13 region with a contact pool at the spawn site runs
the live server's path end to end: host reservation, session batches with
the queued birth, contact feeding until an offer, host mutation admission
and its session publication with the mutation block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 16:06:32 -04:00
dingoandClaude Opus 5.5 bbafaf6957 test(postgres): a lost birth request on a restarted rules-11 host
The cellular-v8 provisioning test now drains the host before its reserved
birth publishes and restarts it. Claiming control under the new lease epoch
cancels the unpublished reservation (schema 17), so the account's next
request is reserved, queued and born instead of being refused for a life
the client can no longer reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 15:56:55 -04:00
2 changed files with 127 additions and 12 deletions
@@ -12,7 +12,7 @@ spec:
env:
- {name: REGION_SESSION, value: "dev"}
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
- {name: REGION_SESSION_WINDOW, value: "dev-20261020T152057-af0e1753:1792524057"}
- {name: REGION_SESSION_WINDOW, value: "dev-20261020T200712-bbf338a2:1792541232"}
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
ports:
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
+126 -11
View File
@@ -673,24 +673,42 @@ void cellular_v8_provisioning_declares_light() {
CHECK(db->query("INSERT INTO evolution.life_allocators VALUES(9775,1000)", {}, 5s));
Sha256Digest digest{};
digest.fill(0xEE);
auto objects = FilesystemObjectStore::open(r.root, r.key, max_cellular_lives_bytes);
CHECK(objects);
auto made =
CellularRegionHost::create({r.key, 9, {}, digest, {digest}}, connect, std::move(*objects));
CHECK(made);
auto host = std::move(*made);
CHECK(host->step().ready && host->state());
const auto start = [&] {
auto objects = FilesystemObjectStore::open(r.root, r.key, max_cellular_lives_bytes);
CHECK(objects);
auto made = CellularRegionHost::create({r.key, 9, {}, digest, {digest}}, connect,
std::move(*objects));
CHECK(made);
auto started = std::move(*made);
CHECK(started->step().ready && started->state());
return started;
};
auto host = start();
auto runtime = connect();
CHECK(runtime);
Uuid account{};
account[0] = 0x8E;
account.back() = 0x13;
const auto control =
const auto original =
claim_account_control(**runtime, r.key, *host->authority(), account, 1, 1, 20'000ms, 5s);
CHECK(control);
const auto requested = host->create_primitive_life(account, control->generation, 5);
CHECK(original);
const auto requested = host->create_primitive_life(account, original->generation, 5);
CHECK(requested.result == evo::network::PrimitiveLifeResult::pending &&
host->queued_births().size() == 1);
// The server restarts before publishing and the client loses request 5. Claiming
// control under the new lease epoch cancels the unpublished reservation (schema 17),
// so the account's new request is not refused for that lost life.
host->drain();
host = start();
CHECK(host->queued_births().empty());
const auto control =
claim_account_control(**runtime, r.key, *host->authority(), account, 2, 2, 20'000ms, 5s);
CHECK(control);
CHECK(host->query_primitive_life(account, control->generation, 5).result ==
evo::network::PrimitiveLifeResult::cancelled);
const auto relogin = host->create_primitive_life(account, control->generation, 6);
CHECK(relogin.result == evo::network::PrimitiveLifeResult::pending &&
host->queued_births().size() == 1 && host->queued_births().front().request == 6);
const std::vector births(host->queued_births().begin(), host->queued_births().end());
auto builder = CellularSessionBatchBuilder::create(*host->state(), host->committed()->head);
CHECK(builder);
@@ -717,7 +735,7 @@ void cellular_v8_provisioning_declares_light() {
message += " sqlstate " + std::string(failure.store->cause.sqlstate.data(), 5);
throw std::runtime_error(message);
}
CHECK(host->query_primitive_life(account, control->generation, 5).result ==
CHECK(host->query_primitive_life(account, control->generation, 6).result ==
evo::network::PrimitiveLifeResult::born);
// The player's next ordinary session tick publishes too.
std::vector<CellularLifeIntent> baseline;
@@ -730,6 +748,100 @@ void cellular_v8_provisioning_declares_light() {
#endif
}
#ifdef EVO_POSTGRES_M10
// A player on a cellular-v8 region feeds by contact until offered a mutation, chooses it
// and publishes the choice, all through the host and session builder as evo-server does.
void cellular_v8_player_chooses_a_mutation() {
using namespace evo::server;
const ServerRegion r{{9776, 1}, fresh("cellular-v8-mutation-9776")};
const std::string build(64, 'e');
int code = -1;
const auto provisioned =
provision_cellular(r, "9776", "cellular-v8", build, "c8a7e1d2b0b81e5c0f7e1d2ba1a0ce5d",
"2500,2500,3000,1,40000000000,4000000000,800000000,400000000,400000000",
code, "--pool", {"--light-pj", "40"});
CHECK(code == 0 && has(provisioned, "provisioned world=9776 region=1 sequence=5 tick=1"));
auto db = owner();
CHECK(db->query("INSERT INTO evolution.life_allocators VALUES(9776,1000)", {}, 5s));
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
return Postgres::connect({env("PGHOST"),
{},
env("PGPORT"),
env("PGDATABASE"),
env("EVO_PG_RUNTIME_USER"),
{},
{}},
5s);
};
Sha256Digest digest{};
digest.fill(0xEE);
auto objects = FilesystemObjectStore::open(r.root, r.key, max_cellular_lives_bytes);
CHECK(objects);
auto made =
CellularRegionHost::create({r.key, 9, {}, digest, {digest}}, connect, std::move(*objects));
CHECK(made);
auto host = std::move(*made);
CHECK(host->step().ready);
auto runtime = connect();
CHECK(runtime);
Uuid account{};
account[0] = 0x8F;
account.back() = 0x21;
const auto control =
claim_account_control(**runtime, r.key, *host->authority(), account, 1, 1, 60'000ms, 5s);
CHECK(control);
CHECK(host->create_primitive_life(account, control->generation, 7).result ==
evo::network::PrimitiveLifeResult::pending);
// One session batch of `ticks` still ticks, carrying queued births and choices.
const auto advance = [&](int ticks) {
CHECK(host->step().ready);
auto builder = CellularSessionBatchBuilder::create(*host->state(), host->committed()->head);
CHECK(builder);
const std::vector births(host->queued_births().begin(), host->queued_births().end());
const std::vector mutations(host->queued_mutations().begin(),
host->queued_mutations().end());
for (int i = 0; i < ticks; ++i) {
std::vector<CellularLifeIntent> baseline;
for (const auto& life : builder->candidate().lives())
baseline.push_back({life.identity.life, {}});
std::ranges::sort(baseline, {}, &CellularLifeIntent::life_id);
const auto tick = builder->candidate().tick() + 1;
const std::span<const CellularTickIntents::Birth> born =
i == 0 ? std::span<const CellularTickIntents::Birth>{births}
: std::span<const CellularTickIntents::Birth>{};
const std::span<const evo::persistence::CellularMutationReservation> chosen =
i == 0 ? std::span<const evo::persistence::CellularMutationReservation>{mutations}
: std::span<const evo::persistence::CellularMutationReservation>{};
CHECK(builder->append_with_birth_refusals(tick, baseline, {}, born, chosen));
}
CHECK(builder->refused_births().empty());
const auto published =
host->publish(builder->batch(), builder->actions(), builder->mutation_actions());
CHECK(published);
return published->mutation_results;
};
advance(1);
CHECK(host->state()->lives().size() == 1 && host->state()->lives().front().account == account);
const auto life_id = host->state()->lives().front().identity.life;
for (int round = 0; round < 40 && !host->state()->lives().front().mutation.offer; ++round)
advance(64);
const auto& life = host->state()->lives().front();
CHECK(life.identity.life == life_id && life.mutation.offer.has_value());
const auto offer = *life.mutation.offer;
const CellularMutationActionInput choice{life_id, life.mutation.event_index,
life.mutation.offer_tick,
offer.candidates.front().operator_id};
const auto admitted = host->select_mutation(account, control->generation, 41, choice);
CHECK(admitted.status == CellularMutationAdmission::admitted &&
host->queued_mutations().size() == 1);
const auto results = advance(1);
CHECK(results.size() == 1 && host->queued_mutations().empty());
std::printf("cellular-v8 player mutation: operator %u result %u at tick %llu\n",
static_cast<unsigned>(choice.operator_id), static_cast<unsigned>(results.front()),
static_cast<unsigned long long>(host->state()->tick()));
}
#endif
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,
@@ -767,6 +879,9 @@ void run_region_store_tests() {
cellular_v6_provisioning_uses_the_reproduction_bundle();
cellular_v7_provisioning_scatters_bubbles();
cellular_v8_provisioning_declares_light();
#ifdef EVO_POSTGRES_M10
cellular_v8_player_chooses_a_mutation();
#endif
full_volumes_publish_nothing();
failing_writes_leave_nothing();
check_store_qualifies_the_stores();