M12.4: record and replay exact biological transfer pairs
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 2m30s
Foundation / checks (client) (push) Failing after 18m38s
Foundation / checks (network) (push) Successful in 22m21s
Foundation / checks (tsan) (push) Failing after 22m17s
Foundation / checks (postgres) (push) Successful in 51m32s
Foundation / checks (checks) (push) Failing after 59m20s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-17 18:23:33 -04:00
parent decd4f8043
commit 1e207b5ee4
13 changed files with 637 additions and 2 deletions
@@ -12,7 +12,9 @@ enum class CellularMigrationError : std::uint8_t {
placement,
archive,
overflow,
conservation
conservation,
format,
checksum
};
struct CellularMigrationExecution {
std::uint64_t genome{};
@@ -0,0 +1,59 @@
#pragma once
#include "evo/server/lifecycle/cellular_migration.hpp"
#include <array>
namespace evo::server {
struct CellularMigrationEndpoint {
std::uint64_t region{};
std::array<std::uint8_t, 16> predecessor{}, commit{};
std::array<std::uint8_t, 32> predecessor_digest{};
bool operator==(const CellularMigrationEndpoint&) const = default;
};
struct CellularMigrationRequest {
std::array<std::uint8_t, 16> request{};
CellularMigrationEndpoint source, destination;
std::uint64_t genome{};
bool operator==(const CellularMigrationRequest&) const = default;
};
enum class CellularMigrationRepresentation : std::uint8_t { individual = 1, population = 2 };
struct CellularMigrationTrace {
CellularMigrationRepresentation representation{CellularMigrationRepresentation::individual};
std::uint64_t world{}, frame{}, tick{};
CellularMigrationRequest request;
accounting::Inventory transferred;
std::vector<std::uint64_t> members;
bool operator==(const CellularMigrationTrace&) const = default;
};
inline constexpr std::size_t migration_trace_header_bytes = 256;
inline constexpr std::size_t max_migration_trace_bytes =
migration_trace_header_bytes + 8 * biology::max_cellular_tick_lives + 8;
struct RecordedCellularMigration {
CellularMigrationTrace trace;
CellularMigrationExecution execution;
};
struct RecordedPopulationMigration {
CellularMigrationTrace trace;
CellularPopulationMigrationExecution execution;
};
// Portable recorded pair, not a receipt or ownership grant. The I/O adapter must
// establish the trusted request against BOTH immutable predecessor manifests and
// digest-checked payloads, then fence/commit both results before activation.
[[nodiscard]] std::expected<RecordedCellularMigration, CellularMigrationError>
prepare_migration_trace(const CellularLives&, const CellularLives&,
const CellularMigrationRequest&);
[[nodiscard]] std::expected<RecordedPopulationMigration, CellularMigrationError>
prepare_migration_trace(const CellularPopulation&, const CellularPopulation&,
const CellularMigrationRequest&);
[[nodiscard]] std::expected<CellularMigrationExecution, CellularMigrationError>
replay_migration_trace(const CellularLives&, const CellularLives&,
const CellularMigrationRequest& trusted, const CellularMigrationTrace&);
[[nodiscard]] std::expected<CellularPopulationMigrationExecution, CellularMigrationError>
replay_migration_trace(const CellularPopulation&, const CellularPopulation&,
const CellularMigrationRequest& trusted, const CellularMigrationTrace&);
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CellularMigrationError>
encode_migration_trace(const CellularMigrationTrace&);
[[nodiscard]] std::expected<CellularMigrationTrace, CellularMigrationError>
decode_migration_trace(std::span<const std::uint8_t>);
} // namespace evo::server