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
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ spec:
|
||||
env:
|
||||
- {name: REGION_SESSION, value: "dev"}
|
||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261013T153015-33322:1791916215"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261013T155433-14816:1791917673"}
|
||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||
ports:
|
||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||
|
||||
@@ -408,7 +408,9 @@ void provisioning_creates_the_life_allocator_once() {
|
||||
auto db = owner();
|
||||
auto rows = db->query(
|
||||
"SELECT next_identity FROM evolution.life_allocators WHERE world_id = 9760", {}, 5s);
|
||||
return rows && rows->size() == 1 && (*rows)[0][0] ? *(*rows)[0][0] : std::string{};
|
||||
if (!rows || rows->size() != 1 || (*rows)[0].size() != 1)
|
||||
return std::string{};
|
||||
return (*rows)[0][0].value_or(std::string{});
|
||||
};
|
||||
int code = -1;
|
||||
const auto development = run("development-v1", 5000, code);
|
||||
|
||||
Reference in New Issue
Block a user