Complete M7.9a region clones and retained-history audit

Clone a verified committed head into an isolated world and database
(ADR-0067): world re-identification with a proven byte round trip, a
schema v7 clone genesis naming the source commit and digest with digested
inherited outcomes, a read-only source session, an owner-only atomic
target transaction and the evo-world-clone tool. audit_region_history
re-verifies every retained link. Real-process tests cover trajectory
equality after the cut, source isolation, killed clones and retention.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-09-29 06:47:45 -04:00
co-authored by Claude Opus 5.5
parent 7aec68db8e
commit 703f67834f
28 changed files with 2206 additions and 266 deletions
+56
View File
@@ -281,6 +281,61 @@ void lineage_profile() {
nested[64] = 1; // Nested envelope format 1 is not this profile's envelope.
CHECK(restore_lineage_payload(nested, *m, 8000000).error() == CheckpointError::unsupported);
}
// ADR-0067 clone genesis: sequence 0 at the source tick, naming its origin.
void clone_genesis() {
const auto source = next(16);
const auto digest = filled<32>(0xD1);
const RegionKey target{8, 3};
const BatchDigests inherited{0, {}, 1, filled<32>(0x7E)};
auto c =
clone_manifest(source, digest, target, filled<16>(0x05), 300, filled<32>(0xA5), inherited);
CHECK(c && c->sequence == 0 && c->key == target && c->frame == source.frame);
CHECK(c->begin_tick == 16 && c->end_tick == 16 && c->predecessor_commit == source.commit);
CHECK(c->predecessor_digest == digest && c->epoch == 0 && c->holder == Uuid{});
CHECK(c->versions == source.versions && c->profile == source.profile &&
c->tick_microseconds == source.tick_microseconds && c->build == source.build);
auto bytes = encode_manifest(*c);
CHECK(bytes && decode_manifest(*bytes) == *c && supported(*c));
// A successor chains from the clone exactly as from any genesis.
auto after = successor_manifest(*c, filled<32>(0xD2), filled<16>(0x06), lease(), 20, build, 1,
filled<32>(0xA6), batch_for(4));
CHECK(after && after->sequence == 1 && after->begin_tick == 16 && after->key == target);
// Isolation and shape: another world, a fresh commit, no trace, bounded outcomes.
CHECK(
clone_manifest(source, digest, {7, 4}, filled<16>(5), 300, filled<32>(0xA5), {}).error() ==
CheckpointError::chain);
CHECK(
clone_manifest(source, digest, target, source.commit, 300, filled<32>(0xA5), {}).error() ==
CheckpointError::chain);
CHECK(clone_manifest(source, digest, target, filled<16>(5), 300, filled<32>(0xA5),
{trace_bytes_for(1), filled<32>(1), 0, {}})
.error() == CheckpointError::chain);
CHECK(
clone_manifest(source, digest, target, filled<16>(5), 300, filled<32>(0xA5), {0, {}, 1, {}})
.error() == CheckpointError::format);
CHECK(clone_manifest(source, digest, target, filled<16>(5), 300, filled<32>(0xA5),
{0, {}, 9, filled<32>(1)})
.error() == CheckpointError::format);
CHECK(clone_manifest(source, {}, target, filled<16>(5), 300, filled<32>(0xA5), {}).error() ==
CheckpointError::format);
auto old = source;
old.versions.rules = 1;
CHECK(clone_manifest(old, digest, target, filled<16>(5), 300, filled<32>(0xA5), {}).error() ==
CheckpointError::unsupported);
// A provisioned genesis still starts at tick 0 with no origin or outcomes.
auto g = genesis();
g.batch = inherited;
CHECK(encode_manifest(g).error() == CheckpointError::format);
// Manifest v1 never carried an origin.
auto v1 = *c;
v1.manifest_version = 1;
v1.batch = {};
CHECK(encode_manifest(v1).error() == CheckpointError::format);
// Half an origin is malformed.
auto half = *c;
half.predecessor_commit = {};
CHECK(encode_manifest(half).error() == CheckpointError::format);
}
} // namespace
int main() {
@@ -290,6 +345,7 @@ int main() {
successor_chain();
payload_validation_and_restored_trajectory();
lineage_profile();
clone_genesis();
std::puts("region checkpoint contracts passed");
return 0;
} catch (const std::exception& e) {