diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index e4ca2c7..fc8736b 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -6684,4 +6684,15 @@ The direct focused MSVC executable is local evidence only; full CI is pending. The first CI run (240) also exposed a GCC `-Werror=missing-field-initializers` diagnostic in the pre-existing `CellularRegionStepCandidate` aggregate setup. The initializer now explicitly supplies empty starved and heat fields; CI for -that correction is pending. +that correction is part of the follow-up run below. + +CI run 241 compiled the code but found `region-checkpoint-contracts` accepting +an impossible 119-byte one-tick cellular trace. Manifest shape validation now +checks both supported trace headers, rejecting that truncated shape while +retaining the 116-byte empty legacy trace. The focused region-checkpoint test +and full CI for this correction are pending. +The changed manifest implementation and checkpoint test translation unit both +compile under MSVC `/W4 /WX /DNDEBUG`. A standalone local link is unavailable: +the cached release libraries do not contain the latest cellular lifecycle +symbols and the cached debug libraries use a different CRT. The Linux CI run +provides the full linked test. diff --git a/src/persistence/region_checkpoint.cpp b/src/persistence/region_checkpoint.cpp index d8d0b96..3c57fec 100644 --- a/src/persistence/region_checkpoint.cpp +++ b/src/persistence/region_checkpoint.cpp @@ -94,20 +94,32 @@ bool structural(const CheckpointManifest& m) noexcept { if (m.manifest_version == 1) return link && no_batch; const auto ticks = m.end_tick - m.begin_tick; - const auto cellular_min = server::cellular_batch_header_bytes + ticks * 4; - const auto cellular_max = server::cellular_batch_header_bytes + - ticks * (server::cellular_batch_tick_header_bytes + - biology::max_cellular_tick_lives * - (server::cellular_batch_intent_bytes + - server::cellular_batch_birth_bytes)); + const auto cellular_legacy_min = + server::cellular_batch_header_bytes + ticks * sizeof(std::uint32_t); + const auto cellular_current_min = + server::cellular_batch_header_bytes + ticks * server::cellular_batch_tick_header_bytes; + const auto cellular_max = + server::cellular_batch_header_bytes + + ticks * (server::cellular_batch_tick_header_bytes + + biology::max_cellular_tick_lives * + (server::cellular_batch_intent_bytes + server::cellular_batch_birth_bytes)); + const auto cellular_legacy_max = + server::cellular_batch_header_bytes + + ticks * (sizeof(std::uint32_t) + + biology::max_cellular_tick_lives * server::cellular_batch_intent_bytes); + const bool cellular_current_trace = + b.trace_bytes >= cellular_current_min && b.trace_bytes <= cellular_max && + (b.trace_bytes - cellular_current_min) % sizeof(std::uint64_t) == 0; + const bool cellular_legacy_trace = + b.trace_bytes >= cellular_legacy_min && b.trace_bytes <= cellular_legacy_max && + (b.trace_bytes - cellular_legacy_min) % server::cellular_batch_intent_bytes == 0; const bool trace_shape = primitive ? b.trace_bytes >= server::primitive_batch_header_bytes && b.trace_bytes <= server::max_primitive_batch_bytes && (b.trace_bytes - server::primitive_batch_header_bytes) % server::primitive_birth_bytes == 0 - : cellular ? b.trace_bytes >= cellular_min && - b.trace_bytes <= cellular_max + : cellular ? (cellular_current_trace || cellular_legacy_trace) : b.trace_bytes == trace_bytes_for(ticks); return link && trace_shape && !zero(b.trace_sha256) && b.decision_count <= max_batch_decisions && diff --git a/tests/region_checkpoint_tests.cpp b/tests/region_checkpoint_tests.cpp index 699607b..f6c2e5a 100644 --- a/tests/region_checkpoint_tests.cpp +++ b/tests/region_checkpoint_tests.cpp @@ -434,9 +434,12 @@ void cellular_profile() { short_cellular_trace.batch.trace_bytes = cellular_batch_header_bytes + cellular_batch_tick_header_bytes - 1; CHECK(!encode_manifest(short_cellular_trace)); + auto legacy_cellular_trace = *successor; + legacy_cellular_trace.batch.trace_bytes = cellular_batch_header_bytes + sizeof(std::uint32_t); + CHECK(encode_manifest(legacy_cellular_trace)); auto large_cellular_trace = *successor; - large_cellular_trace.batch.trace_bytes = cellular_batch_header_bytes + - cellular_batch_tick_header_bytes + + large_cellular_trace.batch.trace_bytes = + cellular_batch_header_bytes + cellular_batch_tick_header_bytes + max_cellular_tick_lives * cellular_batch_intent_bytes + 1; CHECK(!encode_manifest(large_cellular_trace)); const auto clone = clone_manifest(*manifest, filled<32>(0xA3), {8, 3}, filled<16>(0x03),