feat(admin): live tuning revisions adopted at recorded ticks (schema 66)
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (checks) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m42s
Foundation / image (push) Successful in 5m55s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (checks) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m42s
Foundation / image (push) Successful in 5m55s
ADR-0182 section 13. The admin portal's Tuning page edits the world's rules-13 tuning (the Git revamp file format); the admin API checks it, stores an append-only revision and queues an adopt_tuning admin command (kind 7: revision and rules digest) for every region of the world. - Lifecycle: adopt_tuning replaces the region's rules after births when a resolver names the rules for that revision and digest; the safety revision cannot change live. At most one adoption per batch. - Host: fetches the revision text, rebuilds and digests the rules before appending the command; publication and recovery name the rules from the successor state, checked against the recorded digest. - Schema 66: tuning_revisions, admin_set_tuning_v1, load_tuning_revision_v1 (runtime), admin_tuning_revisions_v1, admin_tuning_text_v1. - OpsServer: optional bounded request bodies (Content-Length, 413). - Region view: rules_sha256, so the portal shows each region's revision. - Portal: Tuning page; baseline from the mounted cellular-revamp.tuning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
// --primitive-* flags enable the v5 new-life listener; biology ticks and genesis
|
||||
// provisioning remain disabled.
|
||||
#include "evo/biology/founder.hpp"
|
||||
#include "evo/persistence/sha256.hpp"
|
||||
#include "evo/processes/development_opening.hpp"
|
||||
#include "evo/server/cellular_session_batch.hpp"
|
||||
#include "evo/server/lifecycle/cellular_admin_view.hpp"
|
||||
@@ -1108,7 +1109,18 @@ int serve_cellular(Options& o) {
|
||||
id.bytes = account;
|
||||
return bridge->sessions().holder(id).has_value();
|
||||
};
|
||||
return {200, server::render_cellular_admin_view(*state, online),
|
||||
// The digest tuning revisions are adopted by (ADR-0182 section 13).
|
||||
std::string rules_sha256;
|
||||
if (state->rules_version() >= server::cellular_lives_revamp_rules)
|
||||
if (const auto digest = persistence::sha256(
|
||||
server::encode_cellular_revamp_rules(state->revamp_rules())))
|
||||
for (const auto byte : *digest) {
|
||||
constexpr std::string_view digits = "0123456789abcdef";
|
||||
rules_sha256.push_back(digits[byte >> 4U]);
|
||||
rules_sha256.push_back(digits[byte & 0x0FU]);
|
||||
}
|
||||
return {200,
|
||||
server::render_cellular_admin_view(*state, online, {}, rules_sha256),
|
||||
"application/json"};
|
||||
}
|
||||
return {404, "not found\n"};
|
||||
@@ -1203,8 +1215,10 @@ int serve_cellular(Options& o) {
|
||||
provisional.digest.fill(0xFF);
|
||||
if (auto created =
|
||||
server::CellularSessionBatchBuilder::create(candidate, provisional);
|
||||
created)
|
||||
created) {
|
||||
next.emplace(std::move(*created));
|
||||
next->set_tuning_resolver(host.tuning_resolver());
|
||||
}
|
||||
}
|
||||
flight_ticks = batch_builder->batch().ticks.size();
|
||||
const auto refusals = batch_builder->refused_births();
|
||||
@@ -1312,9 +1326,10 @@ int serve_cellular(Options& o) {
|
||||
if (!batch_builder) {
|
||||
auto created = server::CellularSessionBatchBuilder::create(
|
||||
*state, host.committed()->head);
|
||||
if (created)
|
||||
if (created) {
|
||||
batch_builder.emplace(std::move(*created));
|
||||
else
|
||||
batch_builder->set_tuning_resolver(host.tuning_resolver());
|
||||
} else
|
||||
report_stall("create", created.error(), tick);
|
||||
}
|
||||
if (!batch_builder) {
|
||||
@@ -1338,7 +1353,8 @@ int serve_cellular(Options& o) {
|
||||
});
|
||||
const std::span<const persistence::CellularMutationReservation> mutations =
|
||||
unbound;
|
||||
// ADR-0182: queued admin commands not already in this batch.
|
||||
// ADR-0182: queued admin commands not already in this batch, and at
|
||||
// most one tuning adoption per batch (its successor names its rules).
|
||||
auto admin = host.unbound_admin_commands();
|
||||
std::erase_if(admin, [&](const auto& queued) {
|
||||
return std::ranges::any_of(
|
||||
@@ -1348,6 +1364,20 @@ int serve_cellular(Options& o) {
|
||||
previous.admin.end();
|
||||
});
|
||||
});
|
||||
bool adopting = std::ranges::any_of(
|
||||
batch_builder->batch().ticks, [](const auto& previous) {
|
||||
return std::ranges::any_of(previous.admin, [](const auto& c) {
|
||||
return c.kind == server::CellularAdminKind::adopt_tuning;
|
||||
});
|
||||
});
|
||||
std::erase_if(admin, [&](const auto& queued) {
|
||||
if (queued.kind != server::CellularAdminKind::adopt_tuning)
|
||||
return false;
|
||||
if (adopting)
|
||||
return true;
|
||||
adopting = true;
|
||||
return false;
|
||||
});
|
||||
const auto admin_before = batch_builder->admin_results().size();
|
||||
auto appended = batch_builder->append_with_birth_refusals(
|
||||
tick, baseline, actions, births, mutations, admin);
|
||||
|
||||
Reference in New Issue
Block a user