Fix cellular profile migration test fixture
Foundation / checks (client) (push) Successful in 6s
Foundation / checks (deploy) (push) Successful in 7s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (tsan) (push) Successful in 8m54s
Foundation / checks (postgres) (push) Failing after 32m20s
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 35m13s

This commit is contained in:
dingo
2026-10-12 00:34:56 -04:00
parent 2fee3b454e
commit a1439581d9
2 changed files with 33 additions and 10 deletions
+12
View File
@@ -7045,3 +7045,15 @@ post-publish assertion, so dependent image jobs remained blocked. The assertion
did not expose the sanitized database error category/SQLSTATE; the cellular host did not expose the sanitized database error category/SQLSTATE; the cellular host
publish result now carries those diagnostics to the test without server messages publish result now carries those diagnostics to the test without server messages
or credentials. Validation of the diagnostic and migration 30 remains pending. or credentials. Validation of the diagnostic and migration 30 remains pending.
CI run #321 exposed the exact PostgreSQL error: PL/pgSQL's local record `b`
shadowed the `b` aliases in the duplicate-birth queries in migration 23. The
fix is a forward migration 31 so existing migration checksums remain intact.
Run #322 compiled the PostgreSQL targets and passed the earlier publication
test after migration 31, then exposed an obsolete test fixture that created a
non-empty profile-4 tick-0 genesis from a primitive life. ADR-0100 and ADR-0114
require empty genesis and allocator-backed births at a committed tick. The
fixture now creates empty legacy-v1 genesis, publishes its first life through
the normal control and birth path, then tests the v1-to-v2-to-v3 no-tick
migrations while carrying that living state. PostgreSQL integration cannot be
run in the local Windows environment, so this correction is awaiting CI.
+21 -10
View File
@@ -193,20 +193,17 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
auto endowment = primitive_endowment(); auto endowment = primitive_endowment();
CHECK(endowment); CHECK(endowment);
auto funding = endowment->body; auto funding = endowment->body;
funding.energy.value = endowment->reserve.energy.value + endowment->construction.value; funding.energy.value += endowment->reserve.energy.value + endowment->construction.value;
for (std::size_t index = 0; index < funding.matter.size(); ++index)
funding.matter[index].value += endowment->reserve.matter[index].value;
auto primitive = PrimitiveLives::create({key.world, key.region, 1, 17, funding, {{0, 0}}}); auto primitive = PrimitiveLives::create({key.world, key.region, 1, 17, funding, {{0, 0}}});
CHECK(primitive); CHECK(primitive);
LifeRequest founder;
founder.account = filled<16>(0x5A);
founder.action = 9;
CHECK((*primitive)->spawn(founder, {1, 101, 201, 301, {0}}));
auto habitat = CellularHabitat::create({key.world, key.region, 1, 1'000, 1'000, {}}); auto habitat = CellularHabitat::create({key.world, key.region, 1, 1'000, 1'000, {}});
CHECK(habitat); CHECK(habitat);
auto current = auto current =
CellularLives::create(**primitive, std::move(*habitat), {{1'000, 1'000}, 0, 293'150}); CellularLives::create(**primitive, std::move(*habitat), {{1'000, 1'000}, 0, 293'150});
CHECK(current); CHECK(current && (*current)->lives().empty());
auto legacy_bytes = (*current)->snapshot(); auto legacy_bytes = (*current)->snapshot();
legacy_bytes.erase(legacy_bytes.begin() + 220 + 168, legacy_bytes.begin() + 220 + 480);
constexpr std::uint64_t legacy_magic = 0x3130564C43564541ULL; constexpr std::uint64_t legacy_magic = 0x3130564C43564541ULL;
for (unsigned index = 0; index < 8; ++index) for (unsigned index = 0; index < 8; ++index)
legacy_bytes[index] = static_cast<std::uint8_t>(legacy_magic >> (index * 8U)); legacy_bytes[index] = static_cast<std::uint8_t>(legacy_magic >> (index * 8U));
@@ -223,6 +220,9 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
auto provisioned = auto provisioned =
provision_cellular_region(*owner, **objects, key, 1, **legacy, filled<16>(0x50), build, 5s); provision_cellular_region(*owner, **objects, key, 1, **legacy, filled<16>(0x50), build, 5s);
CHECK(provisioned); CHECK(provisioned);
CHECK(owner->query("INSERT INTO evolution.life_allocators VALUES(9755,1000) "
"ON CONFLICT DO NOTHING",
{}, 5s));
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> { const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
return Postgres::connect({env("PGHOST"), return Postgres::connect({env("PGHOST"),
{}, {},
@@ -249,17 +249,28 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
const auto& predecessor_value = checked_value(predecessor); const auto& predecessor_value = checked_value(predecessor);
CHECK(predecessor_value.head.sequence == 0); CHECK(predecessor_value.head.sequence == 0);
auto runtime = connect_as(env("EVO_PG_RUNTIME_USER"));
const auto account = filled<16>(0x5A);
const auto control =
claim_account_control(*runtime, key, authority_value, account, 1, 1, 20'000ms, 5s);
CHECK(control);
const auto requested = host->create_primitive_life(account, control->generation, 9);
CHECK(requested.result == evo::network::PrimitiveLifeResult::pending &&
requested.life_identity != 0 && host->queued_births().size() == 1);
CellularBatch batch; CellularBatch batch;
const auto predecessor_digest = sha256(predecessor_value.manifest); const auto predecessor_digest = sha256(predecessor_value.manifest);
CHECK(predecessor_digest); CHECK(predecessor_digest);
batch.header = { batch.header = {
key.world, key.region, 1, predecessor_value.head.commit, checked_value(predecessor_digest), key.world, key.region, 1, predecessor_value.head.commit, checked_value(predecessor_digest),
0, 1}; 0, 1};
batch.ticks.resize(1); CellularTickIntents tick;
for (const auto& life : host->state()->lives()) tick.births.push_back(host->queued_births().front());
batch.ticks[0].lives.push_back({life.identity.life, {}}); batch.ticks.push_back(tick);
const auto published = host->publish(batch); const auto published = host->publish(batch);
CHECK(published && published->committed.head.sequence == 1); CHECK(published && published->committed.head.sequence == 1);
CHECK(host->state()->lives().size() == 1 &&
host->state()->lives().front().identity.born.value == 1);
auto migrated = auto migrated =
migrate_cellular_profile_to_v2(*owner, **migration_objects, authority_value, migrate_cellular_profile_to_v2(*owner, **migration_objects, authority_value,
published->committed, filled<16>(0x51), build, 5s); published->committed, filled<16>(0x51), build, 5s);