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:
dingo
2026-09-28 15:25:27 -04:00
co-authored by Claude Opus 5.5
parent 07116446c6
commit 5d4f59f901
32 changed files with 2253 additions and 145 deletions
+55
View File
@@ -2103,3 +2103,58 @@ Only clean-to-v1 and exact-v1 restart are supported migration paths at this gate
overflow (`9223372036854775807 + 2000`).
- Reran Windows CTest 55/55, the repository format check, and GCC14 Release,
clang-tidy analysis and ASan/UBSan private-PostgreSQL suites: all passed.
## M7.4a checkpoint publication - 2026-09-28
- Windows MSVC Release configure/build/CTest passed 56/56, including the new
portable `region-checkpoint-contracts`. It covers:
- golden byte offsets and round trips;
- malformed and unsupported manifests, including u32 values above 255 that
must not truncate onto supported enums;
- chain rules;
- payload identity, tick, quantum, corruption and budget checks;
- 24-tick continuation equality after restore.
The repository clang-format 19 check passed.
- WSL Ubuntu, with GCC 14.2.0, clang 19.1.1, PostgreSQL/libpq 18.6 and OpenSSL
3.0.13-0ubuntu3.15, running as uid 1000 so permission faults were really
exercised. GCC14 Release, clang19 analysis (clang-tidy warnings-as-errors) and
clang19 ASan/UBSan each passed `tools/ci/postgres-check.sh`.
- Analysis initially flagged `performance-enum-size` on the u32-based
profile/durability enums. They are now u8 with explicit decoding of values
above 255 as unknown. All three configurations were rerun.
- New real-database/filesystem coverage:
- SHA-256 vectors (NIST "", "abc" and the 448-bit message) and agreement with
PostgreSQL `sha256()`.
- Object store: rejects root symlinks, creates 0700 namespaces, puts are
idempotent, never overwrites differing content, ignores temporary leftovers,
and detects byte flips, symlinks, truncation and growth. Size bounds and
write-permission failure are also covered.
- Genesis provisioning and duplicate refusal; three batches (16/64/16 ticks);
a 65-tick batch refused before upload.
- Recovery from a new store handle is byte-identical and continues 44 ticks
identically to an uninterrupted reference.
- The build allowlist is enforced by the host and by the database.
- Upload failure leaves the head unchanged. A fenced publication leaves a
verified orphan, and recovery ignores it.
- Missing and corrupt payloads quarantine; restoring the object recovers.
- Owner edits to a manifest (23514) and head repointing (23503) are refused.
With the constraint dropped, recovery still detects the edit, and the
constraint is restored afterwards.
- Unknown regions are never created.
- Lease tests were ported to manifest publication. They additionally cover
malformed manifests, a quantum change, an unretained build, a future rules
version and a globally reused commit ID.
- Migrations: clean→v3, repeated no-op, v1→v3. v2 with existing heads fails
closed and stays at v2. The audit rejects EXECUTE on provisioning and SELECT on
commits. Tampered v2/v3 checksums and an unknown v4 are refused.
- Mutations, run on scratch copies with the source restored afterwards: removing
the predecessor-digest check, the lease check, the version/quantum continuity
check or the retained-build check in SQL, or the host manifest re-digest, each
failed at the expected assertion.
- Local fixture measurements: payloads of 22775 and 37367 bytes.
- Release publication took 3.6-4.8 ms per batch; analysis 5.5-6.7 ms; ASan
about 10.5 ms.
- Manifest publish p50 was about 0.74-0.91 ms.
These are local socket and local disk only.
- Not executed: Docker/Gitea CI, a remote object store or PVC, power-loss fsync
semantics, read-back verification fault injection, process kill, and TSan.