feat(admin): region page redesign, resource ledger, drip and dark mode
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m40s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m46s
Foundation / image (push) Successful in 5m34s

The region view adds the rules-13 drip and complete counts and totals over every
life and deposit. The region page is rebuilt around the map: a KPI strip (tick
pace, population, deposit capacity, region energy and matter, spent pool, next
drip), layer toggles that double as the legend, zoom and a scale, and tabs for
inspecting cells and deposits, resources (where each channel sits, the spent pool
and each channel's next drip), actions, the running tuning and session access.
The admin API serves the region tuning file read only (--region-tuning). Light
and dark themes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-28 07:54:28 -04:00
co-authored by Claude Opus 5.5
parent 68f2567253
commit 6338cc9142
13 changed files with 1595 additions and 480 deletions
+15 -2
View File
@@ -3,11 +3,13 @@
// evo-admin-api --listen ADDRESS:PORT --world N --jwks JSON --oidc-issuer URL
// --audience NAME --client NAME --role NAME --assets DIR
// --pg-passfile F --pg-service F [--region REGION=HOST:PORT ...] [--baseline-tuning F]
// [--region-tuning F]
//
// --assets holds the portal's index.html, app.js and style.css. Each --region names a
// region's operations address, whose /admin/view the portal may show; those regions adopt
// tuning revisions. --baseline-tuning is the revamp tuning file they opened with, shown
// until the first revision. No token is printed.
// until the first revision; --region-tuning the region tuning file they start with, shown
// read only. No token is printed.
#include "evo/persistence/postgres.hpp"
#include "evo/server/admin/admin_api.hpp"
@@ -35,7 +37,8 @@ void on_stop(int) {
}
struct Options {
std::string listen, jwks, oidc_issuer, audience, client, role, assets, baseline_tuning;
std::string listen, jwks, oidc_issuer, audience, client, role, assets, baseline_tuning,
region_tuning;
std::uint64_t world{};
std::map<std::uint64_t, std::string> regions; // Region to its operations address.
persistence::PgOptions pg;
@@ -74,6 +77,8 @@ std::optional<Options> parse(int argc, char** argv) {
o.assets = value;
else if (flag == "--baseline-tuning")
o.baseline_tuning = value;
else if (flag == "--region-tuning")
o.region_tuning = value;
else if (flag == "--pg-service")
pg_service = value;
else if (flag == "--pg-passfile")
@@ -169,6 +174,14 @@ int main(int argc, char** argv) {
}
config.baseline_tuning = std::move(*baseline);
}
if (!options->region_tuning.empty()) {
auto region = read_file(options->region_tuning);
if (!region) {
std::puts("error region-tuning");
return 2;
}
config.region_tuning = std::move(*region);
}
config.portal_config_json = "{\"issuer\":\"" + options->oidc_issuer + "\",\"client_id\":\"" +
options->client + "\",\"world\":" + std::to_string(options->world) +
"}\n";
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -20,7 +20,13 @@
</div>
</nav>
<div class="who">
<span id="who" class="muted"></span>
<span id="env" class="env" hidden></span>
<div class="theme-switch" role="group" aria-label="Theme">
<button type="button" data-theme-choice="system" title="Follow the system">Auto</button>
<button type="button" data-theme-choice="light" title="Light">☀</button>
<button type="button" data-theme-choice="dark" title="Dark">☾</button>
</div>
<span id="who" class="muted small"></span>
<button id="sign-out" class="ghost" hidden>Sign out</button>
</div>
</header>
+505 -131
View File
@@ -1,217 +1,591 @@
/* ADR-0182 admin portal. Tokens first; dark is the default, light follows the system. */
/* ADR-0182 admin portal. Tokens first: light by default, dark from the system or the header's
theme switch (html[data-theme]). The region map reads the map tokens when it paints. */
:root {
--bg: #0f1419;
--panel: #161d24;
--panel-2: #1c252e;
--line: #2a3640;
--text: #dbe3ea;
--muted: #8a99a6;
--accent: #4fb3ff;
--good: #3ecf8e;
--warn: #f2b84b;
--bad: #ff6b6b;
--player: #4f8dff;
--online: #5ff2ff;
--wildlife: #3ecf8e;
--pool: rgba(120, 170, 255, 0.16);
--energy: #ffd84d;
--carbon: #b0b7bf;
--nitrogen: #9b7bff;
--phosphorus: #ff9a3c;
--other: #ff6fb5;
--radius: 8px;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
color-scheme: dark;
--bg: #f3f5f8;
--panel: #ffffff;
--panel-2: #f6f8fa;
--panel-3: #eef1f5;
--line: #e1e6ec;
--line-strong: #cfd6de;
--text: #17202a;
--muted: #5f6c79;
--faint: #8b96a2;
--accent: #2563eb;
--accent-soft: rgba(37, 99, 235, 0.1);
--on-accent: #ffffff;
--good: #15925f;
--good-soft: rgba(21, 146, 95, 0.1);
--warn: #b7791f;
--warn-soft: rgba(183, 121, 31, 0.12);
--bad: #d64545;
--bad-soft: rgba(214, 69, 69, 0.1);
--shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
--shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.14);
/* Region map. */
--map-bg: #fbfcfd;
--map-grid: rgba(23, 32, 42, 0.05);
--map-edge: #cfd6de;
--map-glass: rgba(255, 255, 255, 0.86);
--player: #2f6fed;
--online: #06b6d4;
--wildlife: #16a34a;
--pool: rgba(37, 99, 235, 0.1);
--pool-edge: rgba(37, 99, 235, 0.45);
--patch: rgba(120, 90, 40, 0.14);
--select: #f59e0b;
--energy: #eab308;
--carbon: #4b5563;
--nitrogen: #8b5cf6;
--phosphorus: #f97316;
--other: #ec4899;
--radius: 10px;
--radius-sm: 7px;
--mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
color-scheme: light;
}
@media (prefers-color-scheme: light) {
:root {
--bg: #f5f7f9;
--panel: #ffffff;
--panel-2: #eef2f5;
--line: #d6dde3;
--text: #18212a;
--muted: #5d6b77;
--accent: #0b6bcb;
--pool: rgba(30, 90, 200, 0.12);
--carbon: #59626b;
color-scheme: light;
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #0b0f14;
--panel: #121820;
--panel-2: #161e27;
--panel-3: #1c2531;
--line: #232d3a;
--line-strong: #2f3b4b;
--text: #e4eaf0;
--muted: #8d9aa8;
--faint: #64717f;
--accent: #5b9dff;
--accent-soft: rgba(91, 157, 255, 0.14);
--on-accent: #06101f;
--good: #3ecf8e;
--good-soft: rgba(62, 207, 142, 0.12);
--warn: #f2b84b;
--warn-soft: rgba(242, 184, 75, 0.13);
--bad: #ff6b6b;
--bad-soft: rgba(255, 107, 107, 0.12);
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
--shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55);
--map-bg: #070b10;
--map-grid: rgba(140, 170, 200, 0.06);
--map-edge: #2a3646;
--map-glass: rgba(18, 24, 32, 0.86);
--player: #5b9dff;
--online: #5ff2ff;
--wildlife: #3ecf8e;
--pool: rgba(91, 157, 255, 0.12);
--pool-edge: rgba(91, 157, 255, 0.5);
--patch: rgba(200, 160, 90, 0.14);
--select: #ffd166;
--energy: #ffd84d;
--carbon: #a3adb8;
--nitrogen: #a78bfa;
--phosphorus: #ff9a3c;
--other: #ff6fb5;
color-scheme: dark;
}
}
:root[data-theme="dark"] {
--bg: #0b0f14;
--panel: #121820;
--panel-2: #161e27;
--panel-3: #1c2531;
--line: #232d3a;
--line-strong: #2f3b4b;
--text: #e4eaf0;
--muted: #8d9aa8;
--faint: #64717f;
--accent: #5b9dff;
--accent-soft: rgba(91, 157, 255, 0.14);
--on-accent: #06101f;
--good: #3ecf8e;
--good-soft: rgba(62, 207, 142, 0.12);
--warn: #f2b84b;
--warn-soft: rgba(242, 184, 75, 0.13);
--bad: #ff6b6b;
--bad-soft: rgba(255, 107, 107, 0.12);
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
--shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.55);
--map-bg: #070b10;
--map-grid: rgba(140, 170, 200, 0.06);
--map-edge: #2a3646;
--map-glass: rgba(18, 24, 32, 0.86);
--player: #5b9dff;
--online: #5ff2ff;
--wildlife: #3ecf8e;
--pool: rgba(91, 157, 255, 0.12);
--pool-edge: rgba(91, 157, 255, 0.5);
--patch: rgba(200, 160, 90, 0.14);
--select: #ffd166;
--energy: #ffd84d;
--carbon: #a3adb8;
--nitrogen: #a78bfa;
--phosphorus: #ff9a3c;
--other: #ff6fb5;
color-scheme: dark;
}
/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
background: var(--bg);
color: var(--text);
font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.error { color: var(--bad); }
.good { color: var(--good); }
.small { font-size: 12px; }
.center { display: grid; place-items: center; min-height: 55vh; text-align: center; }
.center h1 { margin-bottom: 6px; }
.center .muted { margin-bottom: 18px; }
button {
font: inherit;
font-weight: 500;
color: var(--text);
background: var(--panel-2);
border: 1px solid var(--line);
border-radius: 6px;
padding: 5px 12px;
background: var(--panel);
border: 1px solid var(--line-strong);
border-radius: var(--radius-sm);
padding: 6px 13px;
cursor: pointer;
transition: background 0.12s, border-color 0.12s, color 0.12s;
white-space: nowrap;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button:hover { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button:disabled:hover { border-color: var(--line-strong); color: var(--text); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--panel-3); color: var(--text); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
button.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
button.icon { padding: 5px 9px; line-height: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="search"], input[type="text"], input[type="number"], select {
font: inherit;
color: var(--text);
background: var(--panel);
border: 1px solid var(--line);
border-radius: 6px;
padding: 5px 10px;
min-width: 240px;
border: 1px solid var(--line-strong);
border-radius: var(--radius-sm);
padding: 6px 10px;
min-width: 0;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="search"] { width: 280px; }
input[type="checkbox"] { accent-color: var(--accent); }
/* ---------- Top bar ---------- */
.bar {
display: flex;
align-items: center;
gap: 24px;
padding: 10px 20px;
background: var(--panel);
gap: 28px;
height: 56px;
padding: 0 22px;
background: color-mix(in srgb, var(--panel) 88%, transparent);
backdrop-filter: saturate(1.4) blur(10px);
border-bottom: 1px solid var(--line);
position: sticky;
top: 0;
z-index: 2;
z-index: 10;
}
.brand { font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.brand span { color: var(--accent); font-weight: 500; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand::before {
content: "";
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 35% 35%, var(--online), var(--player) 55%, var(--wildlife));
box-shadow: 0 0 12px color-mix(in srgb, var(--online) 45%, transparent);
}
.brand span { color: var(--muted); font-weight: 500; }
.sections { display: flex; gap: 20px; flex: 1; }
.section { display: flex; align-items: center; gap: 4px; }
.section { display: flex; align-items: center; gap: 2px; }
.section-name {
text-transform: uppercase;
font-size: 11px;
letter-spacing: 0.08em;
color: var(--muted);
margin-right: 6px;
font-size: 10.5px;
font-weight: 600;
letter-spacing: 0.1em;
color: var(--faint);
margin-right: 10px;
}
.section a { padding: 5px 10px; border-radius: 6px; color: var(--text); }
.section a.active { background: var(--panel-2); color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; }
.section a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.section a:hover { color: var(--text); background: var(--panel-3); text-decoration: none; }
.section a.active { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 12px; }
.env {
font-size: 11px;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--warn);
background: var(--warn-soft);
border-radius: 999px;
padding: 2px 9px;
}
.theme-switch { display: flex; background: var(--panel-3); border-radius: 999px; padding: 2px; }
.theme-switch button {
border: 0;
background: transparent;
color: var(--muted);
border-radius: 999px;
padding: 3px 9px;
font-size: 13px;
line-height: 1.3;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 20px 0 8px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
/* ---------- Page ---------- */
main { padding: 22px 24px 40px; max-width: 1760px; margin: 0 auto; }
main:focus { outline: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.head .crumb { display: inline-block; font-size: 12.5px; margin-bottom: 4px; color: var(--muted); }
.head .crumb:hover { color: var(--accent); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.subtitle { color: var(--muted); margin-top: 3px; }
.card {
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 14px 16px;
padding: 16px 18px;
box-shadow: var(--shadow);
}
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat .value { font-size: 18px; font-weight: 600; margin-top: 2px; }
.stat .value small { font-size: 12px; font-weight: 400; color: var(--muted); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat, .kpi {
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
padding: 12px 14px;
box-shadow: var(--shadow);
min-width: 0;
}
.stat .label, .kpi .label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.07em;
color: var(--muted);
display: flex;
align-items: center;
gap: 6px;
}
.stat .value, .kpi .value { font-size: 21px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value small { font-size: 12px; font-weight: 400; color: var(--muted); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.kpi.warn .value { color: var(--warn); }
.kpi.bad { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.kpi.bad .value { color: var(--bad); }
.kpi .meter { margin-top: 8px; }
.meter { height: 5px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }
.meter.smooth > span { transition: width 0.25s linear; }
/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--panel); }
table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--panel-2); cursor: pointer; user-select: none; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--panel-2); cursor: pointer; user-select: none; }
th.sorted { color: var(--text); }
th.sorted::after { content: " ▾"; }
th.sorted.up::after { content: " ▴"; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.clickable { cursor: pointer; }
table.compact { font-size: 12.5px; background: transparent; }
table.compact td { padding: 6px 4px; white-space: normal; vertical-align: top; }
table.compact tr:hover { background: transparent; }
.badge {
display: inline-block;
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 11.5px;
padding: 1px 8px;
font-weight: 500;
padding: 1px 9px;
border-radius: 999px;
border: 1px solid var(--line);
background: var(--panel-3);
color: var(--muted);
white-space: nowrap;
}
.badge.alive { color: var(--good); border-color: var(--good); }
.badge.dead { color: var(--bad); border-color: var(--bad); }
.badge.online { color: var(--online); border-color: var(--online); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.alive { color: var(--good); background: var(--good-soft); }
.badge.dead { color: var(--bad); background: var(--bad-soft); }
.badge.online { color: var(--accent); background: var(--accent-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge .dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.window-controls { display: flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; }
.region-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
@media (max-width: 1000px) { .region-layout { grid-template-columns: 1fr; } }
.canvas-wrap {
position: relative;
background: var(--panel);
/* ---------- Region page ---------- */
.region-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(420px, 30vw, 560px); gap: 16px; align-items: start; }
@media (max-width: 1150px) { .region-grid { grid-template-columns: 1fr; } }
.map-card {
display: flex;
flex-direction: column;
height: max(560px, calc(100vh - 250px));
border: 1px solid var(--line);
border-radius: var(--radius);
background: var(--panel);
overflow: hidden;
aspect-ratio: 1 / 1;
max-height: calc(100vh - 230px);
width: 100%;
box-shadow: var(--shadow);
}
.map-toolbar { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.map-stage { position: relative; flex: 1; min-height: 0; background: var(--map-bg); }
.map-stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.map-stage canvas.dragging { cursor: grabbing; }
.glass {
background: var(--map-glass);
backdrop-filter: blur(8px);
border: 1px solid var(--line);
border-radius: var(--radius-sm);
box-shadow: var(--shadow);
}
.map-layers { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
display: inline-flex;
background: var(--panel-2);
border: 1px solid var(--line);
align-items: center;
gap: 7px;
font-size: 12.5px;
font-weight: 500;
padding: 4px 10px 4px 8px;
border-radius: 999px;
color: var(--text);
cursor: pointer;
user-select: none;
}
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.off { opacity: 0.45; }
.chip.off .swatch { background: transparent !important; }
.chip:hover { border-color: var(--accent); }
.map-zoom { display: flex; overflow: hidden; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.map-zoom button { border: 0; border-radius: 0; background: transparent; padding: 5px 11px; font-size: 15px; line-height: 1.2; }
.map-zoom button + button { border-left: 1px solid var(--line); }
.map-zoom button:hover { background: var(--panel-3); }
.map-foot { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; }
.map-hint { font-size: 12px; color: var(--muted); padding: 3px 9px; }
.scale { font-size: 11.5px; color: var(--muted); padding: 4px 9px 3px; text-align: center; }
.scale .rule { height: 6px; border: 1.5px solid var(--muted); border-top: 0; margin-top: 2px; }
.map-banner {
position: absolute;
left: 50%;
top: 12px;
transform: translateX(-50%);
padding: 6px 14px;
font-size: 12.5px;
color: var(--warn);
border-color: color-mix(in srgb, var(--warn) 50%, var(--line));
}
.canvas-wrap canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.overlay-note { position: absolute; left: 10px; bottom: 8px; font-size: 12px; color: var(--muted); pointer-events: none; }
.tooltip {
position: absolute;
pointer-events: none;
background: var(--panel-2);
border: 1px solid var(--line);
border-radius: 6px;
padding: 6px 8px;
padding: 8px 10px;
font-size: 12px;
max-width: 280px;
z-index: 1;
min-width: 170px;
max-width: 290px;
z-index: 3;
box-shadow: var(--shadow-pop);
}
.side { display: flex; flex-direction: column; gap: 12px; }
.legend { display: grid; grid-template-columns: 14px 1fr; gap: 6px 8px; align-items: center; font-size: 13px; }
.swatch { width: 12px; height: 12px; border-radius: 50%; }
.tooltip .tip-title { font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.tooltip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .tip-row span:first-child { color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.swatch.player { background: var(--player); }
.swatch.online { background: var(--online); }
.swatch.wildlife { background: var(--wildlife); }
.swatch.pool { background: var(--pool); border: 1px solid var(--accent); }
.swatch.pool { background: var(--pool); border: 1.5px solid var(--pool-edge); }
.swatch.patch { background: var(--patch); border: 1.5px solid var(--faint); border-radius: 2px; }
.swatch.energy { background: var(--energy); }
.swatch.carbon { background: var(--carbon); }
.swatch.nitrogen { background: var(--nitrogen); }
.swatch.phosphorus { background: var(--phosphorus); }
.swatch.other { background: var(--other); }
.toggles { display: flex; flex-direction: column; gap: 6px; }
.toggles label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.error { color: var(--bad); }
.good { color: var(--good); }
.center { display: grid; place-items: center; min-height: 50vh; text-align: center; }
.window-controls { display: flex; gap: 8px; margin: 10px 0 8px; flex-wrap: wrap; }
.side input[type="text"] { width: 100%; min-width: 0; }
.small { font-size: 12px; margin-top: 6px; }
table.compact { margin-top: 10px; font-size: 12.5px; background: transparent; }
table.compact td { padding: 4px 6px; white-space: normal; }
button:disabled { opacity: 0.5; cursor: default; }
.action { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.action .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.amounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; margin-top: 6px; }
input.amount, input.count { min-width: 0; width: 100%; }
input.count { width: 80px; }
button.danger { color: var(--bad); border-color: var(--bad); }
.tuning-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; }
@media (max-width: 1000px) { .tuning-layout { grid-template-columns: 1fr; } }
/* Side panel with tabs. */
.panel {
position: sticky;
top: 72px;
max-height: calc(100vh - 88px);
display: flex;
flex-direction: column;
background: var(--panel);
border: 1px solid var(--line);
border-radius: var(--radius);
box-shadow: var(--shadow);
overflow: hidden;
}
@media (max-width: 1150px) { .panel { position: static; max-height: none; } }
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow-x: auto; }
.tabs button {
border: 0;
border-radius: var(--radius-sm) var(--radius-sm) 0 0;
background: transparent;
color: var(--muted);
padding: 8px 12px 9px;
font-size: 13px;
border-bottom: 2px solid transparent;
margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); background: var(--panel); }
.tabs .tab-badge { margin-left: 6px; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.panel-body { overflow-y: auto; padding: 4px 18px 18px; flex: 1; }
.block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.block-head .muted { font-size: 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .big { font-size: 26px; margin-bottom: 6px; opacity: 0.6; }
/* Forms. */
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.field input, .field select { width: 100%; }
.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.form-row .grow { flex: 1; min-width: 120px; }
.form-row input.count { width: 84px; }
input.wide, .wide { width: 100%; }
.note { font-size: 12.5px; margin-top: 8px; min-height: 0; }
.note:empty { display: none; }
.segmented { display: inline-flex; background: var(--panel-3); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; font-size: 12.5px; border-radius: 5px; }
.segmented button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
/* Resource ledger. */
table.ledger { font-size: 12.5px; background: transparent; }
table.ledger th { background: transparent; cursor: default; padding: 6px 6px; font-size: 10.5px; }
table.ledger td { padding: 6px 6px; }
table.ledger td:first-child, table.ledger th:first-child { padding-left: 0; }
table.ledger td:last-child, table.ledger th:last-child { padding-right: 0; }
table.ledger tr.total td { font-weight: 650; border-top: 1px solid var(--line-strong); }
table.ledger tr:hover { background: transparent; }
table.ledger th .swatch { margin-right: 4px; vertical-align: -1px; width: 8px; height: 8px; }
.split { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--panel-3); }
.split > span { display: block; height: 100%; }
.split-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.split-legend span { display: inline-flex; align-items: center; gap: 5px; }
.split-row { display: grid; grid-template-columns: 80px 1fr; gap: 10px; align-items: center; margin-top: 8px; font-size: 12px; }
/* Spent pool and drip. */
.drip-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.drip-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.drip-count { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; margin-top: 10px; }
.channel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0; }
.channel .name { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.channel .amt { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel .sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel.empty-ch { opacity: 0.55; }
.callout {
display: flex;
gap: 10px;
padding: 10px 12px;
border-radius: var(--radius-sm);
font-size: 12.5px;
background: var(--warn-soft);
color: var(--text);
border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
margin-bottom: 12px;
}
.callout::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: var(--panel); font-weight: 700; display: grid; place-items: center; font-size: 12px; }
.callout.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout.info::before { content: "i"; background: var(--accent); }
/* Lists in the panel. */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover .grow { color: var(--accent); }
.list-item .sub { color: var(--muted); font-size: 11.5px; }
/* Inspector. */
.inspect-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.inspect-head .swatch { width: 14px; height: 14px; }
.inspect-head h2 { margin: 0; }
.inspect-head .grow { flex: 1; }
/* Tuning settings. */
.settings-group { margin-top: 6px; }
.settings-group summary {
cursor: pointer;
list-style: none;
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px 0;
font-weight: 600;
font-size: 12.5px;
text-transform: capitalize;
border-bottom: 1px solid var(--line);
}
.settings-group summary::-webkit-details-marker { display: none; }
.settings-group summary::before { content: "▸"; color: var(--faint); margin-right: 8px; transition: transform 0.15s; display: inline-block; }
.settings-group[open] summary::before { transform: rotate(90deg); }
.settings-group summary .label { flex: 1; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 0 6px 16px; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.setting:last-child { border-bottom: 0; }
.setting .key { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.setting .val { font-family: var(--mono); font-size: 12px; font-weight: 600; text-align: right; }
.setting .why { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.setting.changed .val { color: var(--accent); }
mark { background: var(--warn-soft); color: inherit; border-radius: 2px; }
/* ---------- Tuning editor ---------- */
.tuning-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .tuning-layout { grid-template-columns: 1fr; } }
.tuning-layout .side { display: flex; flex-direction: column; gap: 14px; }
.tuning-layout .side .card + .card { margin-top: 0; }
textarea.tuning {
display: block;
width: 100%;
min-height: 60vh;
box-sizing: border-box;
min-height: 62vh;
font-family: var(--mono);
font-size: 12.5px;
line-height: 1.5;
line-height: 1.55;
color: var(--text);
background: var(--panel-2);
border: 1px solid var(--line);
border-radius: 6px;
padding: 10px 12px;
border-radius: var(--radius-sm);
padding: 12px 14px;
resize: vertical;
tab-size: 4;
}
textarea.tuning:focus { outline: none; border-color: var(--accent); }
.card input[type="text"].wide { width: 100%; min-width: 0; box-sizing: border-box; }
textarea.tuning:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.action { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.action .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
@@ -47,7 +47,8 @@ spec:
--audience aevolution-admin --client aevolution-admin-portal \
--role aevolution-admin --assets /usr/local/share/evo-admin-portal \
--pg-service /run/postgres/pg_service.conf --pg-passfile /run/postgres/pgpass \
--baseline-tuning /etc/evo/tuning/cellular-revamp.tuning "${regions[@]}"
--baseline-tuning /etc/evo/tuning/cellular-revamp.tuning \
--region-tuning /etc/evo/tuning/cellular.tuning "${regions[@]}"
env:
- {name: ADMIN_WORLD, value: "100"}
# Space-separated REGION=HOST:PORT: each region's operations address for /admin/view.
@@ -78,7 +79,7 @@ spec:
volumeMounts:
- {name: connection, mountPath: /run/postgres, readOnly: true}
# The revamp tuning file the regions opened with: the portal's baseline until the
# first tuning revision (ADR-0182 section 13).
# first tuning revision (ADR-0182 section 13); the region tuning file, shown read only.
- {name: tuning, mountPath: /etc/evo/tuning, readOnly: true}
volumes:
- name: tuning
@@ -87,6 +88,7 @@ spec:
defaultMode: 0444
items:
- {key: cellular-revamp.tuning, path: cellular-revamp.tuning}
- {key: cellular.tuning, path: cellular.tuning}
- name: connection
secret:
secretName: aevolution-admin-pg
+10
View File
@@ -1,5 +1,15 @@
# Project status and next steps
## Admin region page - 2026-10-28
The admin portal's region page is reorganized around the map: a KPI strip (tick pace,
population, deposit capacity, region energy and matter, spent pool, next drip), a map with
layer toggles, zoom and a scale, and tabs for inspecting cells and deposits, the region's
resources (where every channel sits, the spent pool and its drip), actions, the running
tuning and session access. The region view adds complete counts and totals and the drip
rules; the portal has light and dark themes. See
[ADR-0182](adr/0182-admin-portal-and-world-tuning.md) section 13.
## Live tuning - 2026-10-27
The admin portal's Tuning page edits the world's rules-13 tuning (the Git revamp file
@@ -263,6 +263,15 @@ Sections 1-2 are delivered without a new owner format or opening, so running rul
the line, key and kind of a problem, Adopt stores the revision with a reason, the revision
list shows how many regions adopted each, and each region shows which revision its live
rules match (`rules_sha256` in the region view).
- **Region page (2026-10-28).** The region view also carries the rules-13 drip
(`drip`: interval, energy and matter bubble caps) and, over every life and deposit whatever
the listing limits, `counts` (players, wildlife, patches, pools, bubbles) and `totals`
(reserve, body, patch, pool and bubble stock). The region page shows where the region's
stock sits, the spent pool with each channel's next drip and time to empty, a countdown to
the next drip at the measured tick pace, the deposit capacity (8,192) and whether the tick
is advancing. Its Tuning tab lists the settings the region runs (the matching revision or
baseline text) and the region tuning file (`--region-tuning`, the mounted `cellular.tuning`,
read only). The portal has light and dark themes.
Live today: everything the revamp file holds, including the drip (`spent.drip_interval_ticks`,
`spent.drip_bubble_pj`, `spent.drip_bubble_fg`). Section 4's new drip settings (bubbles per
+5 -2
View File
@@ -43,8 +43,9 @@
// [&energy=PJ][&carbon=FG]...[&reason=R]
// creates (no id) or replaces a schedule repeating
// add_bubbles, release_pool or spawn_wildlife
// GET /api/tuning the world's rules-13 tuning revisions, the newest text
// and the baseline file regions opened with (schema 66)
// GET /api/tuning the world's rules-13 tuning revisions, the newest text,
// the baseline file regions opened with (schema 66) and
// the region tuning file they restart with (read only)
// GET /api/tuning/<revision> one revision's text
// POST /api/tuning[?check=1][&reason=R] the request body is a tuning text (the Git
// revamp file format): checked, then stored as a new
@@ -61,6 +62,8 @@ struct AdminConfig {
std::vector<std::uint64_t> view_regions;
// The revamp tuning file the world's regions opened with (empty: unknown).
std::string baseline_tuning;
// The region tuning file (shape, movement, currents) they read at startup (empty: unknown).
std::string region_tuning;
std::string portal_config_json; // Served at /config.json.
std::string content_security_policy; // Sent with every portal file.
std::chrono::milliseconds db_timeout{3000};
@@ -12,7 +12,10 @@
// it is not a simulation output, a checkpoint or a client protocol.
//
// {"world":W,"region":R,"tick":T,"rules":N,["rules_sha256":"hex",]"area":[w,h],
// "spent":[e,c,n,p,o],"cells_total":N,"deposits_total":N,
// "spent":[e,c,n,p,o],["drip":[interval_ticks,bubble_pj,bubble_fg],]
// "cells_total":N,"deposits_total":N,
// "counts":[players,wildlife,patches,pools,bubbles],
// "totals":{"reserve":[e,c,n,p,o],"body":[...],"patches":[...],"pools":[...],"bubbles":[...]},
// "cells":[["life","organism","account",x,y,extent,flags,members,
// reserve_e,reserve_c,reserve_n,reserve_p,reserve_o,body_mass,"root"],...],
// "deposits":[[id,kind,x,y,radius,e,c,n,p,o],...]}
@@ -25,6 +28,9 @@
// in pJ, matter in fg. Cells and deposits beyond the limits are left out (by ascending life id and
// deposit id); the totals still count them. `rules_sha256` is given by the caller (the SHA-256
// of encode_cellular_revamp_rules, which tuning revisions are adopted by) and left out when empty.
// `drip` is the rules-13 spent-pool drip (cellular_drip_spent), left out before rules 13.
// `counts` and `totals` cover every life and deposit, whatever the limits: the region's stock
// is the totals plus `spent`.
namespace evo::server {
struct CellularAdminViewLimits {
std::size_t cells{4096}, deposits{16384};
+2
View File
@@ -810,6 +810,8 @@ OpsResponse AdminApi::tuning() {
out += "{\"text\":" + json_string(config_.baseline_tuning) + ",\"rules_sha256\":" +
(checked ? "\"" + hex(checked->digest) + "\"" : std::string{"null"}) + "}";
}
out += ",\"region_file\":";
out += config_.region_tuning.empty() ? std::string{"null"} : json_string(config_.region_tuning);
out += ",\"newest\":";
if (newest->empty())
out += "null";
+66 -1
View File
@@ -1,6 +1,7 @@
#include "evo/server/lifecycle/cellular_admin_view.hpp"
#include <algorithm>
#include <array>
#include <cstdint>
#include <string_view>
#include <vector>
@@ -17,6 +18,25 @@ void append_inventory(std::string& out, const accounting::Inventory& inventory)
append(out, channel.value);
}
}
// Energy then the four matter channels, summed without the inventory's overflow checks: a
// region's stock is far below 2^64 in every channel.
using Totals = std::array<std::uint64_t, 5>;
void add(Totals& totals, const accounting::Inventory& inventory) {
totals[0] += inventory.energy.value;
for (std::size_t i = 0; i < inventory.matter.size(); ++i)
totals[i + 1] += inventory.matter[i].value;
}
void append_totals(std::string& out, std::string_view name, const Totals& totals) {
out += "\"";
out += name;
out += "\":[";
for (std::size_t i = 0; i < totals.size(); ++i) {
if (i != 0)
out.push_back(',');
append(out, totals[i]);
}
out.push_back(']');
}
} // namespace
std::string cellular_account_text(const LifeAccount& account) {
@@ -60,11 +80,56 @@ std::string render_cellular_admin_view(const CellularLives& state,
append(out, state.area().height_um);
out += "],\"spent\":[";
append_inventory(out, state.spent());
out += "],\"cells_total\":";
out.push_back(']');
if (state.rules_version() >= cellular_lives_revamp_rules) {
const auto& rules = state.revamp_rules();
out += ",\"drip\":[";
append(out, rules.drip_interval_ticks);
out.push_back(',');
append(out, rules.drip_bubble_pj);
out.push_back(',');
append(out, rules.drip_bubble_fg);
out.push_back(']');
}
out += ",\"cells_total\":";
append(out, lives.size());
out += ",\"deposits_total\":";
append(out, patches.size());
// Counts and stock over every life and deposit, beyond the listing limits.
std::array<std::uint64_t, 5> counts{}; // Players, wildlife, patches, pools, bubbles.
Totals reserve{}, body{};
std::array<Totals, 3> deposits_by_kind{};
for (const auto& life : lives) {
++counts[life.account == LifeAccount{} ? 1 : 0];
add(reserve, life.reserve);
add(body, life.body);
}
for (const auto& patch : patches) {
const auto kind = static_cast<std::size_t>(patch.kind);
if (kind < deposits_by_kind.size()) {
++counts[2 + kind];
add(deposits_by_kind[kind], patch.stock);
}
}
out += ",\"counts\":[";
for (std::size_t i = 0; i < counts.size(); ++i) {
if (i != 0)
out.push_back(',');
append(out, counts[i]);
}
out += "],\"totals\":{";
append_totals(out, "reserve", reserve);
out.push_back(',');
append_totals(out, "body", body);
out.push_back(',');
append_totals(out, "patches", deposits_by_kind[0]);
out.push_back(',');
append_totals(out, "pools", deposits_by_kind[1]);
out.push_back(',');
append_totals(out, "bubbles", deposits_by_kind[2]);
out.push_back('}');
// Lives are kept in ascending life id; a prefix is the lowest ids.
out += ",\"cells\":[";
const auto cells = std::min(lives.size(), limits.cells);
+76
View File
@@ -1,6 +1,7 @@
#include "evo/server/lifecycle/cellular_admin_view.hpp"
#include "fixtures/cellular_ecology.hpp"
#include <array>
#include <cstdio>
#include <string>
@@ -59,12 +60,87 @@ void renders_cells_and_deposits() {
"deposit limit keeps ids 1 and 2");
const auto none = render_cellular_admin_view(*state, {}, {.cells = 0, .deposits = 0});
require(none.find("\"cells\":[],\"deposits\":[]}") != std::string::npos, "empty lists");
// Counts and totals cover everything, whatever the limits; no drip before rules 13.
std::array<std::uint64_t, 5> reserve{}, body{}, bubbles{};
std::array<std::size_t, 3> kinds{};
const auto add = [](std::array<std::uint64_t, 5>& totals, const accounting::Inventory& stock) {
totals[0] += stock.energy.value;
for (std::size_t i = 0; i < 4; ++i)
totals[i + 1] += stock.matter[i].value;
};
for (const auto& life : state->lives()) {
add(reserve, life.reserve);
add(body, life.body);
}
for (const auto& patch : state->habitat().patches()) {
++kinds[static_cast<std::size_t>(patch.kind)];
if (patch.kind == biology::CellularDepositKind::mote)
add(bubbles, patch.stock);
}
const auto list = [](const std::array<std::uint64_t, 5>& totals) {
std::string text = "[";
for (std::size_t i = 0; i < totals.size(); ++i)
text += (i == 0 ? "" : ",") + std::to_string(totals[i]);
return text + "]";
};
const auto counts = "\"counts\":[4,0," + std::to_string(kinds[0]) + "," +
std::to_string(kinds[1]) + "," + std::to_string(kinds[2]) + "]";
require(reserve[0] > 0 && body[1] > 0, "the fixture's cells hold stock");
for (const auto& text : {view, none}) {
require(text.find(counts) != std::string::npos, "counts");
require(text.find("\"totals\":{\"reserve\":" + list(reserve) + ",\"body\":" + list(body) +
",") != std::string::npos,
"cell totals");
require(text.find(",\"bubbles\":" + list(bubbles) + "}") != std::string::npos,
"bubble totals");
require(text.find("\"drip\"") == std::string::npos, "a drip before rules 13");
}
}
// The trial liquid rules (cellular_revamp_owner_tests).
CellularLiquidRules liquid() {
return {.currents = {5, 48'000, 48'000, 250, 2, 4, 3'000, 6'000, 60, 300},
.founder = {.thrust_q10 = 20'480,
.reverse_thrust_q10 = 20'480,
.forward_drag_ppm = 95'163,
.lateral_drag_ppm = 95'163,
.turn = 3'276},
.deposits = {.drift_radius_um = 200,
.max_drift_q10 = 100 * 1'024,
.drift_decay_ppm = 95'163,
.merged_cap = 8,
.bubble_radius_um = biology::cellular_mote_radius_um}};
}
// A rules-13 owner's view carries its spent-pool drip.
void renders_the_drip() {
auto state = opening(7, true, 2, false);
checked(state->advance_tick({}), "genesis tick");
state = checked(state->migration_upgrade_candidate(), "boundary upgrade");
state = checked(state->maturation_upgrade_candidate(), "maturation upgrade");
state = checked(state->inheritance_upgrade_candidate(), "inheritance upgrade");
state = checked(state->photosynthesis_upgrade_candidate({0, 1, {0}}), "light upgrade");
state = checked(state->liquid_upgrade_candidate(liquid()), "liquid upgrade");
CellularRevampRules rules{.body = {.essential_upkeep_per_thousand = 250},
.burn_pj_per_kfg = {2'000, 2'000, 2'000, 2'000},
.step = {.engulf_ratio_milli = 1'500,
.engulf_reserve_percent = 100,
.kill_bubble_per_thousand = 500},
.drip_interval_ticks = 20,
.drip_bubble_pj = 20'000'000,
.drip_bubble_fg = 1'000'000};
state = checked(state->revamp_upgrade_candidate(rules), "revamp upgrade");
const auto view = render_cellular_admin_view(*state, {});
require(view.find("],\"drip\":[20,20000000,1000000],\"cells_total\":") != std::string::npos,
"rules-13 drip");
}
} // namespace
int main() {
try {
renders_cells_and_deposits();
renders_the_drip();
} catch (const std::exception& error) {
std::fprintf(stderr, "%s\n", error.what());
return 1;
+3 -1
View File
@@ -648,6 +648,7 @@ void admin_api_tests(const Realm& realm) {
config.world = 9831;
config.view_regions = {1};
config.baseline_tuning = baseline;
config.region_tuning = file("cellular.tuning");
AdminApi tuned{config,
*TokenVerifier::from_jwks(realm.jwks("sig-1"), admin_rules),
[] { return connect_as(env("EVO_PG_ADMIN_USER")); },
@@ -665,7 +666,8 @@ void admin_api_tests(const Realm& realm) {
CHECK(none.member("newest")->kind() == JsonValue::Kind::null &&
none.member("revisions")->array()->empty() &&
none.member("baseline")->member("text")->string() == baseline &&
digest.size() == 64 && none.member("regions")->array()->at(0).string() == "1");
digest.size() == 64 && none.member("regions")->array()->at(0).string() == "1" &&
none.member("region_file")->string() == config.region_tuning);
// Bodies go to /api/tuning only; check=1 stores nothing.
CHECK(tuned