M12.4: retain and settle owned population intervals
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (tsan) (push) Failing after 18m22s
Foundation / checks (network) (push) Successful in 20m38s
Foundation / checks (client) (push) Failing after 21m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 46m54s
Foundation / checks (checks) (push) Canceled after 47m3s

This commit is contained in:
dingo
2026-10-17 17:31:05 -04:00
parent 627411983f
commit 0a8962b57e
34 changed files with 1032 additions and 75 deletions
@@ -30,6 +30,9 @@ struct CellularPopulationExecution {
CellularPopulationBatch batch;
std::unique_ptr<CellularPopulation> state;
};
// Lingering controlled cells remain vulnerable. Their permanent death path must
// stay on profile 4; unattended population intervals require full suspension.
[[nodiscard]] bool population_interval_safe(const CellularLives&) noexcept;
// Build an unattended interval from a detached biological copy. Controlled cells
// receive frozen-only intentions; the unchanged wildlife controller supplies the
// rest. The returned recorded intentions replay without rerunning that controller.
@@ -11,9 +11,15 @@ namespace evo::server {
// Historical profiles without offline freeze are not opted into unattended work.
[[nodiscard]] bool cellular_unattended_tick_needed(const CellularLives& state) noexcept;
enum class CellularScheduleError : std::uint8_t { clock_regression, head_regression, authority };
enum class CellularScheduleError : std::uint8_t {
clock_regression,
head_regression,
authority,
admission
};
struct CellularScheduleStatus {
bool due{};
bool retry_ready{true}; // Also permits servicing a recovered durable interval with zero debt.
std::uint64_t debt{}, max_debt{};
std::uint64_t head_age_us{}; // Since the last confirmed head change/recovery.
};
@@ -22,11 +28,13 @@ struct CellularScheduleStatus {
// be attempted per poll. Rejected work does not consume debt. Authority loss,
// restart or absence of tick demand pauses wall-time (ADR-0133); committed
// intervals and uncertain outcomes remain the fenced host's responsibility.
// On a new anchor, previously_admitted_ticks excludes a recovered durable prefix
// from fresh wall-time accounting. It is bounded to 64 and cannot wrap the head.
class CellularTickSchedule {
public:
[[nodiscard]] std::expected<CellularScheduleStatus, CellularScheduleError>
observe(std::uint64_t now_us, std::uint64_t epoch, std::uint64_t committed_tick, bool needed,
bool authoritative);
bool authoritative, std::uint64_t previously_admitted_ticks = 0);
void defer(std::uint64_t now_us) noexcept;
[[nodiscard]] CellularScheduleStatus status() const noexcept;