M12.4: define explicit boundary-accounting checkpoint upgrades
Foundation / checks (deploy) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 2m38s
Foundation / checks (network) (push) Successful in 22m52s
Foundation / checks (client) (push) Successful in 23m48s
Foundation / checks (tsan) (push) Successful in 23m38s
Foundation / checks (postgres) (push) Successful in 53m31s
Foundation / checks (checks) (push) Successful in 1h9m6s
Foundation / postgres-tools (push) Successful in 2m0s
Foundation / server-image (push) Successful in 4m2s
Foundation / image (push) Successful in 4m40s

This commit is contained in:
dingo
2026-10-17 22:33:19 -04:00
parent 1e23dc3799
commit 2416735e2b
14 changed files with 455 additions and 14 deletions
+27 -4
View File
@@ -26,7 +26,7 @@ enum class CheckpointProfile : std::uint8_t {
environmental_lineage_v1 = 2, // LineageRegion container; history_profile 1.
primitive_lives_v1 = 3, // Funded creation state; history_profile 2.
cellular_lives_v1 = 4, // Complete cellular state; history_profile 3.
cellular_population_v1 = 5, // Population envelope 1; nested cellular bundle 9.
cellular_population_v1 = 5, // Exact population envelope; nested cellular bundle 9 or 10.
};
// history_profile 1: lineage archive format 1 with genome schema 1.
inline constexpr std::uint32_t lineage_history_profile = 1;
@@ -68,11 +68,19 @@ inline constexpr CellularVersionBundle cellular_v7_versions{6, 6, 1, 1, 1, 3, 2,
inline constexpr CellularVersionBundle cellular_v8_versions{7, 6, 1, 1, 1, 4, 3, 2, 1};
// ADR-0136 step A: rules 8 on owner envelope 6 with habitat 2 (pools and bubbles).
inline constexpr CellularVersionBundle cellular_v9_versions{8, 6, 2, 1, 1, 4, 3, 2, 1};
// ADR-0145: portable boundary accounting, unchanged rules 8 on owner envelope 7.
// Database publication requires its own explicit schema admission.
inline constexpr CellularVersionBundle cellular_v10_versions{8, 7, 2, 1, 1, 4, 3, 2, 1};
// Zero means this bundle has no population representation.
[[nodiscard]] constexpr std::uint32_t
population_envelope_version(const CellularVersionBundle& b) noexcept {
return b == cellular_v9_versions ? 1 : b == cellular_v10_versions ? 2 : 0;
}
// Bundles with genome revisions: the revision history profile and format-3 traces.
[[nodiscard]] constexpr bool cellular_revision_bundle(const CellularVersionBundle& b) noexcept {
return b == cellular_v3_versions || b == cellular_v4_versions || b == cellular_v5_versions ||
b == cellular_v6_versions || b == cellular_v7_versions || b == cellular_v8_versions ||
b == cellular_v9_versions;
b == cellular_v9_versions || b == cellular_v10_versions;
}
// Batch evidence bound by manifest v2 (ADR-0063); all zero at genesis.
@@ -141,7 +149,8 @@ enum class CheckpointError : std::uint8_t {
encode_manifest(const CheckpointManifest& manifest);
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
decode_manifest(std::span<const std::uint8_t> bytes);
// Profile with its history profile, exact versions, zero RNG and durability policy.
// Portable reader support: history, exact versions, zero RNG and durability.
// This does not grant admission to a database schema or a publication operation.
[[nodiscard]] bool supported(const CheckpointManifest& manifest) noexcept;
// Genesis for operator provisioning only; recovery never creates one.
@@ -197,13 +206,27 @@ restore_cellular_payload(std::span<const std::uint8_t> payload, const Checkpoint
[[nodiscard]] std::expected<std::unique_ptr<server::CellularPopulation>, CheckpointError>
restore_population_payload(std::span<const std::uint8_t> payload,
const CheckpointManifest& manifest);
// Dedicated profile 4/bundle 9 <-> profile 5 transition, no biological tick.
// Dedicated profile 4 <-> profile 5 transition, preserving bundle 9 or 10 exactly.
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
population_profile_transition_manifest(const CheckpointManifest& predecessor,
const Sha256Digest& predecessor_digest, Uuid commit,
const LeaseGrant& lease, const Sha256Digest& build,
std::uint64_t payload_bytes,
const Sha256Digest& payload_sha256);
// Explicit portable bundle 9 -> 10 upgrade, preserving profile 4/5 and history.
// No tick, representation conversion, new genesis or downgrade. The caller must
// independently verify the predecessor manifest/payload SHA-256 bindings; neither
// these candidate bytes nor supported() confer publication authority.
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError>
cellular_boundary_upgrade_manifest(const CheckpointManifest& predecessor,
const Sha256Digest& predecessor_digest, Uuid commit,
const LeaseGrant& lease, const Sha256Digest& build,
std::uint64_t payload_bytes, const Sha256Digest& payload_sha256);
// Restores the complete bundle-9 source and derives an exact no-tick owner-7
// candidate; population policy, membership and conversion sequence are retained.
[[nodiscard]] std::expected<std::vector<std::uint8_t>, CheckpointError>
cellular_boundary_upgrade_payload(std::span<const std::uint8_t> payload,
const CheckpointManifest& predecessor);
// Population manual conversion may publish at the same tick with a nonempty trace.
[[nodiscard]] std::expected<CheckpointManifest, CheckpointError> population_successor_manifest(
const CheckpointManifest& predecessor, const Sha256Digest& predecessor_digest, Uuid commit,