ADR 0127
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-15 09:32:51 -04:00
parent 0a0f6c3bb1
commit 817a830a8a
20 changed files with 474 additions and 28 deletions
@@ -110,6 +110,10 @@ class CellularRegionHost {
[[nodiscard]] network::PrimitiveLifeOutcome
query_primitive_life(const persistence::Uuid& account, std::uint64_t generation,
std::uint64_t request);
// Call only after the scheduler's batch is confirmed published. Persists expected
// birth refusals without blocking the region; uncertain replies stay out of the birth
// queue and reconcile on the account's next exact request/query (including takeover).
void refuse_births(std::span<const CellularBirthRefusal> refusals);
[[nodiscard]] std::span<const CellularTickIntents::Birth> queued_births() const noexcept {
return queued_births_;
}
@@ -159,6 +163,7 @@ class CellularRegionHost {
std::unique_ptr<Pending> pending_;
std::vector<FinalCellularAction> finalized_actions_;
std::vector<CellularTickIntents::Birth> queued_births_;
std::vector<CellularBirthRefusal> pending_birth_refusals_;
std::vector<persistence::CellularMutationReservation> queued_mutations_;
// A reservation may exist that the queue does not show; reload before publishing.
bool mutations_uncertain_{};
@@ -58,6 +58,17 @@ class CellularSessionBatchBuilder {
std::span<const network::CarriedAction> actions,
std::span<const CellularTickIntents::Birth> births = {},
std::span<const persistence::CellularMutationReservation> mutations = {});
// Scheduler path: expected placement/funding/existing-life refusals are reported
// separately, so they cannot prevent other births or the ordinary tick. Unexpected
// failures retain append's all-or-nothing behavior. Persist reports only after publish.
[[nodiscard]] std::expected<void, CellularSessionBatchError> append_with_birth_refusals(
std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
std::span<const network::CarriedAction> actions,
std::span<const CellularTickIntents::Birth> births = {},
std::span<const persistence::CellularMutationReservation> mutations = {});
[[nodiscard]] std::span<const CellularBirthRefusal> refused_births() const noexcept {
return refused_births_;
}
[[nodiscard]] const CellularBatch& batch() const noexcept {
return batch_;
}
@@ -72,11 +83,18 @@ class CellularSessionBatchBuilder {
}
private:
[[nodiscard]] std::expected<void, CellularSessionBatchError>
append_impl(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
std::span<const network::CarriedAction> actions,
std::span<const CellularTickIntents::Birth> births,
std::span<const persistence::CellularMutationReservation> mutations,
bool allow_refusals);
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
: working_{std::move(working)} {}
std::unique_ptr<CellularLives> working_;
CellularBatch batch_;
std::vector<CellularActionRecord> actions_;
std::vector<CellularMutationActionRecord> mutation_actions_;
std::vector<CellularBirthRefusal> refused_births_;
};
} // namespace evo::server
@@ -38,6 +38,12 @@ struct CellularTickIntents {
std::vector<CellularMutationSelection> mutations;
friend bool operator==(const CellularTickIntents&, const CellularTickIntents&) = default;
};
// Transient scheduler report, not part of the replay trace. A refused birth changes
// no biology; its final request result is recorded in the existing reservation store.
struct CellularBirthRefusal {
CellularTickIntents::Birth birth;
CellularLivesError reason{};
};
struct CellularBatch {
CellularBatchHeader header{};
std::vector<CellularTickIntents> ticks;