Files
aevolution/include/evo/persistence/environment_checkpoint_store.hpp
T
dingoandClaude Opus 5.5 51991ac7ff
Foundation / checks (ecs) (push) Successful in 2m24s
Foundation / checks (deploy) (push) Successful in 4m51s
Foundation / checks (network) (push) Successful in 20m42s
Foundation / checks (client) (push) Successful in 21m53s
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 40m19s
Foundation / checks (postgres) (push) Canceled after 40m9s
Foundation / checks (tsan) (push) Canceled after 37m53s
feat(persistence): admit durable cellular environment profile
ADR-0174 and schema 56 add checkpoint profile 6, which stores the joint
cell/environment envelope nesting population envelope 2 (bundles 10 and
11). Entry from a committed population head is explicit, one-way and
no-tick, with the source commit, manifest and payload digests bound in
immutable evidence. Joint intervals use schema 45's owned admission and
settlement; conversions cannot overtake a pending interval. The fenced
publisher validates the joint trace structurally, including the complete
nested population batch, and records per-commit imported and radiated
totals. Recovery replays the head's link and requires the payload
exactly, refusing a forged but structurally valid trace. A trigger
refuses profile-6 commits from every other publisher; profile 4/5 bytes,
parsers and rules are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:16:50 -04:00

42 lines
2.6 KiB
C++

#pragma once
#include "evo/persistence/population_checkpoint_store.hpp"
namespace evo::persistence {
// ADR-0174 / schema 56. Prepared joint commits reuse the population shape: an empty
// trace is the no-tick profile 5 -> 6 transition, otherwise a joint batch.
struct RecoveredEnvironmentCheckpoint {
CommittedCheckpoint committed;
CheckpointManifest manifest;
std::unique_ptr<server::CellularEnvironment> state;
};
// Explicit, one-way and no-tick: wraps the identical committed population with its
// declared environment under the same lease/head fence. No biology advances.
[[nodiscard]] std::expected<CommittedCheckpoint, PopulationPublicationFailure>
migrate_population_to_environment(Postgres&, const FilesystemObjectStore&, const LeaseGrant&,
const CommittedCheckpoint& predecessor, Uuid commit,
const Sha256Digest& build, server::CellularEnvironmentConfig,
std::chrono::milliseconds timeout,
const PublishHooks& hooks = {});
// A joint interval (after an owned admission) or whole-group conversion. The batch is
// replayed from the committed predecessor and must reproduce `candidate` exactly.
[[nodiscard]] std::expected<CommittedCheckpoint, PopulationPublicationFailure>
publish_environment_batch(Postgres&, const FilesystemObjectStore&, const LeaseGrant&,
const CommittedCheckpoint& predecessor,
const server::CellularEnvironmentBatch& batch,
const server::CellularEnvironment& candidate, Uuid commit,
const Sha256Digest& build, std::chrono::milliseconds timeout,
const PublishHooks& hooks = {});
[[nodiscard]] std::expected<CommittedCheckpoint, PopulationPublicationFailure>
retry_environment_prepared(Postgres&, const PopulationPreparedCommit&,
std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<ResolvedCommit, LeaseStoreFailure>
resolve_environment_prepared(Postgres&, const PopulationPreparedCommit&,
std::chrono::milliseconds timeout);
// Loads the head, requires its complete evidence and replays its link exactly.
[[nodiscard]] std::expected<RecoveredEnvironmentCheckpoint, RecoveryFailure>
recover_environment_checkpoint(Postgres&, const FilesystemObjectStore&, RegionKey,
const LeaseGrant&, std::span<const Sha256Digest> retained_builds,
std::chrono::milliseconds timeout);
} // namespace evo::persistence