diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index e8be600..3dc182a 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -6829,7 +6829,10 @@ to validate the PostgreSQL migration and remaining jobs. CI run 271 passed the client, deploy, ECS and network jobs, then the PostgreSQL image's clang-tidy analysis rejected four unchecked mutation-offer optional -accesses in `cellular_lives.cpp` and `cellular_batch.cpp`. The accesses now use -checked `optional::value()` and the trace matcher checks offer presence before -reading it. The PostgreSQL migration/tests did not run in that job; a fresh CI -run is required to validate the repair and schema v29. +accesses in `cellular_lives.cpp` and `cellular_batch.cpp`. CI run 272 showed +that the analyzer also rejects `.value()` after a preceding presence guard. +Those paths now copy through `value_or()` after the guard, preserving the +existing rejection behavior while avoiding unchecked optional access. Run 272 +passed all 68 regular CTests but failed analysis before PostgreSQL +migration/tests; a fresh CI run is required to validate this repair and schema +v29. diff --git a/src/server/lifecycle/cellular_batch.cpp b/src/server/lifecycle/cellular_batch.cpp index c9ba177..7b59f48 100644 --- a/src/server/lifecycle/cellular_batch.cpp +++ b/src/server/lifecycle/cellular_batch.cpp @@ -551,7 +551,7 @@ match_cellular_mutation_actions_to_trace(const CellularLives& predecessor, &CellularMutationSelection::life_id); if (!life->mutation.offer) return std::unexpected{CellularActionBlockError::mismatch}; - const auto& offer = life->mutation.offer.value(); + const auto offer = life->mutation.offer.value_or(biology::MutationOffer{}); if (selection == mutations.end() || selection->life_id != life->identity.life || selection->event_index != action.input.event_index || selection->offer_tick != action.input.offer_tick || diff --git a/src/server/lifecycle/cellular_lives.cpp b/src/server/lifecycle/cellular_lives.cpp index 82505a7..81b4c22 100644 --- a/src/server/lifecycle/cellular_lives.cpp +++ b/src/server/lifecycle/cellular_lives.cpp @@ -991,7 +991,7 @@ CellularLives::advance_tick_with_mutations(std::span i return std::unexpected{CellularLivesError::mutation}; if (!life->mutation.offer.has_value()) return std::unexpected{CellularLivesError::mutation}; - const auto& offer = life->mutation.offer.value(); + const auto offer = life->mutation.offer.value_or(biology::MutationOffer{}); if (offer.parent != life->identity.genome || offer.context.event_index != selection.event_index || !std::ranges::any_of(offer.candidates, @@ -1115,7 +1115,7 @@ CellularLives::advance_tick_with_mutations(std::span i const auto parent = next_archive.find(found->identity.genome); if (!parent || !found->mutation.offer.has_value()) return std::unexpected{CellularLivesError::mutation}; - const auto& offer = found->mutation.offer.value(); + const auto offer = found->mutation.offer.value_or(biology::MutationOffer{}); auto transition = biology::fund_mutation(*parent, offer.context, offer, selection.operator_id, selection.successor_id, selection.successor_id, found->reserve);