feat(lifecycle): rules 13 owner on format 11 with the revamp tuning file
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 4s
Foundation / checks (postgres) (push) Successful in 3s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m30s
Foundation / postgres-tools (push) Successful in 22s
Foundation / server-image (push) Successful in 4m12s
Foundation / image (push) Successful in 4m40s

Phase 1 of the cellular revamp build plan (ADR-0179). The cellular owner gains
rules 13 on owner format 11: an explicit no-tick format-10/rules-12 upgrade
declares the region's revamp rules (so far the body's essential upkeep share),
existing lives keep their genomes, and founders born afterwards are founder 6
(genome schema 7, development 7). Format 11 is format 10 plus the revamp rules
block; it stays undeployed while later phases extend it. The tick, perception
and wildlife controller derive budgets with the declared body tuning, which
earlier development versions ignore.

Revamp tunables live in their own Git file,
deploy/kubernetes/region/dev/tuning/cellular-revamp.tuning, parsed by
parse_cellular_revamp_tuning with the same format and refusals as the rules-12
file, so images from before rules 13 never meet keys they do not know. Both
parsers now share read_tuning_lines; the rules-12 file's behaviour is unchanged.
The revamp file is not yet mounted into the region (build plan, phase 6).

Tests cover the upgrade and its refusals, mixed founder 5 and founder 6 lives
ticking with closure, exact restore and continuation, trace replay, and the new
tuning file including the checked-in DEV copy. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-22 18:19:18 -04:00
co-authored by Claude Opus 5.5
parent c183021fd5
commit c7b4846901
15 changed files with 568 additions and 56 deletions
+38 -25
View File
@@ -95,8 +95,9 @@ bool valid_key(std::string_view key) noexcept {
return true;
}
// Optional '-', then digits with single '_' separators between digits; at most 18 digits.
std::optional<std::int64_t> parse_integer(std::string_view text) noexcept {
} // namespace
std::optional<std::int64_t> parse_tuning_integer(std::string_view text) noexcept {
const bool negative = !text.empty() && text.front() == '-';
if (negative)
text.remove_prefix(1);
@@ -121,6 +122,36 @@ std::optional<std::int64_t> parse_integer(std::string_view text) noexcept {
return negative ? -value : value;
}
std::expected<std::vector<TuningLine>, CellularTuningError>
read_tuning_lines(std::string_view text, std::size_t max_bytes) {
if (text.size() > max_bytes)
return std::unexpected{CellularTuningError{CellularTuningErrorKind::too_large, 0, {}}};
std::vector<TuningLine> lines;
std::size_t line_number{};
while (!text.empty()) {
++line_number;
const auto end = text.find('\n');
auto line = text.substr(0, end);
text.remove_prefix(end == std::string_view::npos ? text.size() : end + 1);
if (const auto comment = line.find('#'); comment != std::string_view::npos)
line = line.substr(0, comment);
line = trim(line);
if (line.empty())
continue;
const auto equals = line.find('=');
if (equals == std::string_view::npos)
return std::unexpected{
CellularTuningError{CellularTuningErrorKind::syntax, line_number, {}}};
const auto key = trim(line.substr(0, equals));
if (!valid_key(key))
return std::unexpected{
CellularTuningError{CellularTuningErrorKind::syntax, line_number, {}}};
lines.push_back({line_number, key, trim(line.substr(equals + 1))});
}
return lines;
}
namespace {
std::optional<CellularTuningError> inconsistent(const CellularTuning& t) {
const auto error = [](std::string_view key) {
return CellularTuningError{CellularTuningErrorKind::inconsistent, 0, std::string{key}};
@@ -144,30 +175,12 @@ std::optional<CellularTuningError> inconsistent(const CellularTuning& t) {
} // namespace
std::expected<CellularTuning, CellularTuningError> parse_cellular_tuning(std::string_view text) {
if (text.size() > max_cellular_tuning_bytes)
return std::unexpected{CellularTuningError{CellularTuningErrorKind::too_large, 0, {}}};
const auto lines = read_tuning_lines(text, max_cellular_tuning_bytes);
if (!lines)
return std::unexpected{lines.error()};
CellularTuning tuning{};
std::array<bool, fields.size()> seen{};
std::size_t line_number{};
while (!text.empty()) {
++line_number;
const auto end = text.find('\n');
auto line = text.substr(0, end);
text.remove_prefix(end == std::string_view::npos ? text.size() : end + 1);
if (const auto comment = line.find('#'); comment != std::string_view::npos)
line = line.substr(0, comment);
line = trim(line);
if (line.empty())
continue;
const auto equals = line.find('=');
if (equals == std::string_view::npos)
return std::unexpected{
CellularTuningError{CellularTuningErrorKind::syntax, line_number, {}}};
const auto key = trim(line.substr(0, equals));
const auto value_text = trim(line.substr(equals + 1));
if (!valid_key(key))
return std::unexpected{
CellularTuningError{CellularTuningErrorKind::syntax, line_number, {}}};
for (const auto& [line_number, key, value_text] : *lines) {
std::size_t index{};
while (index < fields.size() && fields.at(index).key != key)
++index;
@@ -177,7 +190,7 @@ std::expected<CellularTuning, CellularTuningError> parse_cellular_tuning(std::st
if (seen.at(index))
return std::unexpected{CellularTuningError{CellularTuningErrorKind::duplicate_key,
line_number, std::string{key}}};
const auto value = parse_integer(value_text);
const auto value = parse_tuning_integer(value_text);
if (!value)
return std::unexpected{CellularTuningError{CellularTuningErrorKind::invalid_value,
line_number, std::string{key}}};