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:
@@ -638,6 +638,26 @@ struct RegionSessions::Impl {
|
||||
answer(c, *receipt);
|
||||
return;
|
||||
}
|
||||
if (const auto* m = std::get_if<network::CellularMutationAction>(&*decoded)) {
|
||||
if (c.protocol_version != network::session_protocol_v10 ||
|
||||
!config.select_cellular_mutation)
|
||||
return close(c, SessionCloseReason::protocol, now);
|
||||
CellularMutationAnswer answer{
|
||||
m->session != c.session ? network::AdmitStatus::unknown_session
|
||||
: m->epoch != control.epoch() ? network::AdmitStatus::stale_epoch
|
||||
: m->action_id == 0 ? network::AdmitStatus::invalid_action
|
||||
: !facts.ready || c.generation == 0 ? network::AdmitStatus::not_ready
|
||||
: network::AdmitStatus::admitted,
|
||||
0,
|
||||
{}};
|
||||
if (answer.status == network::AdmitStatus::admitted)
|
||||
answer = config.select_cellular_mutation(c.account_id, c.generation, *m);
|
||||
send(c, network::ActionReceipt{m->action_id, answer.status, facts.simulated_tick,
|
||||
answer.tick});
|
||||
if (answer.outcome)
|
||||
send(c, *answer.outcome);
|
||||
return;
|
||||
}
|
||||
if (const auto* m = std::get_if<network::ActionQuery>(&*decoded)) {
|
||||
if (c.protocol_version == network::session_protocol_v5 ||
|
||||
c.protocol_version == network::session_protocol_v6)
|
||||
@@ -915,6 +935,19 @@ bool RegionSessions::send_cellular_perception(const network::AccountId& account,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RegionSessions::send_mutation_outcome(const network::AccountId& account,
|
||||
const network::ActionOutcome& outcome) {
|
||||
auto& m = *impl_;
|
||||
for (const auto& c : m.connections) {
|
||||
if (c.state != Impl::State::established ||
|
||||
c.protocol_version != network::session_protocol_v10 || c.account_id != account)
|
||||
continue;
|
||||
return m.endpoint->send_message(c.id, network::encode_session(outcome, c.protocol_version))
|
||||
.has_value();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RegionSessions::clear_cellular_perceptions(std::uint64_t tick) {
|
||||
if (tick == 0)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user