Expose cellular publication failure diagnostics
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 1m58s
Foundation / checks (postgres) (push) Failing after 2m43s
Foundation / checks (checks) (push) Failing after 4m9s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 4m24s
Foundation / checks (network) (push) Canceled after 4m28s
Foundation / checks (client) (push) Canceled after 4m34s

This commit is contained in:
dingo
2026-10-11 22:31:41 -04:00
parent d316911355
commit aa6e5579be
4 changed files with 44 additions and 8 deletions
+8
View File
@@ -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.
+8 -1
View File
@@ -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<persistence::PublicationError> publication;
std::optional<persistence::LeaseStoreFailure> store;
std::optional<persistence::ObjectError> 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<persistence::PublishedCellularBatch, CellularHostError>
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
publish(const CellularBatch& batch, std::span<const CellularActionRecord> 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.
+8 -5
View File
@@ -294,23 +294,23 @@ const HostStatus& CellularRegionHost::step() {
return status_;
}
std::expected<persistence::PublishedCellularBatch, CellularHostError>
std::expected<persistence::PublishedCellularBatch, CellularPublishFailure>
CellularRegionHost::publish(const CellularBatch& batch,
std::span<const CellularActionRecord> 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;
+20 -2
View File
@@ -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<unsigned>(failure.kind));
if (failure.publication)
message += ", publication=" +
std::to_string(static_cast<unsigned>(*failure.publication));
if (failure.store) {
message += ", store=" + std::to_string(static_cast<unsigned>(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<unsigned>(*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);