feat(admin): end a stranded life from the portal (schema 69)
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 6s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / postgres-tools (push) Successful in 5m17s
Foundation / image (push) Successful in 6m23s
Foundation / server-image (push) Successful in 8m26s

ADR-0182 section 18. Region 16 refused every birth for an account with
"Existing cell is already bound to this account" although no cell in it
held the account: a published reservation was never ended, and the only
remedy was tools/ops/end-account-life.sql as the database owner.

- Account action POST /api/accounts/<uuid>/end-life?request=N. The admin
  API reads the life's region from the account's lives and refuses while
  that region's live view lists a cell holding the account (also a bud,
  split offspring or organism control moved to), a region it cannot view,
  an incomplete view, an unpublished request or a life no longer open.
- Schema 69: admin_end_account_life_v1 (admin role only) ends it at the
  region's latest commit and appends who and why to admin_life_endings.
- The account page shows End life for each published life not ended.
- A region refusing a birth because the account holds a cell (life_exists)
  could never record it: reject_primitive_life accepted reasons 1..3 only.
  The reservation stayed open and unpublished and refused every later
  birth. Schema 69 and the C++ wrapper accept existing_life (4).
- A region with no ticking cells ignored queued admin commands (such as a
  spawn) until something else woke it; a queued command now keeps it
  ticking until applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-29 07:32:08 -04:00
co-authored by Claude Opus 5.5
parent 8085392122
commit 6de2b7b1ca
15 changed files with 274 additions and 18 deletions
+15 -3
View File
@@ -144,6 +144,7 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
SELECT :'history_v65' || ',66:' || :'migration_sha_66' AS history_v66 \gset
SELECT :'history_v66' || ',67:' || :'migration_sha_67' AS history_v67 \gset
SELECT :'history_v67' || ',68:' || :'migration_sha_68' AS history_v68 \gset
SELECT :'history_v68' || ',69:' || :'migration_sha_69' AS history_v69 \gset
SELECT :'history' = :'history_v22' AS at_v22,
:'history' = :'history_v23' AS at_v23,
:'history' = :'history_v24' AS at_v24,
@@ -190,8 +191,10 @@ SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='evolution')
:'history' = :'history_v65' AS at_v65,
:'history' = :'history_v66' AS at_v66,
:'history' = :'history_v67' AS at_v67,
:'history' = :'history_v68' AS at_v68 \gset
\if :at_v68
:'history' = :'history_v68' AS at_v68,
:'history' = :'history_v69' AS at_v69 \gset
\if :at_v69
\elif :at_v68
\elif :at_v67
\elif :at_v66
\elif :at_v65
@@ -621,7 +624,8 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
coalesce(max(version), 0) = 65 AS at_v65,
coalesce(max(version), 0) = 66 AS at_v66,
coalesce(max(version), 0) = 67 AS at_v67,
coalesce(max(version), 0) = 68 AS at_v68
coalesce(max(version), 0) = 68 AS at_v68,
coalesce(max(version), 0) = 69 AS at_v69
FROM evolution.schema_migrations \gset
\if :at_v24
\ir 0025_cellular_v2_bundle.sql
@@ -858,6 +862,7 @@ SELECT coalesce(max(version), 0) = 24 AS at_v24,
\elif :at_v66
\elif :at_v67
\elif :at_v68
\elif :at_v69
\else
\echo 'Unknown or changed migration history after v43'
DO $$ BEGIN RAISE EXCEPTION 'unknown or changed migration history'; END $$;
@@ -962,6 +967,10 @@ SELECT coalesce(max(version), 0) = 67 AS needs_v68 FROM evolution.schema_migrati
\if :needs_v68
\ir 0068_larger_region_ticks.sql
\endif
SELECT coalesce(max(version), 0) = 68 AS needs_v69 FROM evolution.schema_migrations \gset
\if :needs_v69
\ir 0069_admin_end_life.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
@@ -1114,6 +1123,8 @@ GRANT EXECUTE ON FUNCTION evolution.admin_commands_v1(evolution.u64, evolution.u
GRANT EXECUTE ON FUNCTION evolution.admin_set_account_ban_v1(evolution.u64, uuid, boolean, text,
text) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_logout_account_v1(evolution.u64, uuid) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_end_account_life_v1(evolution.u64, uuid, evolution.u64,
text, text) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_account_status_v1(evolution.u64) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_account_bans_v1(uuid) TO :"admin_role";
GRANT EXECUTE ON FUNCTION evolution.admin_set_schedule_v1(evolution.u64, evolution.u64, bigint,
@@ -1152,6 +1163,7 @@ BEGIN
('evolution.admin_commands_v1(evolution.u64,evolution.u64)'::regprocedure::oid),
('evolution.admin_set_account_ban_v1(evolution.u64,uuid,boolean,text,text)'::regprocedure::oid),
('evolution.admin_logout_account_v1(evolution.u64,uuid)'::regprocedure::oid),
('evolution.admin_end_account_life_v1(evolution.u64,uuid,evolution.u64,text,text)'::regprocedure::oid),
('evolution.admin_account_status_v1(evolution.u64)'::regprocedure::oid),
('evolution.admin_account_bans_v1(uuid)'::regprocedure::oid),
('evolution.admin_set_schedule_v1(evolution.u64,evolution.u64,bigint,integer,integer,evolution.u64,evolution.u64,evolution.u64,evolution.u64,evolution.u64,integer,boolean,text,text)'::regprocedure::oid),