Complete M7.4b lineage checkpoint profile; M7.4 done
ADR-0062 adds a canonical LineageArchive codec (parents before children, organisms by id, FNV) that decodes by replaying admit/record_birth/ record_death and requires byte-identical re-encoding; it never overwrites an existing archive. LineageRegion binds the environmental producer and consumer accounts to archived organisms with identity high-waters, enforces closure (lifecycle vs deaths, exact living set, tick bounds) and records deaths in the tick that causes them. Checkpoint profile 2 (environmental-lineage-v1, history profile 1) publishes that container; schema v4 admits it with a 4,268,144-byte cap and requires each commit to keep its predecessor's profile, RNG, history and durability declarations. Linux adds provision/publish/recover for the profile on the shared publication path. Qualification found WSL2 stepping CLOCK_REALTIME back ~0.5 s every ~32 s, which made two 1 s-lease tests flaky under ASan. Tests now wait on database-time expiry; ADR-0060 records the slewed-clock requirement. Validated: Windows CTest 57/57; Linux GCC Debug/Release, clang-tidy and ASan/UBSan CTest 57/57 each; PostgreSQL suites 2x Release, 2x analysis, 5x ASan; SQL and C++ mutations each caught. 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:
+42
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
// Rules-2 environmental community used by region checkpoint tests (M7.4).
|
||||
#include "evo/processes/environmental_community.hpp"
|
||||
#include "evo/processes/lineage_region.hpp"
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@@ -81,4 +82,45 @@ inline void advance_region(processes::EnvironmentalCommunity& o, std::uint64_t t
|
||||
require(o.advance(tick, region_input(tick)).has_value(), "advance");
|
||||
}
|
||||
}
|
||||
|
||||
// History-capable fixture: founder genome 1 and descendant 2; a long-dead organism
|
||||
// 5 (genome 1); producer organism 10 (genome 1) and consumer 11 (genome 2).
|
||||
inline biology::Genome region_genome(std::uint64_t id, std::uint64_t parent) {
|
||||
biology::GenomeDraft draft;
|
||||
draft.id = id;
|
||||
draft.origin_event = id;
|
||||
draft.development_version = 1;
|
||||
if (parent != 0)
|
||||
draft.parents = {parent};
|
||||
draft.capabilities = {{biology::Capability::energy_conversion, 400, 0},
|
||||
{biology::Capability::membrane, 120, 0},
|
||||
{biology::Capability::target_size, 8'000'000, 0}};
|
||||
auto genome = biology::Genome::create(draft);
|
||||
require(genome.has_value(), "genome");
|
||||
return *genome;
|
||||
}
|
||||
inline biology::LineageArchive region_archive() {
|
||||
biology::LineageArchive archive;
|
||||
require(archive.admit(region_genome(1, 0)).has_value(), "admit 1");
|
||||
require(archive.admit(region_genome(2, 1)).has_value(), "admit 2");
|
||||
require(archive.record_birth(5, 1, Tick{0}).has_value(), "birth 5");
|
||||
require(archive.record_death(5, Tick{0}).has_value(), "death 5");
|
||||
require(archive.record_birth(10, 1, Tick{0}).has_value(), "birth 10");
|
||||
require(archive.record_birth(11, 2, Tick{0}).has_value(), "birth 11");
|
||||
return archive;
|
||||
}
|
||||
inline constexpr processes::LineageBinding region_binding{10, 11, 12, 3};
|
||||
inline std::unique_ptr<processes::LineageRegion> lineage_region() {
|
||||
auto region =
|
||||
processes::LineageRegion::create(region_community(), region_archive(), region_binding);
|
||||
require(region.has_value(), "lineage region");
|
||||
return std::move(*region);
|
||||
}
|
||||
inline void advance_lineage(processes::LineageRegion& r, std::uint64_t ticks,
|
||||
bool consumer_dies = false) {
|
||||
for (std::uint64_t i = 0; i < ticks; ++i) {
|
||||
const auto tick = r.community().progress().tick + 1;
|
||||
require(r.advance(tick, region_input(tick, consumer_dies)).has_value(), "advance lineage");
|
||||
}
|
||||
}
|
||||
} // namespace evo::test
|
||||
|
||||
Reference in New Issue
Block a user