From aa6e5579be0542af7dd9259915c2ab8021cfe67d Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 11 Oct 2026 22:31:41 -0400 Subject: [PATCH] Expose cellular publication failure diagnostics --- docs/engineering/VALIDATION.md | 8 ++++++++ include/evo/server/cellular_region_host.hpp | 9 ++++++++- src/server/cellular_region_host.cpp | 13 +++++++----- tests/cellular_publication_tests.cpp | 22 +++++++++++++++++++-- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 6169bf3..6006ca3 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -7037,3 +7037,11 @@ profile-specific publication evidence, matching region and a live reservation. The migration test checks the deferred constraints; the cellular publication integration exercises an actual birth. Run #314 did not start the PostgreSQL tools or Harbor image jobs; CI validation of migration 30 is pending. + +CI run #317 selected the server-image gate after `tests/region_migration_tests.cpp` +was added to the path selector. Client, deploy, ECS, network and TSan passed, but +the PostgreSQL matrix failed the cellular birth publication integration at its +post-publish assertion, so dependent image jobs remained blocked. The assertion +did not expose the sanitized database error category/SQLSTATE; the cellular host +publish result now carries those diagnostics to the test without server messages +or credentials. Validation of the diagnostic and migration 30 remains pending. diff --git a/include/evo/server/cellular_region_host.hpp b/include/evo/server/cellular_region_host.hpp index 6c324e6..e03ff7b 100644 --- a/include/evo/server/cellular_region_host.hpp +++ b/include/evo/server/cellular_region_host.hpp @@ -31,6 +31,13 @@ enum class CellularHostError : std::uint8_t { invalid_batch, publication }; +struct CellularPublishFailure { + // Safe persistence diagnostics only: category and SQLSTATE, never server text. + CellularHostError kind{}; + std::optional publication; + std::optional store; + std::optional object; +}; struct FinalCellularAction { CellularActionRecord action; std::uint64_t commit_sequence{}; @@ -50,7 +57,7 @@ class CellularRegionHost { // Acquires/renews authority, recovers fully, or resolves the exact pending commit. const HostStatus& step(); - [[nodiscard]] std::expected + [[nodiscard]] std::expected publish(const CellularBatch& batch, std::span actions = {}); // v5 requests allocate durably, then wait for the scheduler to include the exact // reservation in a profile-4 batch. Repeating the request is idempotent. diff --git a/src/server/cellular_region_host.cpp b/src/server/cellular_region_host.cpp index f7f9eba..4a95f8b 100644 --- a/src/server/cellular_region_host.cpp +++ b/src/server/cellular_region_host.cpp @@ -294,23 +294,23 @@ const HostStatus& CellularRegionHost::step() { return status_; } -std::expected +std::expected CellularRegionHost::publish(const CellularBatch& batch, std::span actions) { const auto grant = authority_.grant(); if (!status_.ready || !state_ || !committed_ || !grant || !authority_.may_begin_commit(LeaseClock::now())) - return std::unexpected{CellularHostError::not_ready}; + return std::unexpected{CellularPublishFailure{CellularHostError::not_ready}}; auto candidate = replay_cellular_batch(*state_, batch); if (!candidate) - return std::unexpected{CellularHostError::invalid_batch}; + return std::unexpected{CellularPublishFailure{CellularHostError::invalid_batch}}; auto trace = encode_cellular_batch(batch); auto action_block = encode_cellular_action_block(actions, batch.header.begin_tick, batch.header.end_tick); const auto commit = trace && action_block ? commit_id(*committed_, *trace, *action_block) : std::nullopt; if (!commit) - return std::unexpected{CellularHostError::invalid_batch}; + return std::unexpected{CellularPublishFailure{CellularHostError::invalid_batch}}; auto published = persistence::publish_cellular_batch( *db_, *objects_, grant.value_or(persistence::LeaseGrant{}), *committed_, batch, **candidate, *commit, config_.build, config_.lease.commit_timeout, {}, actions); @@ -332,7 +332,10 @@ CellularRegionHost::publish(const CellularBatch& batch, status_.ready = false; ++status_.fences; } - return std::unexpected{CellularHostError::publication}; + return std::unexpected{CellularPublishFailure{CellularHostError::publication, + published.error().kind, + published.error().store, + published.error().object}}; } state_ = std::move(*candidate); committed_ = published->committed; diff --git a/tests/cellular_publication_tests.cpp b/tests/cellular_publication_tests.cpp index ac28189..6c0d587 100644 --- a/tests/cellular_publication_tests.cpp +++ b/tests/cellular_publication_tests.cpp @@ -137,8 +137,26 @@ void cellular_birth_publication_is_durable() { CHECK(candidate && (*candidate)->lives().size() == 1 && (*candidate)->lives()[0].identity.life == reservation.identity); auto published = host->publish(batch); - CHECK(published && published->committed.head.sequence == 1 && - host->state()->snapshot() == (*candidate)->snapshot() && host->queued_births().empty()); + if (!published) { + const auto& failure = published.error(); + auto message = "cellular host publish failed, error=" + + std::to_string(static_cast(failure.kind)); + if (failure.publication) + message += ", publication=" + + std::to_string(static_cast(*failure.publication)); + if (failure.store) { + message += ", store=" + std::to_string(static_cast(failure.store->kind)); + const auto& state = failure.store->cause.sqlstate; + if (state[0] != '\0') + message += ", sqlstate=" + std::string(state.data(), 5); + } + if (failure.object) + message += ", object=" + std::to_string(static_cast(*failure.object)); + throw std::runtime_error(message); + } + CHECK(published->committed.head.sequence == 1); + CHECK(host->state()->snapshot() == (*candidate)->snapshot()); + CHECK(host->queued_births().empty()); const auto host_outcome = host->query_primitive_life(account, control->generation, 7); CHECK(host_outcome.result == evo::network::PrimitiveLifeResult::born && host_outcome.life_identity == reservation.identity && host_outcome.commit_sequence == 1);