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:
+21
-2
@@ -77,6 +77,11 @@ add_library(evo::region_lease ALIAS evo_region_lease)
|
||||
target_include_directories(evo_region_lease PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_compile_features(evo_region_lease PUBLIC cxx_std_23)
|
||||
evo_owned_target(evo_region_lease)
|
||||
# Portable checkpoint manifest codec and environmental-v1 payload validation.
|
||||
add_library(evo_region_checkpoint STATIC src/persistence/region_checkpoint.cpp)
|
||||
add_library(evo::region_checkpoint ALIAS evo_region_checkpoint)
|
||||
target_link_libraries(evo_region_checkpoint PUBLIC evo::region_lease evo::processes)
|
||||
evo_owned_target(evo_region_checkpoint)
|
||||
|
||||
include(CTest)
|
||||
if(EVO_BUILD_POSTGRES)
|
||||
@@ -90,10 +95,19 @@ if(EVO_BUILD_POSTGRES)
|
||||
target_include_directories(evo_postgres PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_link_libraries(evo_postgres PUBLIC evo::region_lease PRIVATE PostgreSQL::PostgreSQL)
|
||||
evo_owned_target(evo_postgres)
|
||||
# SHA-256 via system OpenSSL libcrypto (already required by libpq TLS; ADR-0061).
|
||||
find_package(OpenSSL 3 REQUIRED COMPONENTS Crypto)
|
||||
add_library(evo_region_store STATIC src/persistence/sha256.cpp src/persistence/object_store.cpp
|
||||
src/persistence/checkpoint_store.cpp)
|
||||
add_library(evo::region_store ALIAS evo_region_store)
|
||||
target_link_libraries(evo_region_store PUBLIC evo::postgres evo::region_checkpoint
|
||||
PRIVATE OpenSSL::Crypto)
|
||||
evo_owned_target(evo_region_store)
|
||||
if(BUILD_TESTING)
|
||||
# Contention tests use one thread and one connection per contender.
|
||||
add_executable(evo-postgres-tests tests/postgres_tests.cpp tests/region_lease_store_tests.cpp)
|
||||
target_link_libraries(evo-postgres-tests PRIVATE evo::postgres Threads::Threads)
|
||||
add_executable(evo-postgres-tests tests/postgres_tests.cpp tests/region_lease_store_tests.cpp
|
||||
tests/region_checkpoint_store_tests.cpp)
|
||||
target_link_libraries(evo-postgres-tests PRIVATE evo::region_store Threads::Threads)
|
||||
evo_owned_target(evo-postgres-tests)
|
||||
# Intentionally not an ordinary CTest: tools/ci/postgres-check.sh owns its private DB.
|
||||
endif()
|
||||
@@ -104,6 +118,11 @@ if(BUILD_TESTING)
|
||||
evo_owned_target(evo-region-lease-tests)
|
||||
add_test(NAME region-lease-contracts COMMAND evo-region-lease-tests)
|
||||
set_tests_properties(region-lease-contracts PROPERTIES TIMEOUT 60)
|
||||
add_executable(evo-region-checkpoint-tests tests/region_checkpoint_tests.cpp)
|
||||
target_link_libraries(evo-region-checkpoint-tests PRIVATE evo::region_checkpoint)
|
||||
evo_owned_target(evo-region-checkpoint-tests)
|
||||
add_test(NAME region-checkpoint-contracts COMMAND evo-region-checkpoint-tests)
|
||||
set_tests_properties(region-checkpoint-contracts PROPERTIES TIMEOUT 60)
|
||||
add_executable(evo-environmental-qualification tests/environmental_qualification.cpp)
|
||||
target_link_libraries(evo-environmental-qualification PRIVATE evo::processes)
|
||||
evo_owned_target(evo-environmental-qualification)
|
||||
|
||||
Reference in New Issue
Block a user