Retain cellular death provenance and growth
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
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 (checks) (push) Canceled after 41s
Foundation / checks (client) (push) Canceled after 42s
Foundation / checks (ecs) (push) Canceled after 38s

This commit is contained in:
dingo
2026-10-10 22:25:06 -04:00
parent 562781ce77
commit 04cdc1e9c7
4 changed files with 42 additions and 6 deletions
@@ -4,6 +4,7 @@
#include "evo/server/lifecycle/primitive_lives.hpp"
#include <compare>
#include <cstddef>
#include <cstdint>
#include <expected>
#include <memory>
@@ -11,6 +12,9 @@
#include <vector>
namespace evo::server {
inline constexpr std::uint32_t cellular_lives_format = 1;
inline constexpr std::size_t max_cellular_lives_bytes = std::size_t{8} * 1024 * 1024;
struct CellularOwnedLife {
LifeAccount account{};
LifeAllocation identity{};
@@ -22,9 +26,13 @@ struct CellularOwnedLife {
auto operator<=>(const CellularOwnedLife&) const = default;
};
struct CellularOwnedCorpse {
std::uint64_t life_id{};
std::uint64_t organism{};
std::uint64_t source{};
std::uint64_t died_tick{};
biology::CellularPosition position{};
biology::GrowthState growth{};
std::uint32_t extent_um{};
accounting::Inventory inventory{};
auto operator<=>(const CellularOwnedCorpse&) const = default;
};
@@ -50,7 +58,11 @@ enum class CellularLivesError : std::uint8_t {
archive,
habitat,
overflow,
conservation
conservation,
format,
version,
checksum,
noncanonical
};
// In-memory authoritative cellular owner. It consumes funded profile-3 opening
@@ -79,6 +91,11 @@ class CellularLives {
[[nodiscard]] accounting::Inventory heat() const noexcept;
[[nodiscard]] accounting::Inventory opening_total() const noexcept;
[[nodiscard]] accounting::Inventory current_total() const noexcept;
[[nodiscard]] std::vector<std::uint8_t> snapshot() const;
[[nodiscard]] static std::expected<std::unique_ptr<CellularLives>, CellularLivesError>
restore(std::span<const std::uint8_t> bytes, std::uint64_t world, std::uint64_t region,
std::uint64_t frame, std::uint64_t tick);
// Advances every living cell exactly one 50 ms tick. Intentions are keyed by
// stable life ID and must cover the living set exactly. Any refusal leaves