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
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:
@@ -653,6 +653,58 @@ void cellular_host_admits_mutation_choices() {
|
||||
CHECK(final_repeat.status == CellularMutationAdmission::final && final_repeat.outcome &&
|
||||
*final_repeat.outcome == finalized.front());
|
||||
CHECK(admit_status(final_repeat.status) == evo::network::AdmitStatus::duplicate);
|
||||
|
||||
// ADR-0120 amendment (schema v40): feed until the next offer, then decline it. The
|
||||
// decline reserves and publishes like a choice, with result 3; the offer is consumed
|
||||
// and the genome is unchanged.
|
||||
for (int round = 0; round < 8 && !host->state()->lives().front().mutation.offer; ++round) {
|
||||
CellularBatch feeding;
|
||||
feeding.header = header(*host, 64);
|
||||
CellularStepIntent feed{};
|
||||
feed.intake_target = CellularPatchAddress{0, 0};
|
||||
for (int tick = 0; tick < 64; ++tick)
|
||||
feeding.ticks.push_back({{{life_id, feed}}, {}, {}});
|
||||
CHECK(host->publish(feeding));
|
||||
}
|
||||
// A live session renews its control every 5 s; this long test lets it lapse, so it
|
||||
// claims control again with a newer grant serial, as a reconnecting client would.
|
||||
CHECK(host->step().ready); // Renews the region lease after the feeding publications.
|
||||
const auto reclaimed = claim_account_control(*runtime, key, checked_value(host->authority()),
|
||||
account, 2, 2, 60'000ms, 5s);
|
||||
CHECK(reclaimed);
|
||||
const auto decline_generation = checked_value(reclaimed).generation;
|
||||
const auto& offered = host->state()->lives().front();
|
||||
CHECK(offered.identity.life == life_id && offered.mutation.offer.has_value());
|
||||
const auto genome_before = offered.identity.genome;
|
||||
const CellularMutationActionInput decline{life_id, offered.mutation.event_index,
|
||||
offered.mutation.offer_tick, 0};
|
||||
const auto decline_tick = host->state()->tick() + 1;
|
||||
const auto declined = host->select_mutation(account, decline_generation, 33, decline);
|
||||
CHECK(declined.status == CellularMutationAdmission::admitted && declined.tick == decline_tick &&
|
||||
host->queued_mutations().size() == 1);
|
||||
const auto decline_reservation = host->queued_mutations().front();
|
||||
CellularBatch decline_batch;
|
||||
decline_batch.header = header(*host, 1);
|
||||
decline_batch.ticks.push_back({{{life_id, {}}},
|
||||
{},
|
||||
{{life_id, decline.event_index, decline.offer_tick,
|
||||
decline_reservation.successor_identity, 0}}});
|
||||
const std::array decline_records{
|
||||
CellularMutationActionRecord{account, 33, decline_tick, decline}};
|
||||
const auto decline_published = host->publish(decline_batch, {}, decline_records);
|
||||
CHECK(decline_published && decline_published->mutation_results.size() == 1 &&
|
||||
decline_published->mutation_results.front() == CellularMutationResult::declined);
|
||||
const auto& after_decline = host->state()->lives().front();
|
||||
CHECK(!after_decline.mutation.offer && after_decline.identity.genome == genome_before);
|
||||
const auto decline_final = host->take_finalized_mutations();
|
||||
CHECK(decline_final.size() == 1 &&
|
||||
decline_final.front().result == CellularMutationResult::declined &&
|
||||
action_outcome(decline_final.front()).result == evo::network::ActionResult::committed);
|
||||
CHECK(owner
|
||||
->query("SELECT 1 FROM evolution.cellular_mutation_action_publications "
|
||||
"WHERE action_id = 33 AND result = 3",
|
||||
{}, 5s)
|
||||
->size() == 1);
|
||||
host->drain();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user