Add the immutable genome v1 record and its canonical encoding
Open M3 with the record that development and mutation will read, in a new evo::biology library that nothing else links yet. A genome is validated once at construction and exposes no mutator, so an invalid one cannot exist at runtime and callers never revalidate. A draft carries unvalidated input; create and decode apply identical semantic checks, so a decoded record is never less validated than a constructed one. Schema 1 fixes the seven v0.1 capability kinds. Each has a unit, an inclusive range, whether every genome must carry it, and the capabilities it mandates, all held as schema facts rather than record data, so no record can contradict its own units. A capability adds one parameter and a bitmask of declared developmental edges; the union of declared and mandated edges must be acyclic, which seven nodes make exact and bounded. Identity is a nonzero world-scoped genome ID distinct from every runtime identity, a nonzero origin event, and zero or one parent. Zero parents identifies a documented founder. The format reserves room for a second so recombination needs a schema version rather than a layout change. The encoding follows ADR-0008: explicit little endian, bounded before any allocation, an exact length match so trailing bytes are rejected, records strictly ascending by kind so the bytes are canonical and duplicates fall out of the same comparison, a stored digest recomputed on decode, and a trailing checksum. The digest covers identity and ancestry, so identical capabilities from different origins never share one. Neither value is an authenticity claim. Unknown schema versions fail closed. Tests cover ancestry rules, every declared range boundary from both sides, self, mutual and three-node cycles, a cycle closed by a mandated edge, truncation at every length, trailing and oversized buffers, every single-byte corruption, and three resealed edits that reach the digest, version and ordering checks rather than stopping at the checksum. One branch is recorded as uncovered rather than given a test that cannot fail: in schema 1 every mandated capability is also required. No genome affects any simulation. Native Release, clang-tidy analysis, ASan and format checks pass 17/17; golden d61ad5bf0c928c76 and ecosystem fingerprint 2cd4a15f9fbe9949 are unchanged. Linux CI has not run yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ network service. Dev verification manifests are separate from the simulation.
|
||||
- [Sequential command scheduling and recovery](docs/architecture/SCHEDULER_CONTRACT.md)
|
||||
- [Local periodic spatial queries](docs/architecture/SPATIAL_CONTRACT.md)
|
||||
- [Energy/matter model and implemented ledger boundary](docs/biology/ENERGY_MODEL.md)
|
||||
- [Genome model and implemented v1 record](docs/biology/GENOME_MODEL.md)
|
||||
|
||||
Read [AGENTS.md](AGENTS.md) before changing code. Architecture and contracts are
|
||||
authoritative over implementation. No external runtime library is needed for
|
||||
@@ -92,7 +93,8 @@ restore. See [testing strategy](docs/engineering/TEST_STRATEGY.md) and
|
||||
codec. `src/accounting` provides the independent finite-inventory ledger;
|
||||
it is not yet part of particle snapshots. `src/processes` holds the synthetic
|
||||
producer, feeding, reproduction and episode fixtures built on that ledger; they
|
||||
are bounded experiments, not organism biology. `apps/evo-sim` owns CLI/file I/O
|
||||
are bounded experiments, not organism biology. `src/biology` holds the immutable
|
||||
genome record; nothing reads it yet. `apps/evo-sim` owns CLI/file I/O
|
||||
and reporting. `tests` holds contract,
|
||||
fuzz and measurement programs. Future biology, world, networking and persistence
|
||||
modules are documented boundaries; they are added when they have real behavior.
|
||||
|
||||
Reference in New Issue
Block a user