4.7 KiB
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.
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.