Admit v10 mutation choices through the cellular host and sessions

The region host checks a choice against the committed offer, reserves the
successor for the next tick, and publishes it with that tick's batch; the
owner's v10 session gets the receipt and final outcome. Schema v35 now
refuses a checkpoint that skips a reserved choice, and the host reloads
pending reservations after uncertainty, refusal or recovery (ADR-0121).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 19:45:23 -04:00
co-authored by Claude Opus 5.5
parent 1bbac48543
commit f59c8498b1
14 changed files with 583 additions and 12 deletions
@@ -93,3 +93,34 @@ crash/retry tests. The biology generator and funded-transition APIs remain pure.
Candidate ranking, automatic mutation, new-life creation, and presentation
belong to no part of this contract. The operation is not player-accessible until
the later 11.4d client action and review UI are complete.
## Implementation notes
- 11.4c-1 (schema v35): a checkpoint whose trace carries selections publishes
only through `publish_cellular_mutation_checkpoint`, with the canonical
64-byte mutation block and one result byte per choice, taken from the
publisher's own replay. Recovery reloads the bound choices and requires the
replay's results to equal them.
- 11.4c-2 (host and session admission, 2026-10-13): the region host admits a
v10 `CellularMutationAction` only when it names the account's living cell,
its exact outstanding offer (event index and offer tick) and one of the
offered operators, checked against the committed state. It reserves the
successor for the next tick (head + 1), queues the reservation, and the
scheduler includes it in that tick's batch. Exact repeats are idempotent;
a second choice while one waits is refused as `too_many_unresolved`, and a
changed reuse of an action ID as `invalid_action`. The receipt names the
publishing tick; once published, the owner receives an `ActionOutcome`:
`committed` when applied, `committed_no_effect` for a durable refusal (life
died, insufficient funding). A repeat after publication returns the same
outcome (`duplicate`) while the host remembers it.
- A reserved choice must never be skipped: schema v35 also refuses any
checkpoint whose tick range contains an unbound reservation of the region
that the checkpoint does not carry. Without this, an uncertain reservation
(the reply was lost but the row committed) could pass its tick unpublished
and block its account's next choice forever. The host treats an uncertain
reservation, a refused publication or a recovery as "reload pending
reservations under the current lease before the next publication".
- The wire `tick` of the choice is the client's latest simulated tick (after
the offer); the server, not the client, chooses the publishing tick.
- Not yet done: replicating the offer's unranked candidates to the owner
(11.4d server half) and the client choice and review UI (maintainer).
+8 -1
View File
@@ -83,4 +83,11 @@ pending; no gameplay balance is treated as final by this plan.
the four-argument publisher now refuses traces with selections. C++
publication takes its results from its own replay, and recovery reloads the
bound choices and requires the replay's results to equal them. Host and
session admission (11.4c-2) remain.
session admission (11.4c-2) remain.
- 11.4c-2 (ADR-0121 implementation notes): the region host admits a v10 choice
of the exact outstanding offer, reserves it for the next tick and publishes
it with that tick; the owner receives the receipt and final outcome over the
session. SQL now refuses a checkpoint that skips a reserved choice, and the
host reloads pending reservations after uncertainty or restart. 11.4c is
complete once CI passes; 11.4d's server half (offer replication to the
owner) is next, and the choice UI stays with the maintainer.
+25 -1
View File
@@ -7293,4 +7293,28 @@ offer, reserves and publishes a choice, recovers it, and restarts a host.
Executed locally: MSVC Debug `ctest` 68/68; g++-14 `-Werror`, clang-tidy-19
and clang-format 19.1.5 on the persistence, batch, host and test sources. The
migration and PostgreSQL tests run only in CI.
migration and PostgreSQL tests run only in CI.
## 2026-10-13 — M11.4c-2 mutation choice admission (CI pending)
`CellularRegionHost::select_mutation` checks a v10 choice against the
committed offer, reserves it for head + 1 through `reserve_cellular_mutation`,
and queues it; `serve_cellular` passes the queue to the session batch builder
and publishes `mutation_actions()` with the batch; finalized choices go to the
owner's v10 session as `ActionOutcome`. Uncertain reservations, refused
publications and recovery reload pending reservations before the next publish.
`RegionSessions` dispatches `CellularMutationAction` to the new
`select_cellular_mutation` handler and adds `send_mutation_outcome`; the client
adds `send_cellular_mutation` (protocol only, no UI). Migration 35 gains
`cellular_mutations_due` and a `(world, region, target_tick)` index: both
publishers refuse a checkpoint that omits a reserved choice in its range.
Tests: `cellular_host_admits_mutation_choices` (PostgreSQL, world 9765) covers
invalid and stale choices, admission, an idempotent repeat, `busy`, reload
after a host restart, refusal of a checkpoint that skips the choice,
publication with its tick, the finalized outcome and its wire form, and the
final repeat. `quic-sessions` sends a v10 choice and receives the receipt and
outcome; a v7 session cannot send one.
Executed locally: MSVC Debug `ctest` 68/68; client-network QUIC/session 8/8;
g++-14 `-Werror`, clang-tidy-19 and clang-format 19.1.5 on the host, session,
server main and test sources. The PostgreSQL tests run only in CI.