feat(admin): read-only admin portal and API (ADR-0182 step 1, schema 61)

evo-admin-api serves the portal at srs.aeternalisgames.com and read-only JSON
for world 100 behind Keycloak (realm role aevolution-admin, audience
aevolution-admin, client aevolution-admin-portal): accounts with session,
status, lives, deaths, resets and mutation choices; one account's lives; the
world's regions; and a live 2D region view of cells, wildlife, pools and
bubbles. The portal is plain HTML/CSS/JS with PKCE sign-in, a strict CSP and
no third-party code.

- Schema 61: three bounded SECURITY DEFINER read functions, fenced in the
  privilege audit; no table or existing function changes.
- Cellular regions answer GET /admin/view on the ops port (NetworkPolicy:
  Prometheus and the admin portal only); CellularLives::extent_of reads the
  existing phenotype budget. No simulation, checkpoint or wire change.
- TokenVerifier takes an optional realm role and returns the email; the ops
  server's response bound is configurable (16 KiB default unchanged).
- DEV component admin-portal-dev (Deployment, Service, NetworkPolicies); the
  Ingress and the aevolution-admin-pg Secret are created out of band.
- CI scripts pinned to schema 60 now expect 61.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-27 12:39:28 -04:00
co-authored by Claude Opus 5.5
parent 46e5ea6c5d
commit 54beceb823
36 changed files with 2331 additions and 37 deletions
+18 -1
View File
@@ -55,6 +55,7 @@
#include "evo/biology/founder.hpp"
#include "evo/processes/development_opening.hpp"
#include "evo/server/cellular_session_batch.hpp"
#include "evo/server/lifecycle/cellular_admin_view.hpp"
#include "evo/server/lifecycle/cellular_schedule.hpp"
#include "evo/server/lifecycle/primitive_lives.hpp"
#include "evo/server/lifecycle/wildlife_controller.hpp"
@@ -925,7 +926,9 @@ int serve_cellular(Options& o) {
return 2;
std::unique_ptr<server::OpsServer> ops;
if (!o.ops_listen.empty()) {
auto listening = server::OpsServer::listen(o.ops_listen);
// Room for /admin/view (ADR-0182); probes and metrics stay small.
auto listening = server::OpsServer::listen(
o.ops_listen, server::OpsServer::max_configurable_response_bytes);
if (!listening) {
std::puts("error ops-listen");
return 2;
@@ -1092,6 +1095,20 @@ int serve_cellular(Options& o) {
counters.checkpoint_age_ms = schedule.status().head_age_us / 1000;
return {200, server::render_metrics(paced, counters)};
}
// ADR-0182: the admin portal's read-only region view. The port admits only
// Prometheus and the admin API (NetworkPolicy).
if (path == "/admin/view") {
const auto* state = host.state();
if (!current.ready || state == nullptr)
return {503, "not ready\n"};
const auto online = [&](const server::LifeAccount& account) {
network::AccountId id;
id.bytes = account;
return bridge->sessions().holder(id).has_value();
};
return {200, server::render_cellular_admin_view(*state, online),
"application/json"};
}
return {404, "not found\n"};
};
ops->serve(handler);