Guard optional environment values explicitly in tests

This commit is contained in:
dingo
2026-09-27 13:18:45 -04:00
parent 364c090bc8
commit 1b040c1fb5
2 changed files with 33 additions and 5 deletions
+15
View File
@@ -1876,3 +1876,18 @@ Linux/UBSan/TSan or cluster result is claimed.
Initial native static analysis flagged an unspecified enum base and integer widening
in a size constant; both corrected before the passing analysis runs. No disk/host-loss
recovery, biological maintenance, reproduction or player/offline progression added.
## Environment-view optional guards - 2026-09-27
The supplied Linux clang-tidy-19 log rejected five optional field accesses in
`tests/environment_views_tests.cpp` with bugprone-unchecked-optional-access. Three
had no presence check; two relied on CHECK, whose throwing helper is not recognized
as a control-flow guard by this analysis. All five now use required_field, which
explicitly throws on absence before returning a reference. The rule remains enabled;
production code, formats, expected values and NDEBUG behavior are unchanged.
Executed native analysis, Release and ASan builds plus the targeted
`environment-views-contracts` CTest in each preset; all passed. Release format check
and git diff --check passed. Full suites were not repeated for this test-only fix.
Linux clang-tidy/libstdc++ confirmation remains with the next Gitea run; native
analysis is not claimed as a reproduction of the Linux diagnostics.