Files
aevolution/schemas/life-reservations-v1.md
T
dingo c6df1f4e30
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m15s
Foundation / checks (network) (push) Successful in 13m46s
Foundation / checks (tsan) (push) Successful in 8m9s
Foundation / checks (checks) (push) Successful in 33m12s
Foundation / checks (postgres) (push) Successful in 46m13s
Foundation / postgres-tools (push) Successful in 48s
Foundation / image (push) Successful in 2m45s
Foundation / server-image (push) Successful in 4m27s
Add typed primitive life reservation adapter and reconciliation tests
2026-10-09 22:00:49 -04:00

65 lines
3.6 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.
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 |
One unrejected reservation per world/account is enforced by a partial unique
index. Rejected rows remain permanently queryable by retry. A different request
may follow 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. A different pending request is `EVL16`.
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. The owner region stays unchanged. Session
admission must still honor ADR-0091's takeover wait before originating gameplay.
Final spawn success, checkpoint publication and reconciliation are 11.2c-2/d.
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.