Guard PostgreSQL action ledger optionals
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Successful in 13m36s
Foundation / checks (network) (push) Successful in 14m54s
Foundation / checks (tsan) (push) Successful in 8m22s
Foundation / checks (postgres) (push) Failing after 23m23s
Foundation / checks (checks) (push) Successful in 37m42s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 14:53:32 -04:00
parent 8a9a318d78
commit 2518282ff0
2 changed files with 11 additions and 4 deletions
+7
View File
@@ -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 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 safe grant/outcome values after presence checks and captures the shutdown release
result using the existing RegionHost convention. 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.
@@ -47,7 +47,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
} }
if (!found.value()) if (!found.value())
return std::optional<network::DurableActionRecord>{}; return std::optional<network::DurableActionRecord>{};
const auto& row = *found.value(); const auto row = found->value_or(persistence::CommittedActionRecord{});
const auto result = static_cast<network::ActionResult>(row.result); const auto result = static_cast<network::ActionResult>(row.result);
network::DurableActionRecord record{ network::DurableActionRecord record{
network::ActionOutcome{action_id, result, row.action.tick, row.action.commit_sequence}, 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) { } else if (result != network::ActionResult::committed_no_effect) {
return std::unexpected(network::ActionLedgerError::unavailable); return std::unexpected(network::ActionLedgerError::unavailable);
} }
return std::optional<network::DurableActionRecord>{std::move(record)}; return std::optional<network::DurableActionRecord>{record};
} }
std::expected<std::vector<std::optional<network::DurableActionRecord>>, network::ActionLedgerError> std::expected<std::vector<std::optional<network::DurableActionRecord>>, network::ActionLedgerError>
@@ -93,7 +93,7 @@ PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys)
for (std::size_t i = 0; i < keys.size(); ++i) { for (std::size_t i = 0; i < keys.size(); ++i) {
if (!(*found)[i]) if (!(*found)[i])
continue; continue;
const auto& row = *(*found)[i]; const auto row = (*found)[i].value_or(persistence::CommittedActionRecord{});
const auto result = static_cast<network::ActionResult>(row.result); const auto result = static_cast<network::ActionResult>(row.result);
network::DurableActionRecord record{network::ActionOutcome{keys[i].action_id, result, network::DurableActionRecord record{network::ActionOutcome{keys[i].action_id, result,
row.action.tick, row.action.tick,
@@ -110,7 +110,7 @@ PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys)
} else if (result != network::ActionResult::committed_no_effect) { } else if (result != network::ActionResult::committed_no_effect) {
return std::unexpected(network::ActionLedgerError::unavailable); return std::unexpected(network::ActionLedgerError::unavailable);
} }
out[i] = std::move(record); out[i] = record;
} }
return out; return out;
} }