M11.2b: restore funded life state with canonical closure checks
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 9m57s
Foundation / checks (network) (push) Successful in 13m32s
Foundation / checks (tsan) (push) Successful in 7m56s
Foundation / checks (checks) (push) Successful in 33m49s
Foundation / checks (postgres) (push) Successful in 46m39s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-09 18:30:58 -04:00
parent 69101a74c2
commit 48684d30d9
7 changed files with 336 additions and 1 deletions
@@ -23,6 +23,10 @@ struct SpawnSite {
};
inline constexpr std::size_t max_primitive_lives = 256;
inline constexpr std::int32_t spawn_coordinate_limit_um = 1'000'000'000;
inline constexpr std::uint32_t primitive_lives_format = 1;
inline constexpr std::size_t max_primitive_lives_bytes =
200 + 184 * max_primitive_lives + biology::max_archive_bytes;
enum class LifeCodecError : std::uint8_t { format, version, checksum, closure };
struct NurseryConfig {
std::uint64_t world{}, region{}, frame{}, source{};
accounting::Inventory funding{}; // Explicit finite opening, never replenished here.
@@ -81,6 +85,14 @@ class PrimitiveLives {
[[nodiscard]] accounting::Inventory totals() const noexcept;
[[nodiscard]] const biology::LineageArchive& archive() const noexcept;
// Complete creation-state envelope (schemas/primitive-lives-v1.md). It has
// no progressing biology yet. Bytes include balances and archive as well as
// their founding requests; restore reconstructs and checks exact closure.
[[nodiscard]] std::vector<std::uint8_t> snapshot() const;
[[nodiscard]] static std::expected<std::unique_ptr<PrimitiveLives>, LifeCodecError>
restore(std::span<const std::uint8_t> bytes, std::uint64_t world, std::uint64_t region,
std::uint64_t frame);
private:
struct State;
explicit PrimitiveLives(std::unique_ptr<State> state);