Files
aevolution/schemas/life-reservations-v1.md
dingoandClaude Opus 5.5 a3939bda4e
Foundation / checks (ecs) (push) Successful in 2m27s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / checks (tsan) (push) Successful in 9m29s
Foundation / checks (client) (push) Successful in 16m59s
Foundation / checks (network) (push) Successful in 19m31s
Foundation / checks (postgres) (push) Failing after 21m13s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 24m4s
Provision a world's life allocator from the owner provisioner
The DEV cellular region reported every first-life request as unknown:
world 100 had no life_allocators row, and life-reservations-v1 leaves
that row to the owner with no runtime initializer. evo-world-clone
provision now accepts --life-allocator-start N with the primitive-v1
and cellular-v1 openings. It creates the allocator once before the
genesis check, leaves it untouched on reruns, and refuses a start above
the existing counter.

ADR-0123 records the DEV cellular region bring-up: region 100/2, schema
v33, the trial opening, the allocator start and the 300 s grant ceiling.
Also refresh the dev session window (3 h).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 11:30:16 -04:00

84 lines
4.9 KiB
Markdown

# Primitive life identity reservations (database schema v15)
ADR-0100, M11.2c-1. A reservation has no biological body or resource debit.
It is not a successful spawn and must never be acknowledged as one.
The owner provisions `life_allocators(world_id, next_identity)` only after
auditing an unused range above every retained identity in the life, organism,
genome and origin-event namespaces for that world. There is no runtime initializer,
reset or automatic provisioning. This subsection does not provision a dev world;
ADR-0123 adds the owner-only `evo-world-clone provision --life-allocator-start N`,
which creates the row once at the audited start N in a world's provision Job.
Every allocation uses one value in each of those distinct namespaces. The counter
is shared across the world's regions, never wraps, and retains gaps from rejected
requests. Future birth/mutation allocators must share this allocation authority;
independent counters cannot issue overlapping identities.
`life_reservations` retains world/account/request ID, allocated identity, owning
region, founder-life rules and rejection. These new-life request IDs form a
separate operation namespace from M10 no-effect probe action IDs. The future
protocol must expose that distinction explicitly; a generic ActionQuery cannot
resolve a life request by assumption.
| Rejection | Meaning |
|---|---|
| 0 | Reserved only; not yet a published organism |
| 1 | Insufficient funding |
| 2 | No placement/capacity |
| 3 | Cancelled |
| 4 | Existing life already reserved or published |
One unrejected reservation per world/account is enforced by a partial unique
index. Rejected rows remain permanently queryable by retry. A conflicting new
request now gets its own durable `existing_life` refusal row and consumes an
identity (gaps are permitted). A different request may follow a final rejection
and gets a new identity. There is no deletion API.
`reserve_primitive_life` requires the exact region lease and current durable
account-control generation. Exact retry returns the original identity, owner and
rejection without another allocation. Under v17, a different request while an
unrejected reservation exists receives its own durable `existing_life` refusal
and allocated identity; earlier schemas raised `EVL16` for this conflict.
Unsupported rules/invalid arguments are `22023`; missing provisioning is `EVL04`;
exhaustion is `EVL05`; stale/expired control or lease is `EVL02`.
`reject_primitive_life` durably records the first refusal, requiring current
control in the reservation's owning region. Repeating it returns the first reason.
This operation will need an additional guard against rejecting a published body
when publication is introduced; v15 alone cannot publish bodies.
The lock order is upgrade lock, region lease, account control, reservation and
allocator. Allocation checks lease and control expiry again after the allocator
lock wait. Runtime has EXECUTE only on the two guarded operations, never the
tables or internal control helper. Migration's effective privilege audit covers
these additions, including no-op migration runs.
A takeover may inspect its old reservation before its session wait expires, but
gets no biological control from it. When durable account control changes region
or region epoch, the control transaction atomically marks any unpublished old
reservation cancelled. A published life binding is never changed. Retrying the
cancelled request returns that immutable result; starting again requires a new
request. Session admission must still honor ADR-0091's takeover wait before
originating gameplay. `query_primitive_life` resolves the world/account/request
record for the authenticated current controller, independent of reservation
region, including final refusals and published commit identity/sequence.
Migration 24 adds `primitive_life_owner`, a lease-fenced read-only lookup used
before account control is claimed during login. It returns the unique region
for an unrejected reservation, including a pending unpublished request, or no
row when the account has no active reservation. Runtime cannot select the
reservation table directly. A lookup failure prevents login; callers must not
interpret it as absence.
Validation: `tools/ci/postgres-check.sh --life-reservations-only` starts a fresh
local socket-only PostgreSQL test cluster. The full postgres-check also executes
these tests, alongside migration, backup, restore and existing process checks.
Pass a built `evo-postgres-tests` as the second argument to include the typed
adapter tests in the focused run.
The Linux adapter in `evo/persistence/life_reservation_store.hpp` returns the
allocated identity, owning region and a typed refusal. It preserves the entire
unsigned 64-bit range and performs no automatic retries. A timeout or malformed
mutation reply is `unknown`: reconnect and retry the same request to reconcile.
Callers must never reinterpret a reservation as final spawn success.