feat(client): recent actions show what each engulf or bud did
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (ecs) (push) Canceled after 45s
Foundation / checks (checks) (push) Canceled after 49s
Foundation / checks (client) (push) Canceled after 49s
Foundation / checks (postgres) (push) Canceled after 48s
Foundation / checks (deploy) (push) Canceled after 54s
Foundation / checks (network) (push) Canceled after 53s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (ecs) (push) Canceled after 45s
Foundation / checks (checks) (push) Canceled after 49s
Foundation / checks (client) (push) Canceled after 49s
Foundation / checks (postgres) (push) Canceled after 48s
Foundation / checks (deploy) (push) Canceled after 54s
Foundation / checks (network) (push) Canceled after 53s
A history entry only said "Committed", so a refused engulf (membrane too thick) looked like a success. The engulf or bud result reported in the action's tick view is now attached to that entry: Recent actions shows the action, its tick and the region's result, green only when it took effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,9 @@ struct CellActionRecord {
|
||||
std::uint64_t id{}, life{}, tick{};
|
||||
MutationChoice choice{};
|
||||
network::AdmitStatus refusal{network::AdmitStatus::admitted};
|
||||
// The region's reported effect of this engulf or bud, once a view carries it.
|
||||
std::optional<network::CellularEngulfResult> engulf;
|
||||
std::optional<network::CellularBudOutcome> bud;
|
||||
};
|
||||
struct CellEnergyChange {
|
||||
std::uint64_t from_tick{}, to_tick{}, amount{};
|
||||
@@ -107,11 +110,17 @@ class CellularPlay {
|
||||
if (view.diagnostics && view.diagnostics->has_tick_effects) {
|
||||
const auto& d = *view.diagnostics;
|
||||
if (d.engulf != network::CellularEngulfResult::not_reported &&
|
||||
d.engulf != network::CellularEngulfResult::not_requested)
|
||||
d.engulf != network::CellularEngulfResult::not_requested) {
|
||||
engulf_feedback_ = std::pair{view.tick, d.engulf};
|
||||
if (auto* record = awaiting_effect(CellAction::engulf, view.tick))
|
||||
record->engulf = d.engulf;
|
||||
}
|
||||
if (d.bud != network::CellularBudOutcome::not_reported &&
|
||||
d.bud != network::CellularBudOutcome::not_requested)
|
||||
d.bud != network::CellularBudOutcome::not_requested) {
|
||||
bud_feedback_ = std::pair{view.tick, d.bud};
|
||||
if (auto* record = awaiting_effect(CellAction::bud, view.tick))
|
||||
record->bud = d.bud;
|
||||
}
|
||||
}
|
||||
if (life_ != 0) {
|
||||
birth_pending_ = false;
|
||||
@@ -154,7 +163,9 @@ class CellularPlay {
|
||||
const auto id = allocate_id();
|
||||
if (id == 0)
|
||||
return false;
|
||||
pending_ = CellActionRecord{kind, CellActionState::queued, id, life_, tick, choice};
|
||||
pending_ = CellActionRecord{
|
||||
kind, CellActionState::queued, id, life_, tick,
|
||||
choice, network::AdmitStatus::admitted, std::nullopt, std::nullopt};
|
||||
return true;
|
||||
}
|
||||
void sent() {
|
||||
@@ -298,6 +309,20 @@ class CellularPlay {
|
||||
history_.push_back(*pending_);
|
||||
pending_.reset();
|
||||
}
|
||||
// The newest engulf/bud of this life, at or before `tick`, still without a reported
|
||||
// effect: the view for its tick carries what the region did with it.
|
||||
CellActionRecord* awaiting_effect(CellAction kind, std::uint64_t tick) {
|
||||
const auto waiting = [&](const CellActionRecord& r) {
|
||||
return r.kind == kind && r.life == life_ && r.tick <= tick &&
|
||||
!(kind == CellAction::engulf ? r.engulf.has_value() : r.bud.has_value());
|
||||
};
|
||||
if (pending_ && waiting(*pending_))
|
||||
return &*pending_;
|
||||
for (auto it = history_.rbegin(); it != history_.rend(); ++it)
|
||||
if (waiting(*it))
|
||||
return &*it;
|
||||
return nullptr;
|
||||
}
|
||||
std::uint64_t next_id_{1}, life_{}, view_tick_{}, birth_tick_{}, birth_request_{}, seen_end_{};
|
||||
bool connected_{}, fresh_{}, birth_pending_{};
|
||||
network::PrimitiveLifeResult birth_result_{network::PrimitiveLifeResult::pending};
|
||||
|
||||
Reference in New Issue
Block a user