From 8b2b56a61204cb8bd7789b5e7c9a7255a27914e9 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 11 Oct 2026 20:10:04 -0400 Subject: [PATCH] Check expected results in publication tests --- docs/engineering/VALIDATION.md | 2 ++ tests/cellular_publication_tests.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 4e9c23f..f42f3a6 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -7022,3 +7022,5 @@ CI run #309 passed the client, deploy, ECS, network and TSan jobs, and the regul CI run #310 passed client, deploy, ECS and network. The main checks stopped at the formatting gate because three new `CellularBatch::header` initializers were not laid out exactly as clang-format 19 expects. The test source is now formatted with clang-format 19.1.5 and passes its local dry-run check. PostgreSQL analysis was still building when this formatting correction was prepared, so run #310 does not yet validate the optional-access fixes; Harbor publication did not start. CI run #311 passed client, deploy, ECS, network and TSan, and compiled the PostgreSQL test target. The PostgreSQL analysis build then still reported 17 unchecked accesses: clang-tidy does not treat the `CHECK(...)` macro or `optional::value()` by itself as proof of engagement. The test now uses a helper with an explicit `has_value()` guard before dereferencing those optionals. This version awaits CI validation; PostgreSQL tools and Harbor publication did not start. + +CI run #312 passed client, deploy, ECS and network, but the PostgreSQL-enabled test build found that the new `checked_value` helper only accepted `std::optional`, while the SHA-256 helper returns `std::expected`. The test now provides the same explicit engagement check for `std::expected`; run #312 did not reach PostgreSQL tools or server-image/Harbor publication. diff --git a/tests/cellular_publication_tests.cpp b/tests/cellular_publication_tests.cpp index 14df237..ac28189 100644 --- a/tests/cellular_publication_tests.cpp +++ b/tests/cellular_publication_tests.cpp @@ -25,6 +25,11 @@ template const T& checked_value(const std::optional& value) { throw std::runtime_error("cellular publication test expected an optional value"); return *value; } +template const T& checked_value(const std::expected& value) { + if (!value.has_value()) + throw std::runtime_error("cellular publication test expected a successful result"); + return *value; +} std::string env(const char* name) { const auto* value = std::getenv(name); if (!value)