Guard cellular host optional results
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (client) (push) Successful in 13m21s
Foundation / checks (network) (push) Successful in 15m14s
Foundation / checks (tsan) (push) Successful in 8m35s
Foundation / checks (checks) (push) Successful in 36m29s
Foundation / checks (postgres) (push) Failing after 23m14s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 14:14:52 -04:00
parent 9b7e3b4fca
commit 8a9a318d78
2 changed files with 19 additions and 7 deletions
+8
View File
@@ -6940,3 +6940,11 @@ new optional-return expression wrapped at line 499. It has been kept on one
line to follow the 100-column clang-format configuration. PostgreSQL analysis
continued independently, but was superseded before completion by the format fix
push so the full matrix could rerun on one commit.
CI run #294 passed the main, client, deploy, ECS, network and TSan jobs, but the
PostgreSQL-enabled analysis reached `src/server/cellular_region_host.cpp` and
reported unchecked optionals at the cellular publish grant and life-query result,
plus an intentionally best-effort lease release expressed as a discarded value.
The image jobs were skipped because that matrix job failed. The host now passes
safe grant/outcome values after presence checks and captures the shutdown release
result using the existing RegionHost convention.
+11 -7
View File
@@ -297,7 +297,9 @@ const HostStatus& CellularRegionHost::step() {
std::expected<persistence::PublishedCellularBatch, CellularHostError>
CellularRegionHost::publish(const CellularBatch& batch,
std::span<const CellularActionRecord> actions) {
if (!status_.ready || !state_ || !committed_ || !authority_.may_begin_commit(LeaseClock::now()))
const auto grant = authority_.grant();
if (!status_.ready || !state_ || !committed_ || !grant ||
!authority_.may_begin_commit(LeaseClock::now()))
return std::unexpected{CellularHostError::not_ready};
auto candidate = replay_cellular_batch(*state_, batch);
if (!candidate)
@@ -310,8 +312,8 @@ CellularRegionHost::publish(const CellularBatch& batch,
if (!commit)
return std::unexpected{CellularHostError::invalid_batch};
auto published = persistence::publish_cellular_batch(
*db_, *objects_, *authority_.grant(), *committed_, batch, **candidate, *commit,
config_.build, config_.lease.commit_timeout, {}, actions);
*db_, *objects_, grant.value_or(persistence::LeaseGrant{}), *committed_, batch, **candidate,
*commit, config_.build, config_.lease.commit_timeout, {}, actions);
if (!published) {
if (published.error().kind == persistence::PublicationError::unknown) {
pending_ = std::make_unique<Pending>(Pending{published.error().prepared,
@@ -389,7 +391,7 @@ network::PrimitiveLifeOutcome CellularRegionHost::query_birth(const persistence:
}
if (!queried->has_value())
return unknown();
const auto& outcome = queried->value();
const auto outcome = queried->value_or(persistence::PrimitiveLifeOutcome{});
if (outcome.published)
return {request, PrimitiveLifeResult::born, outcome.published->identity,
outcome.published->commit_sequence};
@@ -449,9 +451,11 @@ void CellularRegionHost::drain() {
status_.phase = HostPhase::draining;
pending_.reset();
const auto grant = authority_.grant();
if (grant && authority_.may_originate(LeaseClock::now()) && database())
static_cast<void>(persistence::release_region_lease(*db_, config_.key, *grant,
config_.lease.renew_timeout));
if (grant && authority_.may_originate(LeaseClock::now()) && database()) {
// Best effort during shutdown; the lease expires if release cannot be confirmed.
[[maybe_unused]] const auto released = persistence::release_region_lease(
*db_, config_.key, *grant, config_.lease.renew_timeout);
}
authority_.fence();
state_.reset();
committed_.reset();