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
+35
View File
@@ -130,6 +130,40 @@ void snapshots_restore_and_continue() {
CHECK(older && (*older)->archive().organism(11)->alive);
CHECK(!LineageRegion::restore(*bytes, {7, 10}, 8000000)); // Foreign frame.
}
// ADR-0067: a clone records another world ID; nothing else about the region, its
// history or its trajectory changes, and rebinding back is byte-exact.
void rebinding_changes_only_the_world() {
auto source = lineage_region();
advance_lineage(*source, 25, true); // Consumer dead at tick 20.
const auto original = source->snapshot();
CHECK(original);
auto clone = LineageRegion::restore(*original, region_identity, 8000000);
CHECK(clone);
CHECK(!(*clone)->rebind_world(0));
CHECK((*clone)->rebind_world(8) && (*clone)->community().world() == 8);
const auto rebound = (*clone)->snapshot();
CHECK(rebound && *rebound != *original && rebound->size() == original->size());
// Only the new identity restores it; the source identity no longer does.
CHECK(!LineageRegion::restore(*rebound, region_identity, 8000000));
auto restored = LineageRegion::restore(*rebound, {8, region_identity.frame}, 8000000);
CHECK(restored && (*restored)->archive().organism(11)->died.value == 20);
CHECK((*restored)->binding() == source->binding());
// Identical continuation: every report matches, and so does the state once the
// clone is rebound to the source world.
for (std::uint64_t tick = 26; tick <= 90; ++tick) {
auto a = source->advance(tick, evo::test::region_input(tick));
auto b = (*restored)->advance(tick, evo::test::region_input(tick));
CHECK(a && b && *a == *b);
}
CHECK((*restored)->rebind_world(region_identity.world));
CHECK((*restored)->snapshot() == source->snapshot());
// The plain community rebinds the same way.
auto community = region_community();
const auto before = community->snapshot();
CHECK(community->rebind_world(9) && community->rebind_world(region_identity.world));
CHECK(community->snapshot() == before);
}
} // namespace
int main() {
@@ -137,6 +171,7 @@ int main() {
closure_is_required();
deaths_are_recorded_in_the_same_tick();
snapshots_restore_and_continue();
rebinding_changes_only_the_world();
std::puts("lineage region contracts passed");
return 0;
} catch (const std::exception& e) {