M12.2: select and qualify exact cellular local cohorts
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 6m24s
Foundation / checks (network) (push) Canceled after 6m33s
Foundation / checks (postgres) (push) Canceled after 6m34s
Foundation / checks (checks) (push) Canceled after 6m44s
Foundation / checks (client) (push) Canceled after 6m44s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 6m24s
Foundation / checks (network) (push) Canceled after 6m33s
Foundation / checks (postgres) (push) Canceled after 6m34s
Foundation / checks (checks) (push) Canceled after 6m44s
Foundation / checks (client) (push) Canceled after 6m44s
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "evo/server/lifecycle/cellular_lives.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
|
||||
namespace evo::server {
|
||||
// ADR-0139: exact local cohorts retain individuals, never mean reserves or samples.
|
||||
// The single owned CellularLives store backs BOTH representations, exactly once.
|
||||
struct CellularCohortMember {
|
||||
std::uint64_t life{}, genome{};
|
||||
auto operator<=>(const CellularCohortMember&) const = default;
|
||||
};
|
||||
enum class CellularPopulationError : std::uint8_t { unsupported, absent, ineligible };
|
||||
|
||||
class CellularPopulation {
|
||||
public:
|
||||
[[nodiscard]] static std::expected<std::unique_ptr<CellularPopulation>, CellularPopulationError>
|
||||
create(std::unique_ptr<CellularLives> state);
|
||||
CellularPopulation(const CellularPopulation&) = delete;
|
||||
CellularPopulation& operator=(const CellularPopulation&) = delete;
|
||||
|
||||
// Read-only biology view: it confers no separate spending rights.
|
||||
[[nodiscard]] const CellularLives& state() const noexcept;
|
||||
[[nodiscard]] std::span<const CellularCohortMember> members() const noexcept;
|
||||
[[nodiscard]] bool in_cohort(std::uint64_t life) const noexcept;
|
||||
|
||||
// Convert the WHOLE eligible wildlife genome group. No selectable healthy subset,
|
||||
// resampling, rounding, new identity, healing, age reset or inventory transfer.
|
||||
// Controlled lives are never members. Refusal leaves biology and ownership unchanged.
|
||||
[[nodiscard]] std::expected<std::size_t, CellularPopulationError>
|
||||
collapse(std::uint64_t genome);
|
||||
[[nodiscard]] std::expected<std::size_t, CellularPopulationError>
|
||||
materialize(std::uint64_t genome);
|
||||
|
||||
// Only controlled-life intentions/selections are supplied by the host, sorted by ID.
|
||||
// All wildlife, including cohorts, uses the unchanged shared controller and kernel.
|
||||
[[nodiscard]] std::expected<CellularTickExecution, CellularLivesError>
|
||||
advance_tick(std::span<const CellularLifeIntent> controlled,
|
||||
std::span<const CellularMutationSelection> selections = {});
|
||||
|
||||
private:
|
||||
explicit CellularPopulation(std::unique_ptr<CellularLives> state);
|
||||
std::unique_ptr<CellularLives> state_;
|
||||
std::vector<CellularCohortMember> members_; // Sorted life IDs, unique ownership tags.
|
||||
};
|
||||
} // namespace evo::server
|
||||
Reference in New Issue
Block a user