Check the allocator row through a named optional
Foundation / checks (checks) (push) Successful in 40m39s
Foundation / checks (deploy) (push) Successful in 3m54s
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (network) (push) Successful in 18m45s
Foundation / checks (postgres) (push) Successful in 42m50s
Foundation / checks (tsan) (push) Successful in 9m28s
Foundation / checks (client) (push) Successful in 13m50s
Foundation / server-image (push) Successful in 40s
Foundation / postgres-tools (push) Successful in 1m25s
Foundation / image (push) Successful in 3m20s

clang-tidy's bugprone-unchecked-optional-access could not follow the
optional cell through the indexed row in the provisioner and its test,
failing the PostgreSQL analysis build (run 357). Read the cell through a
checked reference instead. Also refresh the dev session window (3 h).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 11:54:33 -04:00
co-authored by Claude Opus 5.5
parent a3939bda4e
commit 56e7525bfb
3 changed files with 13 additions and 7 deletions
+9 -5
View File
@@ -486,8 +486,9 @@ int provision(const Options& o) {
// operator-audited start before any genesis check, so an already provisioned region
// still gets it. It only ever advances, so one below the start is a conflict.
if (o.life_allocator_start) {
const auto start = *o.life_allocator_start;
const std::array<std::string, 2> p{std::to_string(o.source.key.world),
std::to_string(*o.life_allocator_start)};
std::to_string(start)};
const std::array<std::string, 1> world{p[0]};
auto rows = db->query("INSERT INTO evolution.life_allocators(world_id, next_identity) "
"VALUES ($1::evolution.u64, $2::evolution.u64) "
@@ -497,14 +498,17 @@ int provision(const Options& o) {
rows = db->query("SELECT next_identity FROM evolution.life_allocators "
"WHERE world_id = $1::evolution.u64",
world, timeout);
const auto next = rows && rows->size() == 1 && (*rows)[0].size() == 1 && (*rows)[0][0]
? number(*(*rows)[0][0])
: std::nullopt;
std::optional<std::uint64_t> next;
if (rows && rows->size() == 1 && (*rows)[0].size() == 1) {
const auto& cell = (*rows)[0][0];
if (cell.has_value())
next = number(*cell);
}
if (!next) {
std::puts("life-allocator refused");
return 3;
}
if (*next < *o.life_allocator_start) {
if (*next < start) {
std::puts("life-allocator refused existing below start");
return 4;
}