From 2986c87f032312603994a603de9ec98fb71f824b Mon Sep 17 00:00:00 2001 From: dingo Date: Sat, 10 Oct 2026 16:53:10 -0400 Subject: [PATCH] Fix optional access in publication tests --- docs/engineering/VALIDATION.md | 5 +++++ tests/primitive_publication_tests.cpp | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 34da71d..905f5ce 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -5714,3 +5714,8 @@ fallback values while still checking both success/presence states. clang-format 19.1.5, clang-tidy 19.1.5 with warnings-as-errors, GCC 13.2 Release/NDEBUG compilation with warnings-as-errors, and `git diff --check` pass locally. The PostgreSQL test binary remains unrun locally; awaiting CI rerun. + +Windows clang-tidy 19.1.5 additionally reports `bugprone-exception-escape` on +the pre-existing PostgreSQL connection lambda in this test; this warning was not +present in the reported Linux CI diagnostics. The local tidy run excluded only +that check, so Linux CI remains authoritative for it. diff --git a/tests/primitive_publication_tests.cpp b/tests/primitive_publication_tests.cpp index 930824e..7a0420e 100644 --- a/tests/primitive_publication_tests.cpp +++ b/tests/primitive_publication_tests.cpp @@ -137,8 +137,10 @@ void primitive_host_fenced_spawn() { CHECK(made && (*made)->step().ready); auto runtime = connect_as(env("EVO_PG_RUNTIME_USER")); const auto account = id<16>(0x73); - auto control = - claim_account_control(*runtime, key, *(*made)->authority(), account, 1, 1, 20000ms, 5s); + const auto host_authority = (*made)->authority(); + CHECK(host_authority.has_value()); + auto control = claim_account_control(*runtime, key, host_authority.value_or(LeaseGrant{}), + account, 1, 1, 20000ms, 5s); CHECK(control); const auto born = (*made)->new_life(account, control->generation, 1, 1); CHECK(born.kind == PrimitiveHostReplyKind::born && born.published && @@ -249,9 +251,12 @@ void run_primitive_publication_tests() { (*bindings)[0][5] == "1"); const auto durable_outcome = query_primitive_life(*db, key, *lease, alice, control->generation, 1, 5s); - CHECK(durable_outcome && *durable_outcome && (**durable_outcome).published && - (**durable_outcome).published->identity == 1 && - (**durable_outcome).published->commit_sequence == 1); + const auto durable_value = + durable_outcome.value_or(std::nullopt).value_or(PrimitiveLifeOutcome{}); + const auto durable_binding = durable_value.published.value_or(PrimitiveLifeBinding{}); + CHECK(durable_outcome.has_value() && durable_outcome.value_or(std::nullopt).has_value() && + durable_value.published.has_value() && durable_binding.identity == 1 && + durable_binding.commit_sequence == 1); auto reject = reject_primitive_life(*db, key, *lease, alice, control->generation, 1, LifeRefusal::cancelled, 5s); CHECK(!reject && reject.error().kind == LifeReservationError::existing_life);