feat(admin): live admin commands in trace 5 (schema 63)
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m44s
Foundation / image (push) Successful in 5m33s

The admin portal can now spawn wildlife, add bubbles, add to or release the
spent pool, remove a cell and grant a cell's reserve on a running rules-13
region (ADR-0182 section 10). No new owner format or region opening.

- Trace 5: trace 4 plus 64-byte command records counted in the tick header's
  last word; a batch without commands stays trace 4 (older builds replay it).
  Bundle 15 admits trace 5.
- CellularLives::admin_candidate applies a tick's commands after its births,
  each on a copy kept only when it applies and closes: imports through the
  boundary ledger, removals into the spent pool with a new `removed` corpse
  cause, spawned roots via the ADR-0180 seed (now a shared helper) funded by
  an exact import. Refused commands change nothing.
- Schema 63: the immutable admin_commands queue (spawn identities from the
  life allocator), pending/history reads, and binding of every recorded
  command exactly once inside both cellular publishers; the SQL trace parsers
  read trace 5 through its trace-4 normal form.
- The region polls pending commands every 2 s and appends up to 16 per tick;
  the admin API and portal gain region actions, per-cell Remove/Grant and the
  command history.
- Fixes an existing test that did not advance its head after a tick commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-27 17:14:04 -04:00
co-authored by Claude Opus 5.5
parent b075198040
commit b1cc3b121b
32 changed files with 1487 additions and 138 deletions
+21 -4
View File
@@ -138,6 +138,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
SELECT :'history_v59' || ',60:' || :'migration_sha_60' AS history_v60 \gset
SELECT :'history_v60' || ',61:' || :'migration_sha_61' AS history_v61 \gset
SELECT :'history_v61' || ',62:' || :'migration_sha_62' AS history_v62 \gset
SELECT :'history_v62' || ',63:' || :'migration_sha_63' AS history_v63 \gset
SELECT :'history' = :'history_v22' AS at_v22,
:'history' = :'history_v23' AS at_v23,
:'history' = :'history_v24' AS at_v24,
@@ -178,8 +179,10 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
:'history' = :'history_v59' AS at_v59,
:'history' = :'history_v60' AS at_v60,
:'history' = :'history_v61' AS at_v61,
:'history' = :'history_v62' AS at_v62 \gset
\if :at_v62
:'history' = :'history_v62' AS at_v62,
:'history' = :'history_v63' AS at_v63 \gset
\if :at_v63
\elif :at_v62
\elif :at_v61
\elif :at_v60
\elif :at_v59
@@ -597,7 +600,8 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
coalesce(max(version), 0) = 59 AS at_v59,
coalesce(max(version), 0) = 60 AS at_v60,
coalesce(max(version), 0) = 61 AS at_v61,
coalesce(max(version), 0) = 62 AS at_v62
coalesce(max(version), 0) = 62 AS at_v62,
coalesce(max(version), 0) = 63 AS at_v63
FROM evolution.schema_migrations \gset
\if :at_v24
\ir 0025_cellular_v2_bundle.sql
@@ -828,6 +832,7 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
\elif :at_v60
\elif :at_v61
\elif :at_v62
\elif :at_v63
\else
\echo 'Unknown or changed migration history after v43'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
@@ -908,6 +913,10 @@ SELECT coalesce(max(version), 0) = 61 AS needs_v62 FROM evolution.schema_migrati
\if :needs_v62
\ir 0062_session_windows.sql
\endif
SELECT coalesce(max(version), 0) = 62 AS needs_v63 FROM evolution.schema_migrations \gset
\if :needs_v63
\ir 0063_admin_commands.sql
\endif
-- Effective-privilege audit on every run, including no-ops (ADR-0060). Attributes
-- alone are insufficient: predefined roles such as pg_write_all_data, PUBLIC
-- grants or SET-able memberships would bypass the fenced functions. Checks the
@@ -982,6 +991,7 @@ BEGIN
('evolution.end_cellular_lives(evolution.u64,evolution.u64,uuid,evolution.u64,uuid,bytea)'::regprocedure::oid),
('evolution.issue_account_grant(evolution.u64,text,text)'::regprocedure::oid),
('evolution.load_session_window_v1(evolution.u64,evolution.u64)'::regprocedure::oid),
('evolution.load_pending_admin_commands_v1(evolution.u64,evolution.u64)'::regprocedure::oid),
('evolution.revoke_account_grants(evolution.u64,text,text)'::regprocedure::oid),
('evolution.load_cellular_publication_actions(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
('evolution.load_cellular_publication_births(evolution.u64,evolution.u64,uuid,evolution.u64,uuid)'::regprocedure::oid),
@@ -1050,6 +1060,11 @@ GRANT EXECUTE ON FUNCTION evolution.admin_session_windows_v1(evolution.u64, evol
TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_set_session_window_v1(evolution.u64, evolution.u64,
integer, text, text) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_enqueue_command_v1(evolution.u64, evolution.u64, integer,
integer, evolution.u64, evolution.u64, evolution.u64, evolution.u64, evolution.u64,
evolution.u64, text, text) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_commands_v1(evolution.u64, evolution.u64)
TO :"admin_role";
SELECT pg_catalog.set_config('evolution.admin_role', :'admin_role', true);
DO $$
DECLARE
@@ -1072,7 +1087,9 @@ BEGIN
('evolution.admin_regions_v1(evolution.u64)'::regprocedure::oid),
('evolution.load_session_window_v1(evolution.u64,evolution.u64)'::regprocedure::oid),
('evolution.admin_session_windows_v1(evolution.u64,evolution.u64)'::regprocedure::oid),
('evolution.admin_set_session_window_v1(evolution.u64,evolution.u64,integer,text,text)'::regprocedure::oid)
('evolution.admin_set_session_window_v1(evolution.u64,evolution.u64,integer,text,text)'::regprocedure::oid),
('evolution.admin_enqueue_command_v1(evolution.u64,evolution.u64,integer,integer,evolution.u64,evolution.u64,evolution.u64,evolution.u64,evolution.u64,evolution.u64,text,text)'::regprocedure::oid),
('evolution.admin_commands_v1(evolution.u64,evolution.u64)'::regprocedure::oid)
), violations(reason) AS (
SELECT 'admin role is the runtime role' WHERE admin = runtime
UNION ALL