From 2518282ff075ca6957a76f2c177134bdab70db9d Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 11 Oct 2026 14:53:32 -0400 Subject: [PATCH] Guard PostgreSQL action ledger optionals --- docs/engineering/VALIDATION.md | 7 +++++++ src/server/session/postgres_action_ledger.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 7e9858a..0769324 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -6948,3 +6948,10 @@ 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. + +CI run #295 passed the main checks matrix, including the full cellular host build, +but PostgreSQL analysis next found checked-optional and ineffective-move warnings +in `src/server/session/postgres_action_ledger.cpp`. The single and batched +lookups now copy present rows via `value_or`, and the small durable result records +are copied without ineffective `std::move`. The PostgreSQL job failed on these +new diagnostics, so image publication remained skipped. diff --git a/src/server/session/postgres_action_ledger.cpp b/src/server/session/postgres_action_ledger.cpp index 6c21994..57b7aa5 100644 --- a/src/server/session/postgres_action_ledger.cpp +++ b/src/server/session/postgres_action_ledger.cpp @@ -47,7 +47,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64 } if (!found.value()) return std::optional{}; - const auto& row = *found.value(); + const auto row = found->value_or(persistence::CommittedActionRecord{}); const auto result = static_cast(row.result); network::DurableActionRecord record{ network::ActionOutcome{action_id, result, row.action.tick, row.action.commit_sequence}, @@ -62,7 +62,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64 } else if (result != network::ActionResult::committed_no_effect) { return std::unexpected(network::ActionLedgerError::unavailable); } - return std::optional{std::move(record)}; + return std::optional{record}; } std::expected>, network::ActionLedgerError> @@ -93,7 +93,7 @@ PostgresActionLedger::find_all_records(std::span keys) for (std::size_t i = 0; i < keys.size(); ++i) { if (!(*found)[i]) continue; - const auto& row = *(*found)[i]; + const auto row = (*found)[i].value_or(persistence::CommittedActionRecord{}); const auto result = static_cast(row.result); network::DurableActionRecord record{network::ActionOutcome{keys[i].action_id, result, row.action.tick, @@ -110,7 +110,7 @@ PostgresActionLedger::find_all_records(std::span keys) } else if (result != network::ActionResult::committed_no_effect) { return std::unexpected(network::ActionLedgerError::unavailable); } - out[i] = std::move(record); + out[i] = record; } return out; }