Add cellular mutation replay trace v3
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 2m9s
Foundation / checks (ecs) (push) Successful in 2m2s
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 (client) (push) Canceled after 3m11s
Foundation / checks (postgres) (push) Canceled after 1m3s
Foundation / checks (network) (push) Canceled after 1m9s

This commit is contained in:
dingo
2026-10-11 06:29:17 -04:00
parent a479ce2d95
commit d9bf60138e
14 changed files with 596 additions and 49 deletions
@@ -58,6 +58,21 @@ struct CellularLifeIntent {
biology::CellularStepIntent intent{};
auto operator<=>(const CellularLifeIntent&) const = default;
};
struct CellularMutationSelection {
std::uint64_t life_id{}, event_index{}, offer_tick{}, successor_id{};
std::uint16_t operator_id{};
auto operator<=>(const CellularMutationSelection&) const = default;
};
enum class CellularMutationResult : std::uint8_t { applied, life_died, insufficient_funding };
struct CellularMutationExecution {
std::uint64_t life_id{}, successor_id{};
CellularMutationResult result{};
auto operator<=>(const CellularMutationExecution&) const = default;
};
struct CellularTickExecution {
biology::CellularRegionStepCandidate step;
std::vector<CellularMutationExecution> mutations;
};
struct CellularLifeTickFeedback {
std::uint64_t life_id{}, tick{};
accounting::Inventory reserve;
@@ -156,6 +171,11 @@ class CellularLives {
// this owner byte-for-byte unchanged.
[[nodiscard]] std::expected<biology::CellularRegionStepCandidate, CellularLivesError>
advance_tick(std::span<const CellularLifeIntent> intents);
// Mutation selections are validated against the predecessor offer, then applied
// after the normal life step and before births on the same advancing tick.
[[nodiscard]] std::expected<CellularTickExecution, CellularLivesError>
advance_tick_with_mutations(std::span<const CellularLifeIntent> intents,
std::span<const CellularMutationSelection> selections);
private:
struct State;