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>
1.6 KiB
1.6 KiB
Environmental lineage region container v1 (M7.4b)
Authority: ADR-0062. This is the payload of checkpoint profile 2 (history profile 1).
The encoder and decoder are LineageRegion::snapshot/restore in
src/processes/lineage_region.cpp. All integers are little-endian.
| Offset | Size | Field |
|---|---|---|
| 0 | 8 | magic AEVOELR1 |
| 8 | 4 | container format = 1 |
| 12 | 4 | reserved, must be 0 |
| 16 | 8 | producer account's archived organism id |
| 24 | 8 | consumer account's archived organism id |
| 32 | 8 | next organism id (> every recorded organism) |
| 40 | 8 | next genome id (> every archived genome) |
| 48 | 8 | envelope length E (1..1 MiB) |
| 56 | E | environmental community envelope, format 2 |
| 56+E | 8 | archive length A |
| 64+E | A | lineage archive v1 |
| end−8 | 8 | FNV-1a64 of all previous bytes |
The maximum is 72 + 1 MiB + 3,219,496 = 4,268,144 bytes. PostgreSQL enforces this same value as the profile-2 payload cap.
Restore checks, in order:
- The container framing.
- The full envelope restore, with its replay audit.
- The archive replay (lineage-archive-v1).
- Closure (ADR-0062):
- both organisms are recorded;
- terminal flags equal the archive's death state;
- no birth or death is after the current tick;
- the living organisms are exactly the bound, non-terminal ones;
- the high-waters are above every recorded identity.
- A byte-identical re-encoding.
Account order is the envelope's producer, then consumer. The manifest's region maps these region-local accounts to organisms; no global ownership transfer exists.