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>
30 lines
1.3 KiB
Markdown
30 lines
1.3 KiB
Markdown
# Lineage archive v1 (M7.4b)
|
||
|
||
Authority: ADR-0062 and ADR-0034. The encoder and decoder are
|
||
`LineageArchive::encode/decode` in `src/biology/lineage.cpp`. All integers are
|
||
little-endian, with no native struct serialization.
|
||
|
||
| Offset | Size | Field |
|
||
|---|---|---|
|
||
| 0 | 8 | magic `AEVOLAR1` |
|
||
| 8 | 4 | archive format = 1 |
|
||
| 12 | 4 | genome schema = 1 |
|
||
| 16 | 4 | genome count G (≤ 4096) |
|
||
| 20 | 4 | organism count O (≤ 65536) |
|
||
| 24 | 8 | total bytes, including the checksum |
|
||
| 32 | … | G × (u16 length 1..256, Genome v1 record) ordered by (ancestry depth, genome id) |
|
||
| … | 33·O | organism records ordered by id: id u64, genome u64, born u64, died u64, alive u8 |
|
||
| end−8 | 8 | FNV-1a64 of all previous bytes |
|
||
|
||
The maximum size is 3,219,496 bytes, and the counts are checked before any record
|
||
is decoded. A living organism has `died` = 0 and `alive` = 1. A dead organism has
|
||
`alive` = 0 and `died` ≥ `born`.
|
||
|
||
Decoding admits each genome and replays births and deaths through the archive's
|
||
own operations, so a child before its parent, a duplicate, an unknown genome or a
|
||
second death is refused. The result must re-encode to identical bytes; otherwise
|
||
the input is non-canonical.
|
||
|
||
An empty archive is 40 bytes. Unknown formats or genome schemas are unsupported.
|
||
There is no migration API; a new genome schema needs a new history profile.
|