Add cellular checkpoint publication adapter
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 39s
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 (client) (push) Canceled after 1m36s
Foundation / checks (network) (push) Canceled after 59s
Foundation / checks (ecs) (push) Canceled after 1m38s

This commit is contained in:
dingo
2026-10-10 23:21:40 -04:00
parent d057e5ba04
commit ad6e53c2e9
8 changed files with 228 additions and 1 deletions
@@ -4,6 +4,7 @@
#include "evo/persistence/region_batch.hpp"
#include "evo/persistence/region_checkpoint.hpp"
#include "evo/persistence/region_lease_store.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include <chrono>
#include <expected>
#include <functional>
@@ -100,6 +101,20 @@ struct RecoveredPrimitiveCheckpoint {
std::unique_ptr<server::PrimitiveLives> state;
std::vector<PrimitiveLifeBinding> bindings;
};
struct CellularPreparedCommit {
RegionKey key{};
Uuid commit{};
std::vector<std::uint8_t> manifest, trace, actions;
};
struct CellularPublicationFailure {
PublicationError kind{};
LeaseStoreFailure store{};
ObjectError object{};
CellularPreparedCommit prepared;
};
struct PublishedCellularBatch {
CommittedCheckpoint committed;
};
// Owner/operator connection only: uploads a tick-0 state and records genesis.
[[nodiscard]] std::expected<CommittedCheckpoint, PublicationFailure> provision_environmental_region(
@@ -174,6 +189,22 @@ recover_primitive_checkpoint(Postgres& db, const FilesystemObjectStore& objects,
std::span<const Sha256Digest> retained_builds,
std::chrono::milliseconds timeout);
// Profile 4 publication replays the bounded cellular trace from the verified
// predecessor and requires exact candidate bytes and action-to-life agreement.
[[nodiscard]] std::expected<PublishedCellularBatch, CellularPublicationFailure>
publish_cellular_batch(Postgres& db, const FilesystemObjectStore& objects,
const LeaseGrant& lease, const CommittedCheckpoint& predecessor,
const server::CellularBatch& batch, const server::CellularLives& candidate,
Uuid commit, const Sha256Digest& build,
std::chrono::milliseconds timeout, const PublishHooks& hooks = {},
std::span<const server::CellularActionRecord> actions = {});
[[nodiscard]] std::expected<CommittedCheckpoint, CellularPublicationFailure>
retry_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<ResolvedCommit, LeaseStoreFailure>
resolve_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
std::chrono::milliseconds timeout);
// After an `unknown` publication: resolve exactly the prepared bytes. A committed
// result yields the final batch; absent may be retried with the same prepared bytes
// only while the lease is still valid; conflict fails closed.