Publish mutation choices atomically with their checkpoint

ADR-0121, schema v35. A checkpoint whose trace carries mutation
selections publishes with its canonical mutation block and one result
byte per choice. SQL checks the block's order, matches each record to
one reserved choice of this region and to its trace selection (tick,
life, offer, operator, successor identity), binds it to the commit with
its result, refuses a choice already bound elsewhere and checks exact
retries. The four-argument publisher becomes an internal helper behind
a wrapper that refuses traces with selections.

C++ publication takes the results from its own replay rather than a
caller, prepared commits carry block and results through retry and
resolution, and recovery rebuilds the bound choices and requires the
replay's results to match. A PostgreSQL test feeds a v4 cell to its
first offer, publishes a reserved choice, recovers it and restarts a
host. Host and session admission follow in 11.4c-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-13 19:23:39 -04:00
co-authored by Claude Opus 5.5
parent bf5c626f19
commit 1bbac48543
14 changed files with 897 additions and 28 deletions
+9 -1
View File
@@ -105,6 +105,9 @@ struct CellularPreparedCommit {
RegionKey key{};
Uuid commit{};
std::vector<std::uint8_t> manifest, trace, actions;
// ADR-0121: the canonical mutation block and one result byte per record; both empty
// when the trace carries no selections.
std::vector<std::uint8_t> mutations, results;
};
struct CellularPublicationFailure {
PublicationError kind{};
@@ -125,12 +128,16 @@ struct CellularProfileMigrationFailure {
};
struct PublishedCellularBatch {
CommittedCheckpoint committed;
// Each published mutation action's final result, in action-block order.
std::vector<server::CellularMutationResult> mutation_results;
};
struct RecoveredCellularCheckpoint {
CommittedCheckpoint committed;
CheckpointManifest manifest;
std::unique_ptr<server::CellularLives> state;
std::vector<server::CellularActionRecord> actions;
std::vector<server::CellularMutationActionRecord> mutation_actions;
std::vector<server::CellularMutationResult> mutation_results;
};
// Owner/operator connection only: uploads a tick-0 state and records genesis.
@@ -220,7 +227,8 @@ publish_cellular_batch(Postgres& db, const FilesystemObjectStore& objects, const
const server::CellularLives& candidate, Uuid commit,
const Sha256Digest& build, std::chrono::milliseconds timeout,
const PublishHooks& hooks = {},
std::span<const server::CellularActionRecord> actions = {});
std::span<const server::CellularActionRecord> actions = {},
std::span<const server::CellularMutationActionRecord> mutation_actions = {});
[[nodiscard]] std::expected<CommittedCheckpoint, CellularPublicationFailure>
retry_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
std::chrono::milliseconds timeout);