Fix CI formatting and tidy findings
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m38s
Foundation / checks (network) (push) Successful in 14m7s
Foundation / checks (tsan) (push) Successful in 8m11s
Foundation / checks (postgres) (push) Failing after 18m3s
Foundation / checks (checks) (push) Successful in 33m8s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-10 14:36:11 -04:00
parent 4f49c54232
commit 67f3545d5b
5 changed files with 59 additions and 50 deletions
+6 -3
View File
@@ -5692,6 +5692,9 @@ retry and world/account exclusivity.
Executed: GCC 13.2 Release/NDEBUG compilation with warnings-as-errors for the new
host translation unit and changed PostgreSQL test translation unit; `git diff
--check`. Both compilations passed. The local Windows shell cannot configure the
Linux-only PostgreSQL target, and this turn did not run the PostgreSQL test binary,
clang-format, or clang-tidy. Awaiting CI for the database, migration, host test and
repository checks; no local runtime pass is claimed.
Linux-only PostgreSQL target, and this turn did not run the PostgreSQL test binary.
CI found clang-format violations in the three new/changed host and test files plus
the `performance-move-const-arg` clang-tidy warning on the v17 outcome adapter.
Both were corrected. clang-format 19.1.5 dry-run and clang-tidy 19.1.5 on
`region_lease_store.cpp` pass locally. Awaiting CI rerun for the database,
migration, host test and repository checks; no local runtime pass is claimed.
+9 -8
View File
@@ -40,8 +40,7 @@ struct PrimitiveHostReply {
class PrimitiveRegionHost {
public:
[[nodiscard]] static std::expected<std::unique_ptr<PrimitiveRegionHost>,
PrimitiveHostError>
[[nodiscard]] static std::expected<std::unique_ptr<PrimitiveRegionHost>, PrimitiveHostError>
create(PrimitiveHostConfig config, PrimitiveConnect connect,
std::unique_ptr<persistence::FilesystemObjectStore> objects);
PrimitiveRegionHost(const PrimitiveRegionHost&) = delete;
@@ -56,12 +55,15 @@ class PrimitiveRegionHost {
// The caller supplies the authenticated account-control generation. The
// operation is durable before `born` or a final refusal is returned.
[[nodiscard]] PrimitiveHostReply new_life(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request,
std::uint64_t generation, std::uint64_t request,
std::uint32_t rules);
[[nodiscard]] std::optional<persistence::LeaseGrant> authority() const;
[[nodiscard]] const HostStatus& status() const noexcept { return status_; }
[[nodiscard]] const PrimitiveLives* state() const noexcept { return state_.get(); }
[[nodiscard]] const HostStatus& status() const noexcept {
return status_;
}
[[nodiscard]] const PrimitiveLives* state() const noexcept {
return state_.get();
}
private:
struct Pending;
@@ -72,8 +74,7 @@ class PrimitiveRegionHost {
void upkeep();
void refresh();
[[nodiscard]] PrimitiveHostReply query(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request);
std::uint64_t generation, std::uint64_t request);
PrimitiveHostConfig config_;
PrimitiveConnect connect_;
+1 -1
View File
@@ -723,7 +723,7 @@ query_primitive_life(Postgres& db, RegionKey key, const LeaseGrant& lease, const
out.published =
PrimitiveLifeBinding{account, request_id, *identity, *born, *commit, *sequence};
}
return std::optional<PrimitiveLifeOutcome>{std::move(out)};
return std::optional<PrimitiveLifeOutcome>{out};
}
// Schema v12 probe records and handoff (ADR-0096). Shares this file's parsing rules.
+36 -30
View File
@@ -22,8 +22,8 @@ using persistence::LeaseClock;
using persistence::LeaseStoreError;
bool valid(const PrimitiveHostConfig& c) {
return c.key.world != 0 && c.key.region != 0 && c.frame != 0 &&
persistence::valid(c.lease) && c.build != persistence::Sha256Digest{} &&
return c.key.world != 0 && c.key.region != 0 && c.frame != 0 && persistence::valid(c.lease) &&
c.build != persistence::Sha256Digest{} &&
std::ranges::find(c.retained_builds, c.build) != c.retained_builds.end();
}
PrimitiveHostReply reply(PrimitiveHostReplyKind kind, persistence::LifeReservation reservation,
@@ -32,8 +32,9 @@ PrimitiveHostReply reply(PrimitiveHostReplyKind kind, persistence::LifeReservati
}
} // namespace
PrimitiveRegionHost::PrimitiveRegionHost(PrimitiveHostConfig config, PrimitiveConnect connect,
std::unique_ptr<persistence::FilesystemObjectStore> objects)
PrimitiveRegionHost::PrimitiveRegionHost(
PrimitiveHostConfig config, PrimitiveConnect connect,
std::unique_ptr<persistence::FilesystemObjectStore> objects)
: config_{std::move(config)}, connect_{std::move(connect)}, objects_{std::move(objects)},
authority_{config_.lease} {}
@@ -44,8 +45,8 @@ PrimitiveRegionHost::create(PrimitiveHostConfig config, PrimitiveConnect connect
std::unique_ptr<persistence::FilesystemObjectStore> objects) {
if (!valid(config) || !connect || !objects)
return std::unexpected{PrimitiveHostError::configuration};
return std::unique_ptr<PrimitiveRegionHost>{new PrimitiveRegionHost{
std::move(config), std::move(connect), std::move(objects)}};
return std::unique_ptr<PrimitiveRegionHost>{
new PrimitiveRegionHost{std::move(config), std::move(connect), std::move(objects)}};
}
bool PrimitiveRegionHost::database() {
@@ -166,9 +167,11 @@ void PrimitiveRegionHost::refresh() {
authority_.may_originate(LeaseClock::now());
status_.epoch = lease ? lease->epoch : 0;
status_.lease_remaining_ms =
status_.ready ? static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(
authority_.deadline() - LeaseClock::now()).count())
: 0;
status_.ready
? static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(
authority_.deadline() - LeaseClock::now())
.count())
: 0;
}
const HostStatus& PrimitiveRegionHost::step() {
@@ -196,8 +199,8 @@ void PrimitiveRegionHost::drain() {
pending_.reset();
const auto grant = authority_.grant();
if (grant && authority_.may_originate(LeaseClock::now()) && database()) {
const auto released = persistence::release_region_lease(
*db_, config_.key, *grant, config_.lease.renew_timeout);
const auto released = persistence::release_region_lease(*db_, config_.key, *grant,
config_.lease.renew_timeout);
if (!released)
db_.reset();
}
@@ -216,13 +219,12 @@ std::optional<persistence::LeaseGrant> PrimitiveRegionHost::authority() const {
}
PrimitiveHostReply PrimitiveRegionHost::query(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request) {
std::uint64_t generation, std::uint64_t request) {
if (!database() || !authority_.grant())
return reply(PrimitiveHostReplyKind::unavailable, {});
auto outcome = persistence::query_primitive_life(*db_, config_.key, *authority_.grant(),
account, generation, request,
config_.lease.commit_timeout);
auto outcome =
persistence::query_primitive_life(*db_, config_.key, *authority_.grant(), account,
generation, request, config_.lease.commit_timeout);
if (!outcome) {
if (outcome.error().kind == persistence::LifeReservationError::unknown ||
outcome.error().kind == persistence::LifeReservationError::store)
@@ -244,8 +246,7 @@ PrimitiveHostReply PrimitiveRegionHost::query(const persistence::Uuid& account,
}
PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request,
std::uint64_t generation, std::uint64_t request,
std::uint32_t rules) {
if (!status_.ready || !state_ || !committed_ || !authority_.may_begin_commit(LeaseClock::now()))
return reply(PrimitiveHostReplyKind::unavailable, {});
@@ -304,8 +305,8 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
status_.phase = HostPhase::quarantined;
return reply(PrimitiveHostReplyKind::unavailable, reservation);
}
auto resolved = persistence::retry_primitive_prepared(
*db_, prepared, config_.lease.commit_timeout);
auto resolved =
persistence::retry_primitive_prepared(*db_, prepared, config_.lease.commit_timeout);
if (!resolved) {
if (resolved.error().kind == persistence::PublicationError::unknown) {
db_.reset();
@@ -339,9 +340,9 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
if (existing.kind != PrimitiveHostReplyKind::unknown &&
existing.kind != PrimitiveHostReplyKind::pending)
return existing;
auto reserved = persistence::reserve_primitive_life(
*db_, config_.key, *authority_.grant(), account, generation, request, rules,
config_.lease.commit_timeout);
auto reserved = persistence::reserve_primitive_life(*db_, config_.key, *authority_.grant(),
account, generation, request, rules,
config_.lease.commit_timeout);
if (!reserved) {
if (reserved.error().kind == persistence::LifeReservationError::unknown) {
db_.reset();
@@ -386,7 +387,7 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
auto& source = state_->balances().front();
const auto enough = [&] {
if (source.energy.value < endowed->body.energy.value + endowed->reserve.energy.value +
endowed->construction.value)
endowed->construction.value)
return false;
for (std::size_t i = 0; i < source.matter.size(); ++i)
if (source.matter[i].value < endowed->body.matter[i].value)
@@ -395,8 +396,7 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
};
if (!enough())
return refuse(persistence::LifeRefusal::insufficient_funding);
if (committed_->head.end_tick == UINT64_MAX ||
committed_->head.sequence == UINT64_MAX) {
if (committed_->head.end_tick == UINT64_MAX || committed_->head.sequence == UINT64_MAX) {
status_.phase = HostPhase::quarantined;
status_.ready = false;
authority_.fence();
@@ -412,8 +412,8 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
}
const auto end_tick = committed_->head.end_tick + 1;
PrimitiveBatch batch{{config_.key.world, config_.key.region, config_.frame,
committed_->head.commit, *predecessor_digest,
committed_->head.end_tick, end_tick},
committed_->head.commit, *predecessor_digest, committed_->head.end_tick,
end_tick},
{{{account, request}, reserved->identity, generation, {end_tick}}}};
auto candidate = replay_primitive_batch(*state_, batch);
if (!candidate) {
@@ -432,8 +432,14 @@ PrimitiveHostReply PrimitiveRegionHost::new_life(const persistence::Uuid& accoun
const auto sequence = committed_->head.sequence + 1;
for (unsigned i = 0; i < 8; ++i)
commit[8 + i] = static_cast<std::uint8_t>((sequence >> (i * 8U)) & 0xffU);
pending_ = std::make_unique<Pending>(Pending{account, generation, request, *reserved,
std::move(batch), std::move(*candidate), commit, {}});
pending_ = std::make_unique<Pending>(Pending{account,
generation,
request,
*reserved,
std::move(batch),
std::move(*candidate),
commit,
{}});
auto published = persistence::publish_primitive_batch(
*db_, *objects_, *authority_.grant(), *committed_, pending_->batch, *pending_->candidate,
pending_->commit, config_.build, config_.lease.commit_timeout);
+7 -8
View File
@@ -127,19 +127,18 @@ void primitive_host_fenced_spawn() {
5s));
CHECK(owner->query("INSERT INTO evolution.life_allocators VALUES(9755,1)", {}, 5s));
auto host_objects = FilesystemObjectStore::open(env("PGHOST"), key,
max_primitive_lives_bytes);
auto host_objects = FilesystemObjectStore::open(env("PGHOST"), key, max_primitive_lives_bytes);
CHECK(host_objects);
const auto pg = PgOptions{env("PGHOST"), {}, env("PGPORT"), env("PGDATABASE"),
env("EVO_PG_RUNTIME_USER"), {}, {}};
const auto pg = PgOptions{
env("PGHOST"), {}, env("PGPORT"), env("PGDATABASE"), env("EVO_PG_RUNTIME_USER"), {}, {}};
auto made = PrimitiveRegionHost::create(
{key, 1, {}, build, {build}},
[pg] { return Postgres::connect(pg, 5s); }, std::move(*host_objects));
{key, 1, {}, build, {build}}, [pg] { return Postgres::connect(pg, 5s); },
std::move(*host_objects));
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);
auto control =
claim_account_control(*runtime, key, *(*made)->authority(), 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 &&