Implement M7.4a checkpoint publication and verified recovery
ADR-0061 publishes environmental-v1 full checkpoints. Manifest v1 is a fixed 280-byte record (identity, chain, lease, versions, build, zero RNG/history declarations, durability policy, payload length/SHA-256) that PostgreSQL parses and digests itself. Schema v3 adds region_commits with a digest CHECK and a composite head FK, owner-managed retained builds, fenced publish/load functions and owner-only genesis; it drops the bare v2 head kernel and fails closed while v2 heads exist. Linux evo::region_store adds OpenSSL SHA-256, an immutable content-addressed filesystem object store (temp+fsync+link, no overwrite/delete, O_NOFOLLOW exact-length verified reads), and publication (validate -> upload -> read back -> fenced transaction -> receipt check) and recovery (re-digest, allowlist, verify, full restore). Portable evo::region_checkpoint holds the codec and payload validation. Validated: Windows CTest 56/56; WSL Release, clang-tidy and ASan/UBSan private-PostgreSQL suites; four SQL and one host mutation each caught. M7.4 stays open for 7.4b (lineage archive codec and history binding). No Docker/Gitea CI, remote store, process kill or deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,41 @@
|
||||
# Region commit manifest contract v1 (M7.1 design)
|
||||
# Region commit manifest contract v1 (M7.1 design, M7.4a encoding)
|
||||
|
||||
## Canonical manifest encoding v1 (ADR-0061)
|
||||
|
||||
The encoder, decoder and `supported()` check live in
|
||||
`src/persistence/region_checkpoint.cpp`; `evolution.parse_checkpoint_manifest`
|
||||
mirrors them in SQL. The record is exactly 280 bytes, all integers little-endian,
|
||||
with no padding or trailing checksum. The commit digest is SHA-256 of the whole
|
||||
record, and each commit row stores it.
|
||||
|
||||
| Offset | Size | Field |
|
||||
|---|---|---|
|
||||
| 0 | 8 | magic `AEVORCM1` |
|
||||
| 8 | 4 | manifest_version = 1 (other values are unsupported) |
|
||||
| 12 | 4 | profile: 1 = environmental-v1 |
|
||||
| 16 | 24 | world, region, frame (nonzero u64 each) |
|
||||
| 40 | 16 | commit_id (nonzero; globally unique in the database) |
|
||||
| 56 | 8 | commit_sequence |
|
||||
| 64 | 16 | predecessor_commit_id (zero only at genesis; never equal to commit_id) |
|
||||
| 80 | 32 | predecessor manifest SHA-256 (zero only at genesis) |
|
||||
| 112 | 16 | begin_tick, end_tick (genesis 0/0; otherwise 1..64 tick delta) |
|
||||
| 128 | 16 | lease holder (zero only at genesis) |
|
||||
| 144 | 8 | lease epoch (0 only at genesis) |
|
||||
| 152 | 8 | tick_microseconds (nonzero; fixed for the region) |
|
||||
| 160 | 36 | nine u32 versions: rules 2, envelope 2, resources/fields/terrain/coordinate/generator/material/interval-adapter 1 |
|
||||
| 196 | 32 | retained build identity (nonzero; `retained_builds` row required) |
|
||||
| 228 | 4 | rng_streams = 0 (these rules use no randomness) |
|
||||
| 232 | 4 | history_profile = 0 (no genome/lineage state) |
|
||||
| 236 | 4 | durability_policy = 1 (single-volume development) |
|
||||
| 240 | 8 | payload_bytes (1..1 MiB) |
|
||||
| 248 | 32 | payload SHA-256 (nonzero) |
|
||||
|
||||
A structurally invalid record is malformed (SQL 22023). A record that parses but
|
||||
has an unsupported version, profile, RNG, history or durability declaration is
|
||||
unsupported (EVL06). Values above 255 are never truncated onto a supported enum.
|
||||
The payload is the exact environmental envelope format 2; its object key is the
|
||||
hex payload SHA-256 in the region's namespace. Decisions, trace and outbox are not
|
||||
encoded here: M7.5 adds them under a new manifest version.
|
||||
|
||||
Authority: ADR-0058 and docs/architecture/REGION_DURABILITY.md. Logical schema,
|
||||
not an implemented wire codec, SQL migration or permission to serialize structs.
|
||||
|
||||
Reference in New Issue
Block a user