Add cellular genome revision profile migration
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (checks) (push) Failing after 2m10s
Foundation / checks (postgres) (push) Failing after 10m34s
Foundation / checks (network) (push) Failing after 12m19s
Foundation / checks (tsan) (push) Failing after 2m14s
Foundation / checks (client) (push) Successful in 15m7s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 06:13:17 -04:00
parent 66ffdc1cad
commit a479ce2d95
25 changed files with 725 additions and 79 deletions
+26
View File
@@ -0,0 +1,26 @@
# Cellular lives checkpoint v3
Authority: ADR-0122. Cellular profile 4 v3 adds append-only genome revisions
while retaining the v2 life records and mutation-offer state. Cellular-v1 and
v2 checkpoints remain readable with their original version bundles.
The envelope magic is ASCII `AEVCLV03`, format is 3, and cellular rules remain
2. Its manifest bundle is `(2,3,1,1,1,2,1,2,1)`: rules, envelope, habitat,
coordinate, genome, development, founder, archive and mutation state. The
tick quantum remains 50,000 μs and the payload cap remains 16 MiB. The header,
spawn sites, life records and corpse records keep the v2 layout. The nested
lineage archive uses format 2 as specified in
[lineage-archive-v2](lineage-archive-v2.md).
For a living life, `identity.genome` is the current genome reached by replaying
that organism's revision chain; the archived birth record remains immutable.
For a corpse, closure derives the genome at its death tick from the same chain.
Restore replays and validates the archive before checking the life, corpse,
habitat and inventory closure.
The only v2-to-v3 conversion is a leased, no-tick profile migration. It upgrades
each format-1 archive to format 2 with an empty revision list and preserves the
tick, lives, outstanding offers, corpses, habitat and conserved inventory. SQL
records the source and target as one immutable migration link. Ordinary v3
successors retain the exact v3 bundle; a mutation is published with an
advancing v3 tick.
+36
View File
@@ -0,0 +1,36 @@
# Lineage archive v2 (M11.4c)
Authority: ADR-0122. The encoder and decoder are
`LineageArchive::encode/decode` in `src/biology/lineage.cpp`. All integers are
little-endian; no native struct serialization is used. V1 bytes and decoding
remain unchanged. V2 is used by cellular-v3 checkpoints.
| Offset | Size | Field |
|---|---|---|
| 0 | 8 | magic `AEVOLAR1` |
| 8 | 4 | archive format = 2 |
| 12 | 4 | highest genome schema present |
| 16 | 4 | genome count G (≤ 4096) |
| 20 | 4 | birth-record organism count O (≤ 65536) |
| 24 | 4 | genome-revision count R (≤ 4096) |
| 28 | 4 | reserved = 0 |
| 32 | 8 | total bytes, including checksum |
| 40 | … | G × (u16 length 1..256, canonical genome record), ordered by (ancestry depth, genome id) |
| … | 33·O | birth records ordered by organism id: organism, birth genome, born tick, died tick, alive flag |
| … | 40·R | revisions ordered by (effective tick, organism): organism, previous genome, successor genome, origin event, effective tick (all u64) |
| end−8 | 8 | FNV-1a64 of all preceding bytes |
The maximum size is 3,383,344 bytes. Counts and total size are checked before
allocation. A revision's successor is already in the genome table, has exactly
the previous genome as its parent, and carries the same nonzero value as its
genome ID and origin event. The organism must be alive at that tick, the tick
must be after birth and before death, and at most one revision per organism per
tick is permitted. Revisions form a continuous chain from the immutable birth
genome. `OrganismRecord.genome` always remains the birth genome; the current
genome is resolved by replaying the revisions.
Format 2 is append-only. Decoding admits genomes and birth/death records, then
replays revisions against the organism's current genome. The result must
re-encode to identical bytes. A format-2 archive with no revisions is used by
the explicit cellular-v2-to-v3 migration. Other profiles retain their v1
payload caps and bytes.
+18 -12
View File
@@ -5,8 +5,11 @@ using manifest v2. M11.3 adds profile 4, the
[cellular lives profile v1](cellular-lives-v1.md), with its own version bundle,
payload bound and restore validator. M11.4 adds the compatible cellular-v2
[checkpoint](cellular-lives-v2.md) and its explicit no-tick version migration
(ADR-0119). These formats do not change profiles 1–3. PostgreSQL admission and
atomic publication are separate migration requirements.
(ADR-0119). M11.4c adds cellular-v3
[checkpoints](cellular-lives-v3.md) for append-only genome revision history
(ADR-0122), with a separate no-tick v2-to-v3 migration. These formats do not
change profiles 1–3. PostgreSQL admission and atomic publication are separate
migration requirements.
## Canonical manifest encoding v1/v2 (ADR-0061, ADR-0063)
@@ -33,7 +36,7 @@ record, and each commit row stores it.
| 160 | 36 | nine u32 versions: environmental/primitive bundles as below; profile 4 has cellular rules, envelope, habitat, coordinate, genome, development, founder, archive, then reserved zero |
| 196 | 32 | retained build identity (nonzero; `retained_builds` row required) |
| 228 | 4 | rng_streams = 0 (these rules use no randomness) |
| 232 | 4 | history_profile: 0 with profile 1; 1 with profile 2; 2 with profile 3; 3 with profile 4 |
| 232 | 4 | history_profile: 0 with profile 1; 1 with profile 2; 2 with profile 3; 3 with cellular-v1/v2; 4 with cellular-v3 |
| 236 | 4 | durability_policy = 1 (single-volume development) |
| 240 | 8 | payload_bytes: profile 1 is 1..1 MiB; profile 2 is 1..4,268,144; profile 3 is 1..3,266,800; profile 4 is 1..16 MiB |
| 248 | 32 | payload SHA-256 (nonzero) |
@@ -51,15 +54,18 @@ founder/archive in the first eight u32 version slots. Version bundle 1 is
`(1,1,1,1,1,2,1,1,0)` and uses [cellular-lives-v1](cellular-lives-v1.md).
Version bundle 2 is `(2,2,1,1,1,2,1,1,1)` and uses
[cellular-lives-v2](cellular-lives-v2.md); the ninth slot pins mutation state.
The tick quantum remains 50,000 μs. Both bundles use the bounded profile-4 trace
and bind their decision blocks transactionally. A region's ordinary successor
keeps its exact version bundle. Only the explicit leased migration commit in
ADR-0119 may transition v1 to v2 at an unchanged tick, with an immutable source
and target link; generic cellular publication cannot change versions or publish
a zero-tick commit. Profile-4 clone genesis remains unsupported until cellular
identity remapping is specified. Migration 18 admits profile 4, and the
dedicated cellular publisher binds tick evidence. Profile 3 retains its
creation-only trace and zero-decision rules.
Version bundle 3 is `(2,3,1,1,1,2,1,2,1)` and uses
[cellular-lives-v3](cellular-lives-v3.md); its archive slot selects revision
history format 2. The tick quantum remains 50,000 μs. All three bundles use the
bounded profile-4 trace and bind their decision blocks transactionally. A
region's ordinary successor keeps its exact version bundle. Only the explicit
leased migration commits in ADR-0119 and ADR-0122 may transition v1 to v2 or v2
to v3 at an unchanged tick, with immutable source and target links; generic
cellular publication cannot change versions or publish a zero-tick commit.
Profile-4 clone genesis remains unsupported until cellular identity remapping
is specified. Migration 18 admits profile 4, and the dedicated cellular
publisher binds tick evidence. Profile 3 retains its creation-only trace and
zero-decision rules.
Profile 2 payloads are schemas/environmental-lineage-v1.md containers. A region
never changes profile, history, RNG or durability declarations; schema v4
enforces this against the predecessor. For profile 1, the payload is the exact