Files
aevolution/docs/adr/0182-admin-portal-and-world-tuning.md
T
dingoandClaude Opus 5.5 6de2b7b1ca
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
feat(admin): end a stranded life from the portal (schema 69)
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>
2026-10-29 07:32:08 -04:00

474 lines
31 KiB
Markdown

# ADR-0182: Admin portal, world tuning in SQL and per-tick amendments
## Status and scope
Accepted direction, 2026-10-27, from the maintainer's decisions in chat; delivered in parts
(sections 8-13). DEV (world 100) only; stage and World0 need their own review. Supersedes, for
rules-13 regions, ADR-0181's "Git tuning affects future openings only. No live retune": since
schema 66 (section 13) a running rules-13 region adopts tuning revisions at recorded ticks.
Regions on older rules keep their recorded rules.
## Context
Every balance change so far has meant a Git tuning edit, a new image or ConfigMap and a new
DEV region (regions 14, 15 and 16 in a week). The maintainer wants an admin portal to review
accounts, act on regions and tune the cellular game while it runs. This is a game, not a
pure simulation: designer-controlled resource sources are acceptable when they are named and
counted.
The constraint is determinism. A region's history must replay to the same state, so nothing
may change a running region except an event recorded at a tick.
## Decision
### 1. World tuning lives in SQL
- Schema 63 adds append-only `world_tuning_revisions(world, revision, parent_revision,
format, canonical_text, digest, author_subject, reason, created_at)`. A revision is the
complete canonical tuning text (`encode_cellular_revamp_tuning`), never a diff, so the
existing parser and validator are the only interpretation.
- All regions of a world share its tuning and mutation definitions (maintainer decision).
Per-region values are not offered.
- Revisions are immutable. Undo is a new revision whose text equals an earlier one.
- Git keeps the seed file for creating a world and the test fixtures. It is not consulted
by a running region, and Argo no longer carries tuning for regions on the new format.
### 2. Amendments are recorded per tick
- A region polls for a newer world revision on its existing database connection, bounded
and off the tick path (at most once a second).
- It validates the revision with its own parser. If it can parse it, it adopts it at its next
tick boundary and records `tuning_adopted(revision, digest)` at that tick in its own
history, published with that tick. If it cannot, for example because the revision uses
keys its image does not know, it keeps its current revision and reports `tuning_refused`
with the revision number. The portal shows each region's adopted revision.
- Replay and recovery read the recorded revision by number and digest, never "the latest".
- Amendments change future calculations only. Heritable values already in a genome are not
rewritten (for example, a new `mutation.min_points` does not change existing traits).
- Every tuning key is classified **live** or **opening-only**. Opening-only keys (geometry
and size, tick rate, world/frame, liquid profile structure) can be revised, but a running
region ignores them and the portal labels them "next opening".
### 3. Admin commands
- Schema 63 adds `admin_commands(world, region, command_id, kind, payload, author_subject,
reason, created_at, applied_tick, outcome)`. The admin API inserts and the region host
drains them at tick boundaries in id order, publishing each with that tick. This is the
same pattern as the durable mutation queue (schema 59).
- Kinds:
- `kill_cell(life)`: the cell dies with an "admin" outcome. Its body and reserve go to
the spent pool and drip back.
- `grant_reserve(life, inventory)`: a **game-source import** into that cell's reserve.
- `add_region_bubbles(inventory, count)`: a game-source import as bubbles at random
spots, at most the region's bubble limit per tick; the rest follows on later ticks.
- `add_pool(inventory)`: a game-source import into the spent pool.
- `release_pool(inventory)`: moves pool matter into the region through the drip settings
below, so a large release is spread over drips, never one tick.
- **Game source** is a named import in the region's accounting, like emergence is a named
export. Conservation still holds: every unit is either from the starting stock, imported
by a recorded source or exported by a recorded sink.
### 4. Drip and source settings
The spent-pool drip (today: interval, largest energy bubble, largest matter bubble per
channel) becomes one settings group used by both the pool drip and the game-source spawn:
| Setting | Meaning |
|---|---|
| `drip.interval_ticks` | how often a drip happens (0: never) |
| `drip.bubbles_per_drip` | the most bubbles one drip creates |
| `drip.bubble_max.<channel>` | the most of that channel one bubble may carry (energy pj; carbon, nitrogen, phosphorus, other fg) |
| `drip.scale_percent.<channel>` | per channel, how much faster or slower that channel is released |
| `source.per_drip.<channel>` | game-source import per drip and channel (0: none) |
For the pool, scale changes how quickly the pool drains; it never releases more than the
pool holds. For the source, scale multiplies the import.
### 5. Data-defined mutations
- Mutation definitions move from the compiled catalog into the world revision:
`mutation.<key>.*` gains the definition itself (name, description, effect, primary and
paired traits, steps, costs, triggers and requirements), not only overrides.
- A definition may use only effects, traits, triggers and requirement predicates the image
implements. Requirements come from a fixed predicate set (carbon burned, buds made, a
trait at or above a value, a mutation held). New behaviour needs code and a new image;
the region then refuses revisions using it until promoted.
- The per-cell affinity scores become a vector keyed by mutation id. New entries start at
zero. This is part of the new owner format.
- Mutations are never deleted from a running world. `enabled = 0` stops new offers;
applied mutations stay applied because their effect already changed the genome.
Replacement is disable plus a new definition.
- Session protocol: the client receives definitions (name, description, costs) instead of
using compiled names.
### 6. Accounts
- **Status**: logged in (an open session interval), banned, alive or dead, the region of
the active life, and current mutations (applied mutation results along the life's line).
- **Ban**: `account_bans(account, author_subject, reason, created_at, lifted_at)`. The grant
broker refuses a banned account (`403 account_banned`) and the ban runs the existing
logout (`revoke_account_grants`), so a live session closes within 5 s.
- **Log out**: the existing `revoke_account_grants`.
- **Grant resource**: `grant_reserve` against the account's active life.
- **Death count**: the account's lives with a death outcome.
- **Reset count**: the account's founder births after its first (a new life after death).
- **Living offspring**: living wildlife descended from any of the account's lives, using
the parent links kept since format 5.
- **Time played**: `session_intervals(account, region, started_at, ended_at)` written by the
region host on session open and close. Intervals still open at a region start are closed
at that start. History begins with this schema; earlier play is not recoverable.
### 7. Admin API and portal
- `evo-admin-api`: a C++ service built like the grant broker. It verifies Keycloak access
tokens against the realm keys pinned in Git, requires audience `aevolution-admin`,
authorized party `aevolution-admin-portal` and realm role `aevolution-admin`, and serves
one configured world. Its component exists only in the evolution-dev overlay; World0 and
stage have no admin portal (World0 has no fixed world id to refuse in code).
- Every write records the token subject and a reason.
- The region view: the region host's internal ops port gains a bounded snapshot route (cell
id, position, extent, wildlife/player and account, bubbles), reachable only from the admin
API by NetworkPolicy. The admin API serves it to the portal at up to 1 Hz.
- The portal is a static browser application at `https://srs.aeternalisgames.com`
(section **Cellular** now, **3D** later) using authorization code with PKCE. It is plain
HTML, CSS and JavaScript with no third-party code, so no dependency evaluation is needed.
- Keycloak (maintainer setup): realm role `aevolution-admin`; public client
`aevolution-admin-portal` with standard flow and PKCE S256, redirect URI
`https://srs.aeternalisgames.com/*`, web origin `https://srs.aeternalisgames.com` and
post-logout redirect `https://srs.aeternalisgames.com/`; an audience mapper adding
`aevolution-admin`; MFA required for the role.
### 8. Read-only portal (delivered first, schema 61)
- **Schema 61** adds three bounded, read-only SECURITY DEFINER functions, executable by the
runtime group and listed in the privilege audit: `admin_accounts_v1(world)` (every account
with its identity, session control, lives, deaths, active life and mutation-choice count),
`admin_account_lives_v1(world, account)` (its life requests and endings) and
`admin_regions_v1(world)` (leases and heads). No table or existing function changes. The
runtime group still has no table privilege. DEV's admin API logs in with its own login in
that group, as the grant broker does; a dedicated read role is a later least-privilege step.
- **Derived values.** A life is a published, unrefused reservation; a death is an ended one;
resets are lives after the first; logged in means the session control has not expired.
- **Region view.** `GET /admin/view` on the cellular region's ops port renders the committed
in-memory owner (`render_cellular_admin_view`): every cell (life and organism ids as
strings, account, footprint, extent, wildlife/connected/lingering/suspended flags,
members, reserve, body mass) and every pool and bubble, bounded to 4,096 cells and 16,384
deposits with totals. It reads without changing anything; the ops server's response
bound becomes configurable (4 MiB for this port), default 16 KiB elsewhere.
- **Portal files and headers.** The image ships the portal under
`/usr/local/share/evo-admin-portal`. Files go out with a strict Content-Security-Policy
(`'self'` scripts and styles, connections only to this origin and the realm), `nosniff`,
`no-referrer` and `DENY` framing; every answer is `no-store`. The access token stays in
page memory and the rotating refresh token in the tab's sessionStorage.
- **Not yet available** (they need the schema-63 records): time played, bans, current
mutations and living offspring.
### 9. Session windows and the admin role (schema 62)
The dev session window moves from Git to SQL and is opened, extended and closed from the
portal; see the [ADR-0087 amendment](0087-dev-session-route.md). Schema 62 also moves the
admin functions to a dedicated, operator-created NOLOGIN group role (`aevolution_admin` in
DEV, `EVO_PG_ADMIN_ROLE` for the migration): every migration run grants it exactly the admin
functions and audits it like the runtime group (no table privilege, no privileged
attribute, no membership outside it, not the runtime role). Schema 61's read views are
revoked from the runtime group. The admin API logs in with its own login in that group.
Writes go through POST without a body (`?minutes=M&reason=R`); the bearer token in the
`Authorization` header, never a cookie, is the only credential.
### 10. Admin commands (delivered, schema 63, trace 5)
The commands of section 3 are delivered without a new owner format or region opening:
- **Trace 5.** A rules-13 batch may record operator commands: trace 4 plus 64-byte records
(id, kind, count, target, energy and four matter amounts) counted in the tick header's last
word, which trace 4 keeps zero. A batch without commands stays trace 4, so builds before
this one still replay it; only commits that carry commands need this build or later.
Bundle 15 admits trace 5 (`cellular_checkpoint_trace_admits`); the manifest is unchanged.
- **Application.** `CellularLives::admin_candidate` applies a tick's commands after its
births, by ascending id, each on a copy kept only if it applies and still closes:
`remove_cell` (body and reserve to the spent pool, a corpse with the new `removed` cause;
a player's life then ends as any death does), `grant_reserve`, `add_bubbles` and
`add_pool` (imports in the boundary ledger), `release_pool` (moves at most what the pool
holds into bubbles) and `spawn_wildlife` (1-64 randomized founder roots, the ADR-0180 seed
with an exact import for their reserve, body and construction). A command whose target is
gone, or that does not fit (region cap, deposit limit, a taken identity), is refused and
changes nothing.
- **Queue and binding.** `admin_enqueue_command_v1` (admin role) stores the exact command;
spawning reserves its identities from the world's life allocator. The region reads
`load_pending_admin_commands_v1` every 2 s and appends up to 16 per tick. Both cellular
publishers bind every recorded command to its queue row exactly once, in the publishing
transaction; a differing or already-applied command refuses the publication. The SQL trace
parsers read a trace 5 through its trace-4 normal form, after binding the real trace to
the manifest.
- **Portal.** Region actions (spawn wildlife, add bubbles, add to or release the spent pool),
per-cell Remove and Grant reserve, and the command history with the tick each applied at.
Amounts are entered in µJ and ng.
### 11. Account administration (delivered, schema 64)
- **Bans.** Append-only `account_bans` rows; the newest per account decides. A banned
account's grant request fails with SQLSTATE EVL20 (the broker answers 403
`account_banned`), and banning also revokes its grants, so a live session closes at its
next control renewal. Lifting a ban is another row.
- **Logout.** `admin_logout_account_v1` revokes by account id, as the player's own logout
does by Keycloak identity.
- **Time played.** The session-control functions keep their signatures and also record
`session_intervals`: a claim opens one, a renewal moves its last-seen time, a release ends
it; an unreleased session ends at its last renewal. History starts with schema 64.
- **Living offspring.** The region view adds each cell's lineage root; the portal counts
living wildlife whose root is one of the account's lives.
### 12. Resource schedules (delivered, schema 65)
The game source of section 4 without a new owner format: a schedule repeats an
`add_bubbles`, `release_pool` or `spawn_wildlife` command (count, amounts per resource)
every 1 s to 24 h while enabled. When the region reads its pending commands, each due
schedule queues its next command as an operator would, so it is recorded in the trace and
bound once; a schedule never has two commands waiting, so an idle region (no living cells,
no ticks) accumulates nothing. Versions are append-only; the newest decides.
The spent pool's own drip (interval, bubble caps, bubbles per drip, per-channel scale) is a
rules setting and stays with the tuning amendments.
### 13. Tuning amendments (delivered, schema 66)
Sections 1-2 are delivered without a new owner format or opening, so running rules-13 regions
(region 16 included) can be retuned:
- **Revisions.** Append-only `tuning_revisions(revision, world, text, rules_sha256, author,
reason, created_at)`. The text is the Git revamp tuning file format, kept as the admin wrote
it (comments included); `rules_sha256` is the SHA-256 of `encode_cellular_revamp_rules` for
the rules it produces, the same canonical bytes the owner snapshot stores. The admin API
parses and validates the text (`parse_cellular_revamp_tuning`, `cellular_revamp_rules`,
`cellular_revamp_valid`) before storing it, and `admin_set_tuning_v1` queues the adoption
in every region of the world in the same transaction.
- **Adoption is an admin command.** Kind 7 `adopt_tuning` carries the revision as its target
and the rules digest in its four amount words (little-endian; `other` zero). It is queued
only through a revision, never by kind. The region fetches the revision's text
(`load_tuning_revision_v1`), rebuilds the rules with its own parser and appends the command
only when the digest matches; a text it cannot parse or a mismatch is logged and the command
stays pending (section 2's `tuning_refused`). Applied at a tick after births, the command
replaces the region's rules; it is recorded in trace 5 and bound once like any command.
- **Replay and recovery.** Applying or replaying an adoption needs whoever does it to name
the rules for that revision and digest (`CellularTuningResolver`): the host from its
verified revisions, the publisher and recovery from the successor state, checked against
the recorded digest. A batch carries at most one adoption, so its successor names exactly
one set of rules. Nothing reads "the latest" revision.
- **What cannot change live.** `reproduction.safety_version` is a law of the opening
(ADR-0181): the admin API refuses a text that changes it, and a region would refuse the
command. `playtest.*` only matters when a region opens. Heritable values already in genomes
are not rewritten.
- **Portal.** A Tuning page: the editor starts from the newest revision or the baseline file
the regions opened with (`--baseline-tuning`, the mounted Git revamp file), Check reports
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).
- **Guided editor (2026-10-28).** The Tuning page edits by section: each setting as a field
with its unit, a reading in plain units and its comment, changed values listed against the
base. `POST /api/tuning?base=baseline|REV` takes only the changed `key = value` lines and
applies them to the baseline file or to revision REV, which must be the newest (409
`stale_base` otherwise), keeping the base's comments; the result is checked and stored as
any full text. DEV's ingress admits request bodies of about 1 KB, below a whole revamp
file, so the full-text editor (kept as Text mode) reports that proxy refusal plainly.
- **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
drip, per-channel scale) are new rules fields, so they need a rules format change; the
resource schedules of section 12 cover the game source meanwhile.
Still pending from this ADR: section 4's new drip settings,
data-defined mutations (section 5) and the account's current mutations; opening new regions
or worlds from the portal (a later gate: Git-generated manifests through the Gitea API and an
Argo sync for one more region in the world; several concurrent regions or worlds need
per-region Deployments, volumes and routes).
### 14. Energy cycle (delivered 2026-10-28, live-tunable)
Matter a cell burns returns to the spent pool and drips back; energy it uses (upkeep, motion,
growth, mutation rebuilds, the share of a bubble lost in feeding, predation losses) went to the
region's heat store and never came back. Light is the only new energy, so a region without
photosynthesizers drained into heat: region 16's wildlife ate the region's energy and starved,
its spent pool held only matter, and the matter-only bubbles it dripped filled the 8,192
deposits.
- **Heat recycling.** `spent.heat_recycle_per_mille` (rules field `heat_recycle_per_thousand`,
0..1,000): at the end of every tick, before the drip, that share of the region's whole heat
store moves to the spent pool. 1,000 closes the loop, and adopting it also returns the heat
a region built up before. Energy is conserved as before (heat and spent are both region
stock). Below 1,000 the heat returns more slowly; nothing is lost.
- **Absorbing drip.** `spent.drip_absorb` (0/1): a drip at the deposit limit adds its amount
to an existing bubble, the first at or after its seeded spot in address order (wrapping),
instead of waiting. A habitat with no bubble at all still waits.
- **Encoding.** Both fields use the reserved word after the offer interval (the recycle share
in the low 16 bits, the absorbing drip in bit 16), so rules without them keep their exact
bytes, digests, checkpoints and replays. Both keys are optional in the tuning file and can be
adopted live as a tuning revision; the DEV file sets 1,000 and 1.
- **View and portal.** The region view reports `heat` and the drip's recycle share and absorb
flag; the region page counts heat in the region's energy and its ledger, and says when energy
is being lost as heat.
Not changed: a region with no living cell does not tick, so it neither recycles nor drips; an
empty region needs a spawn or a player before the cycle restarts.
### 15. Opening a region from the portal (delivered 2026-10-28, DEV)
The portal opens a fresh region in place of the one DEV serves, as was done by hand for
regions 14, 15 and 16. Concurrent regions and new worlds remain later work (per-region
Deployments, routes and ports; a multi-world admin API and broker).
- **Decisions (2026-10-28).** Replace the served region; commit straight to `main` and run a
full Argo sync at once (CI runs on the commit afterwards); the admin portal pod may reach
Gitea and argocd-server; the in-cluster Argo hop may skip TLS verification
(`ARGOCD_TLS_VERIFY=false`).
- **Credentials.** Secret `aevolution-admin` (created by the operator: Gitea base URL,
repository and repository-scoped token for `aevolution-bot`; Argo CD server, Application and
token) is mounted read-only as files at `/run/deploy` (`--deploy-config`), never as
environment; optional, so the portal runs without it and the feature stays off. Tokens travel
only in request headers and are never logged.
- **The change.** Four files, read at one commit of `main` with their blob shas
(`region_switch_paths`): the region overlay's `region-values.yaml` (REGION_ID for the
Deployment and the provision Job, REGION_LIFE_ROUTES, the opening's `--commit` and
`--playtest-wildlife-first-id`, and a one-line note above the opening), its kustomization
header, and the region named in the grant broker's routes and the portal's `ADMIN_REGIONS`.
Nothing else changes; a file whose expected lines are missing, repeated or inconsistent is
refused. The next region is one above every region with a lease in the world; its seeded
wildlife range follows the previous one by `playtest.starting_wildlife_cells`; its genesis
commit is 16 random bytes. One Gitea multi-file commit (the shas guard concurrent edits),
then `POST /api/v1/applications/<app>/sync` for exactly that commit with prune: the
provision hook opens the region before the region host restarts on it.
- **Guards.** The request names the region the portal showed (409 if another is next now);
a running Argo operation refuses (409); the portal asks the admin to type the number. The
earlier region stays in the stores, unserved; a new region's session window starts closed.
- **Network.** The portal's NetworkPolicy adds egress to 172.10.1.160:443 (Gitea through the
node's ingress) and to the argocd-server pods on 8080.
### 16. Testing a full region (delivered 2026-10-28, schema 67)
Playtesting region 16 (230 spawned wildlife under the 256-life cap) found three gaps.
- **Stale bud costs.** The region host caches each genome's bud cost for the client's Bud
button. The cache was keyed by genome only, so after a tuning adoption players saw the old
cost (or "cannot bud") until the region restarted. The cache now clears when the rules'
encoding changes.
- **Wildlife cap.** Wildlife bud whenever they can pay, so at the organism cap every slot a
death freed went to a wildlife bud before a player's bud arrived; the player saw "no space".
`reproduction.wildlife_cap` (rules field `wildlife_cap`, 0..organism cap, 0 = the organism
cap) refuses buds of a parent without an account at that many lives, keeping the slots above
it for players. Spawning still answers to the organism cap. It takes bits 17-31 of the
word holding the energy cycle (section 14), so rules without it keep their bytes and digests;
the key is optional, adoptable live, and the DEV file sets 200. The region view reports
both caps (`caps`), and the region page's Population shows lives against the cap.
- **Take and cull.** Two admin command kinds: `take_reserve` (8) moves up to the given amounts
from one life's reserve to the spent pool, per channel never more than it holds (the inverse
of `grant_reserve`); `remove_wildlife` (9) removes every life without an account in one
command, each as `remove_cell` does (body and reserve to the spent pool, a removed corpse).
Schema 67 widens the kind check and `admin_enqueue_command_v1`. The portal adds Take reserve
to the cell inspector, Remove all wildlife to Actions, and marking on the map (shift+click,
shift+drag a box) to remove the marked cells, one `remove_cell` each.
The organism cap itself is section 17.
### 17. Larger region ticks for testing (delivered 2026-10-28, schema 68)
The region/movement plan set a 2,000-organism region cap, but the rules-12 key it became
(`region.organism_cap`) was parsed and never enforced. The real bound was the engine's
`max_cellular_tick_lives = 256`, a per-tick safety bound from ADR-0106 that the batch trace,
checkpoints and database trace checks were sized from; rules 13's `reproduction.organism_cap`
was capped at it.
- **Decision (2026-10-28).** The tick bound is 4,096 lives, for testing limits only; regions
are not meant to run that many. The DEV tuning file keeps 256.
- **Split bound.** `max_cellular_tick_lives` (4,096) bounds the raw region path: the step, the
owner state, the batch trace (`cellular_batch_bytes_for`) and current checkpoint traces.
`max_cellular_frozen_lives` (256) keeps the formats whose database checks are fixed: cohort
populations, population batches, migration traces and pre-v3 cellular traces. Rules 12 and
13 never use those paths.
- **Tuning.** `reproduction.organism_cap` and `reproduction.wildlife_cap` accept up to 4,096.
- **Schema 68.** The trace checker under the current publishers (schema 43's, renamed
`cellular_births_v45` by schema 46) accepts up to 4,096 intents, births and mutation choices
per tick; `spawn_wildlife` takes up to 256 cells a command (sixteen commands fill a tick).
- **Archive.** The lineage archive never forgets: a region stops ticking at 65,536 recorded
births or 4,096 genomes. The region view reports both (`archive`) and the portal's
Population shows the fuller one, warning at 80%. A crowded region reaches them sooner.
- **Not changed.** Performance: region 16 ran at about 5 of 20 ticks per second with about
250 lives, so a region near the bound will run far below real time. The client snapshot is
budgeted (nearest changes first), so it degrades rather than fails.
### 18. Ending a stranded life (delivered 2026-10-29, schema 69)
Region 16 playtest: the region refused every birth for an account with "Existing cell is
already bound to this account", although no cell in it held the account. The database refuses
a birth while the account has an open life reservation anywhere in the world; this one was
published and never ended. How it was left open is not yet known. Until 2026-10-29 the only
remedy was `tools/ops/end-account-life.sql` as the database owner.
- **Account action.** `POST /api/accounts/<uuid>/end-life?request=N[&reason=R]`. The admin API
reads the life's region from the account's lives, fetches that region's live view and refuses
(409 `life_in_region`) while any listed cell holds the account, including a bud, a split's
offspring or an organism that control moved to. It also refuses a region it cannot view, a
view that does not list every cell, a request never published (404) and a life no longer open
(409 `not_open`).
- **Schema 69.** `admin_end_account_life_v1` (admin role only) ends the reservation at the
region's latest commit, as `end_cellular_lives` does, and appends who and why to
`admin_life_endings` (immutable). Unpublished reservations stay with the region, which still
holds them as queued births. Checkpoints and history are unchanged.
- **Safety.** If the check were wrong, the region still refuses a birth for an account that holds
a cell in its state (`life_exists`), which records an existing-life refusal.
- **Existing-life refusals are recorded.** That refusal could never be recorded:
`reject_primitive_life` (schema 15) accepted only reasons 1 to 3, and existing_life is 4.
The region dropped the birth from its queue but left the reservation open and unpublished,
which then refused every later birth for the account. Schema 69 accepts 4, both in the
function and in its C++ wrapper.
- **Portal.** The account page shows an End life button for each published life that has not
ended.
- **Idle regions take commands.** A region ticks only while something needs it: a player, a
waiting birth, a cell not suspended, or ecological work. A command queued in an empty region,
such as a spawn of wildlife, waited until something else woke it. A queued admin command now
keeps the region ticking until it is applied.
## Delivery order
1. Read-only portal: login, accounts (from existing data), regions, region view (schema 61,
section 8).
2. Schema 63 and the new owner format: world revisions, adoption records, admin commands,
game source, drip settings, the score vector, session intervals and bans. One new
opening on that format.
3. Admin commands and account actions in the portal.
4. Live tuning in the portal.
5. Data-defined mutations in the portal.
## Deferred
- **Cell migration between regions.** With world-shared tuning and mutations it no longer
meets per-region mismatches, but still needs the paired transfer extended to the new
format and to player lives, and a client handoff.
- **New matter types.** `accounting::Element` has four channels throughout accounting,
traits, bubbles, the protocol and the client. A later decision; a fixed number of matter
slots is the expected approach.
## Alternatives
- **Export portal changes to Git and reopen regions.** Rejected: more steps for the same
result, and not live.
- **Change values in a running region's memory.** Rejected: replay and recovery would diverge.
- **Per-region tuning.** Rejected: all regions of a world share rules.
- **Database push instead of polling.** Not needed at one adoption check per second.
## Consequences
- Balance changes become data: no image, ConfigMap or region per change.
- Balance history moves from Git review to the revision table (author, reason, full text).
It is covered by database backups and history domains (ADR-0155).
- Argo no longer shows tuning drift for new-format regions; the portal shows each region's
adopted revision instead.
- One more opening is required, for the new owner format.