feat(lifecycle): retain inherited offspring plans separately from bodies
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (deploy) (push) Successful in 4m6s
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 9m29s
Foundation / checks (tsan) (push) Canceled after 7m4s
Foundation / checks (network) (push) Canceled after 9m28s
Foundation / checks (postgres) (push) Canceled after 9m28s
Foundation / checks (checks) (push) Canceled after 9m34s
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (deploy) (push) Successful in 4m6s
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 9m29s
Foundation / checks (tsan) (push) Canceled after 7m4s
Foundation / checks (network) (push) Canceled after 9m28s
Foundation / checks (postgres) (push) Canceled after 9m28s
Foundation / checks (checks) (push) Canceled after 9m34s
This commit is contained in:
@@ -98,6 +98,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes);
|
||||
// Replays from an immutable predecessor snapshot. The caller must first bind the
|
||||
// header identity, predecessor commit/digest and tick range to trusted manifests.
|
||||
// Every tick must cover its living set; the caller compares the returned snapshot.
|
||||
// Owner format 8/rules 10 requires separately qualified trace admission and is refused.
|
||||
[[nodiscard]] std::expected<std::unique_ptr<CellularLives>, CellularBatchError>
|
||||
replay_cellular_batch(const CellularLives& base, const CellularBatch& batch);
|
||||
// The same replay, also reporting every mutation selection's final result in trace order
|
||||
|
||||
@@ -47,6 +47,9 @@ inline constexpr std::uint32_t cellular_lives_foraging_rules = 8;
|
||||
inline constexpr std::uint32_t cellular_lives_migration_format = 7;
|
||||
// ADR-0157: opt-in funded maturation, using the unchanged format-7 fields.
|
||||
inline constexpr std::uint32_t cellular_lives_maturation_rules = 9;
|
||||
// ADR-0165: explicit offspring-plan editing mode; expressed bodies retain their genomes.
|
||||
inline constexpr std::uint32_t cellular_lives_inheritance_format = 8;
|
||||
inline constexpr std::uint32_t cellular_lives_inheritance_rules = 10;
|
||||
inline constexpr std::uint32_t cellular_growth_per_tick = 5; // Per 50 ms; trial rate.
|
||||
// The founder a region of these rules creates.
|
||||
[[nodiscard]] constexpr biology::FounderVersion
|
||||
@@ -94,7 +97,7 @@ struct CellularMutationProgress {
|
||||
|
||||
struct CellularOwnedLife {
|
||||
LifeAccount account{};
|
||||
LifeAllocation identity{};
|
||||
LifeAllocation identity{}; // genome always identifies the expressed body.
|
||||
std::uint64_t source{};
|
||||
biology::GrowthState growth{};
|
||||
biology::CellularPosition position{};
|
||||
@@ -105,6 +108,7 @@ struct CellularOwnedLife {
|
||||
// Format 6 (ADR-0128): presence and the tick its freeze began (zero while active).
|
||||
CellularPresence presence{CellularPresence::active};
|
||||
std::uint64_t frozen_since{};
|
||||
std::uint64_t offspring_genome{}; // Format 8; older formats retain zero.
|
||||
auto operator<=>(const CellularOwnedLife&) const = default;
|
||||
};
|
||||
struct CellularOwnedCorpse {
|
||||
@@ -117,8 +121,9 @@ struct CellularOwnedCorpse {
|
||||
std::uint32_t extent_um{};
|
||||
accounting::Inventory inventory{}; // Empty under rules 3: it became detritus.
|
||||
biology::CellularDeathCause cause{biology::CellularDeathCause::unrecorded};
|
||||
std::uint64_t predator_life{}; // Engulfed only.
|
||||
std::uint64_t parent_life{}; // Format 5: kept after death.
|
||||
std::uint64_t predator_life{}; // Engulfed only.
|
||||
std::uint64_t parent_life{}; // Format 5: kept after death.
|
||||
std::uint64_t offspring_genome{}; // Format 8: retained plan, not living stock.
|
||||
auto operator<=>(const CellularOwnedCorpse&) const = default;
|
||||
};
|
||||
struct CellularBoundaryLedger {
|
||||
@@ -126,6 +131,13 @@ struct CellularBoundaryLedger {
|
||||
std::vector<std::uint64_t> nonresident_organisms; // Retained history, never activity.
|
||||
bool operator==(const CellularBoundaryLedger&) const = default;
|
||||
};
|
||||
struct CellularOffspringRevision {
|
||||
std::uint64_t life{}, previous{}, successor{}, tick{};
|
||||
auto operator<=>(const CellularOffspringRevision&) const = default;
|
||||
};
|
||||
[[nodiscard]] constexpr std::uint64_t cellular_offspring_genome(const CellularOwnedLife& life) {
|
||||
return life.offspring_genome == 0 ? life.identity.genome : life.offspring_genome;
|
||||
}
|
||||
class CellularMigration;
|
||||
struct CellularLifeIntent {
|
||||
std::uint64_t life_id{};
|
||||
@@ -142,7 +154,8 @@ enum class CellularMutationResult : std::uint8_t {
|
||||
applied,
|
||||
life_died,
|
||||
insufficient_funding,
|
||||
declined
|
||||
declined,
|
||||
offspring_plan_applied // Rules 10: inherited plan changed, expressed body did not.
|
||||
};
|
||||
struct CellularMutationExecution {
|
||||
std::uint64_t life_id{}, successor_id{};
|
||||
@@ -266,6 +279,10 @@ class CellularLives {
|
||||
// ADR-0157: detached no-tick rules-8/format-7 -> rules-9 candidate. No grant.
|
||||
[[nodiscard]] std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
||||
maturation_upgrade_candidate() const;
|
||||
// ADR-0165: explicit no-tick format-7/rules-9 -> format-8/rules-10 upgrade.
|
||||
[[nodiscard]] std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
|
||||
inheritance_upgrade_candidate() const;
|
||||
[[nodiscard]] std::span<const CellularOffspringRevision> offspring_revisions() const noexcept;
|
||||
// Latest successful in-memory step report; omitted from snapshots and empty after restore.
|
||||
[[nodiscard]] std::span<const CellularLifeTickFeedback> last_tick_feedback() const noexcept;
|
||||
[[nodiscard]] std::vector<std::uint8_t> snapshot() const;
|
||||
@@ -301,6 +318,7 @@ class CellularLives {
|
||||
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.
|
||||
// Rules 10 edit only the retained offspring plan; parent tissue is unchanged.
|
||||
[[nodiscard]] std::expected<CellularTickExecution, CellularLivesError>
|
||||
advance_tick_with_mutations(std::span<const CellularLifeIntent> intents,
|
||||
std::span<const CellularMutationSelection> selections);
|
||||
|
||||
Reference in New Issue
Block a user