Decline a mutation offer (ADR-0120 amendment, schema v40)
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 4m1s
Foundation / checks (tsan) (push) Successful in 9m49s
Foundation / checks (client) (push) Successful in 19m23s
Foundation / checks (network) (push) Successful in 19m31s
Foundation / checks (checks) (push) Successful in 42m41s
Foundation / checks (postgres) (push) Successful in 45m36s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 3m15s
Foundation / image (push) Successful in 3m18s

An offer the cell cannot afford stayed open, and only one offer is issued at a
time, so banked feeding credit never became a new offer. A v10 choice naming
operator 0 now declines the exact outstanding offer. It is reserved and published
like any choice: schema v40 accepts operator 0 in the reserved input and trace
selections and stores result 3, declined. The owner consumes the offer and
changes nothing else, and the client reports it as committed. Old traces never
carry operator 0, so their replay is unchanged. The Evolution panel gets a
"Decline this offer" button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-15 19:43:36 -04:00
co-authored by Claude Opus 5.5
parent d98d71e7c0
commit 1446d36d26
24 changed files with 396 additions and 46 deletions
+37
View File
@@ -355,6 +355,43 @@ void retained_feeding_earns_a_persistent_mutation_offer() {
*decoded_action_block));
const auto replayed_mutation = replay_cellular_batch(**revision_owner, *decoded_mutation);
CHECK(replayed_mutation && (*replayed_mutation)->tick() == mutation_batch.header.end_tick);
// ADR-0120 amendment: operator 0 declines the same offer. The trace, its action block and
// replay accept it; the offer is consumed, the genome and inventories are unchanged,
// and the reserved successor identity stays unused.
{
auto declined = selection;
declined.operator_id = 0;
auto decline_batch = mutation_batch;
decline_batch.ticks[0].mutations[0] = declined;
const auto decline_bytes = encode_cellular_batch(decline_batch);
CHECK(decline_bytes);
const auto decoded_decline = decode_cellular_batch(*decline_bytes);
CHECK(decoded_decline && *decoded_decline == decline_batch);
const std::array decline_actions{
CellularMutationActionRecord{(*revision_owner)->lives()[0].account,
45,
decline_batch.header.end_tick,
{life_id, declined.event_index, declined.offer_tick, 0}}};
const auto decline_block = encode_cellular_mutation_action_block(
decline_actions, decline_batch.header.begin_tick, decline_batch.header.end_tick);
CHECK(decline_block);
const auto decoded_block = decode_cellular_mutation_action_block(
*decline_block, decline_batch.header.begin_tick, decline_batch.header.end_tick);
CHECK(decoded_block && match_cellular_mutation_actions_to_trace(
**revision_owner, *decoded_decline, *decoded_block));
const auto replayed_decline = replay_cellular_batch(**revision_owner, *decoded_decline);
CHECK(replayed_decline);
const auto& after = **replayed_decline;
CHECK(!after.lives().empty() && !after.lives()[0].mutation.offer &&
after.lives()[0].mutation.offer_tick == 0 &&
after.lives()[0].identity.genome == (*revision_owner)->lives()[0].identity.genome &&
after.archive().revisions().empty() && !after.archive().find(declined.successor_id) &&
after.current_total() == after.opening_total());
// An operator that was not offered is still refused.
auto unknown = decline_batch;
unknown.ticks[0].mutations[0].operator_id = 0xFFFF;
CHECK(!replay_cellular_batch(**revision_owner, unknown));
}
const std::array idle_next{CellularLifeIntent{life_id, {}}};
const std::array selections{selection};
const auto direct_mutation =