feat(biology): genome schema 6 movement arrangement and derived handling
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m26s
Foundation / postgres-tools (push) Successful in 19s
Foundation / image (push) Successful in 3m57s
Foundation / server-image (push) Successful in 4m2s

Schema 6 genomes carry the body's movement arrangement for mutations 001-010 as
reference-point indices (100 = founder): output, efficiency, burst, steering,
streamlining, braking, anchor, coasting and colony drive. It is encoded after the
capability records and covered by the digest; older schemas refuse it, so their
capability tables and mutation catalogs are unchanged. Development version 6 and
founder 5 serve rules 12.

derive_cellular_handling scales the tuned founder handling by the arrangement:
output scales thrust, braking reverse thrust, steering turning; streamlining lowers
forward drag and coasting both drags. Full-output costs follow the metabolic
budget's movement cost times output over efficiency. Shed output or a missing
movement capability leaves only passive drift. Refreshes the DEV session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-21 16:39:09 -04:00
co-authored by Claude Opus 5.5
parent ab5df35c3f
commit 2bffbc2095
16 changed files with 285 additions and 20 deletions
+49 -2
View File
@@ -362,10 +362,10 @@ void schema_v2_rates() {
v1.capabilities[4].parameter = 1'000'001;
reject(v1, GenomeError::parameter_out_of_range);
auto unknown = founder();
unknown.schema_version = 6; // Schema 5 exists since rules 11 (ADR-0175).
unknown.schema_version = 7; // Schema 6 exists since rules 12.
reject(unknown, GenomeError::unsupported_version);
auto bytes = Genome::create(founder())->encode();
bytes[8] = 6; // Schema field; decode refuses before the checksum matters.
bytes[8] = 7; // Schema field; decode refuses before the checksum matters.
CHECK(!Genome::decode(bytes) &&
Genome::decode(bytes).error() == GenomeError::unsupported_version);
}
@@ -397,6 +397,52 @@ void moves_preserve_validity() {
static_assert(std::is_copy_constructible_v<Genome>);
static_assert(std::is_copy_assignable_v<Genome>);
}
// Schema 6 (rules 12): the movement arrangement is required, encoded after the capability
// records, covered by the digest, and refused before schema 6.
void schema_v6_movement_arrangement() {
auto draft = founder();
draft.schema_version = genome_schema_v6;
draft.development_version = 6;
reject(draft, GenomeError::parameter_out_of_range); // Missing arrangement.
draft.movement_arrangement = founder_movement_arrangement;
const auto genome = Genome::create(draft);
CHECK(genome && genome->movement_arrangement() == founder_movement_arrangement);
const auto bytes = genome->encode();
const auto decoded = Genome::decode(bytes);
CHECK(decoded && *decoded == *genome);
CHECK(bytes.size() == 36 + 4 + 3 * 9 + 18 + 16);
auto changed = draft;
changed.movement_arrangement->steering = 105;
const auto other = Genome::create(changed);
CHECK(other && other->content_digest() != genome->content_digest());
auto tampered = bytes;
tampered[36 + 4 + 3 * 9] ^= 1U; // First arrangement byte; the checksum catches it.
CHECK(!Genome::decode(tampered));
auto truncated = bytes;
truncated.erase(truncated.end() - 18, truncated.end() - 16);
CHECK(!Genome::decode(truncated));
for (auto bad : {MovementArrangement{1'001, 100, 0, 100, 100, 100, 0, 100, 0},
MovementArrangement{100, 0, 0, 100, 100, 100, 0, 100, 0},
MovementArrangement{100, 100, 0, 100, 100, 100, 0, 0, 0}}) {
auto refused = draft;
refused.movement_arrangement = bad;
reject(refused, GenomeError::parameter_out_of_range);
}
// Shed output and absent modules are valid.
auto shed = draft;
shed.movement_arrangement = MovementArrangement{0, 100, 0, 100, 100, 100, 0, 100, 0};
CHECK(Genome::create(shed));
auto early = founder();
early.schema_version = genome_schema_v5;
early.development_version = 5;
early.movement_arrangement = founder_movement_arrangement;
reject(early, GenomeError::parameter_out_of_range);
}
} // namespace
int main() try {
founders_and_ancestry();
@@ -408,6 +454,7 @@ int main() try {
frozen_record_compatibility();
schema_v2_rates();
moves_preserve_validity();
schema_v6_movement_arrangement();
std::cout << "PASS genome schema, ancestry, development graph and canonical encoding\n";
return 0;
} catch (const std::exception& e) {