M11.1: genome schema 2 with per-second rates (ADR-0099, segment 2)
Foundation / checks (deploy) (push) Successful in 3m32s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m56s
Foundation / checks (network) (push) Successful in 13m46s
Foundation / checks (tsan) (push) Successful in 7m59s
Foundation / checks (checks) (push) Successful in 33m36s
Foundation / checks (postgres) (push) Successful in 45m30s
Foundation / postgres-tools (push) Successful in 20s
Foundation / server-image (push) Successful in 25s
Foundation / image (push) Successful in 2m36s
Foundation / checks (deploy) (push) Successful in 3m32s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (client) (push) Successful in 12m56s
Foundation / checks (network) (push) Successful in 13m46s
Foundation / checks (tsan) (push) Successful in 7m59s
Foundation / checks (checks) (push) Successful in 33m36s
Foundation / checks (postgres) (push) Successful in 45m30s
Foundation / postgres-tools (push) Successful in 20s
Foundation / server-image (push) Successful in 25s
Foundation / image (push) Successful in 2m36s
Movement and ingestion are stored per second in schema 2 (ranges x20). Schema 1 records stay valid, are never rewritten, and read as exactly x20 via Genome::per_second; drafts default to schema 1 so existing literals keep their meaning. Development version 1 converts genome rates at its own 50 ms quantum (round down), so phenotypes are unchanged. Mutation keeps the parent's schema and step; the lineage archive header names exactly the highest schema held (all-schema-1 archives keep their bytes); the development-v1 opening names schema 1. No golden changed; two tests that used 2 as an unknown schema now use the next one. Refresh the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,9 @@ struct EnvironmentState {
|
||||
accounting::Inventory available{};
|
||||
auto operator<=>(const EnvironmentState&) const = default;
|
||||
};
|
||||
// Development version 1 is defined in ticks of this quantum: its per-tick constants and
|
||||
// outputs, and the genome rates it reads (converted from per second, ADR-0099).
|
||||
inline constexpr std::uint64_t development_v1_tick_microseconds = 50'000;
|
||||
// Chosen constants, reviewable as a unit and selected by the genome's
|
||||
// development version. Declared model parameters, not balance.
|
||||
struct DevelopmentRules {
|
||||
|
||||
@@ -25,10 +25,12 @@ inline constexpr std::size_t capability_count = 7;
|
||||
enum class Unit : std::uint8_t {
|
||||
per_thousand,
|
||||
micrometres,
|
||||
micrometres_per_tick,
|
||||
micrometres_per_tick, // Schema 1: per 50 ms tick.
|
||||
femtograms,
|
||||
femtograms_per_tick,
|
||||
millikelvin
|
||||
femtograms_per_tick, // Schema 1: per 50 ms tick.
|
||||
millikelvin,
|
||||
micrometres_per_second, // Schema 2 (ADR-0099).
|
||||
femtograms_per_second // Schema 2 (ADR-0099).
|
||||
};
|
||||
struct CapabilitySpec {
|
||||
Unit unit;
|
||||
@@ -42,8 +44,8 @@ struct CapabilitySpec {
|
||||
return 1U << static_cast<std::uint8_t>(kind);
|
||||
}
|
||||
// Chosen schema constants, reviewable as a unit. These are ranges of expressible
|
||||
// capability, not balance, stats or a power score.
|
||||
inline constexpr std::array<CapabilitySpec, capability_count> capability_schema{
|
||||
// capability, not balance, stats or a power score. Schema 1 states rates per 50 ms tick.
|
||||
inline constexpr std::array<CapabilitySpec, capability_count> capability_schema_v1{
|
||||
CapabilitySpec{Unit::per_thousand, 1, 1000, true, 0},
|
||||
CapabilitySpec{Unit::micrometres, 1, 10'000, true, 0},
|
||||
CapabilitySpec{Unit::micrometres_per_tick, 0, 100'000, false,
|
||||
@@ -54,6 +56,23 @@ inline constexpr std::array<CapabilitySpec, capability_count> capability_schema{
|
||||
capability_bit(Capability::energy_conversion)},
|
||||
CapabilitySpec{Unit::femtograms, 1, 1'000'000'000, true, 0},
|
||||
CapabilitySpec{Unit::millikelvin, 1, 100'000, false, 0}};
|
||||
// Schema 2 (ADR-0099): the same capabilities with rates per second. Each rate range is
|
||||
// schema 1's times 20, so every schema 1 value has an exact schema 2 equivalent.
|
||||
inline constexpr std::array<CapabilitySpec, capability_count> capability_schema_v2{
|
||||
CapabilitySpec{Unit::per_thousand, 1, 1000, true, 0},
|
||||
CapabilitySpec{Unit::micrometres, 1, 10'000, true, 0},
|
||||
CapabilitySpec{Unit::micrometres_per_second, 0, 2'000'000, false,
|
||||
capability_bit(Capability::membrane)},
|
||||
CapabilitySpec{Unit::femtograms_per_second, 0, 20'000'000, false,
|
||||
capability_bit(Capability::membrane)},
|
||||
CapabilitySpec{Unit::per_thousand, 1, 1000, false,
|
||||
capability_bit(Capability::energy_conversion)},
|
||||
CapabilitySpec{Unit::femtograms, 1, 1'000'000'000, true, 0},
|
||||
CapabilitySpec{Unit::millikelvin, 1, 100'000, false, 0}};
|
||||
// The current schema's table.
|
||||
inline constexpr const auto& capability_schema = capability_schema_v2;
|
||||
// Schema 1 rates are per tick of this quantum.
|
||||
inline constexpr std::uint64_t schema_v1_tick_microseconds = 50'000;
|
||||
|
||||
struct CapabilityRecord {
|
||||
Capability kind{};
|
||||
@@ -69,6 +88,10 @@ struct GenomeDraft {
|
||||
std::uint32_t development_version{};
|
||||
std::vector<std::uint64_t> parents;
|
||||
std::vector<CapabilityRecord> capabilities;
|
||||
// The schema the parameters are written in. Schema 1 is the default so an existing
|
||||
// literal keeps its meaning (rates per 50 ms tick); new records name schema 2. Last,
|
||||
// so positional initialisers are unaffected.
|
||||
std::uint32_t schema_version{1};
|
||||
};
|
||||
enum class GenomeError : std::uint8_t {
|
||||
unsupported_version,
|
||||
@@ -83,7 +106,16 @@ enum class GenomeError : std::uint8_t {
|
||||
digest_mismatch,
|
||||
invalid_encoding
|
||||
};
|
||||
inline constexpr std::uint32_t genome_schema_version = 1;
|
||||
// The current schema. Schema 1 records stay valid and are never rewritten (ADR-0099).
|
||||
inline constexpr std::uint32_t genome_schema_version = 2;
|
||||
inline constexpr std::uint32_t genome_schema_v1 = 1;
|
||||
// The capability table of a supported schema (1 or 2); nullptr otherwise.
|
||||
[[nodiscard]] constexpr const std::array<CapabilitySpec, capability_count>*
|
||||
capability_schema_for(std::uint32_t schema) noexcept {
|
||||
return schema == genome_schema_v1 ? &capability_schema_v1
|
||||
: schema == genome_schema_version ? &capability_schema_v2
|
||||
: nullptr;
|
||||
}
|
||||
inline constexpr std::size_t max_parents = 2;
|
||||
inline constexpr std::size_t max_genome_bytes = 256;
|
||||
|
||||
@@ -108,7 +140,7 @@ class Genome {
|
||||
return origin_event_;
|
||||
}
|
||||
[[nodiscard]] std::uint32_t schema_version() const noexcept {
|
||||
return genome_schema_version;
|
||||
return schema_version_;
|
||||
}
|
||||
[[nodiscard]] std::uint32_t development_version() const noexcept {
|
||||
return development_version_;
|
||||
@@ -124,6 +156,11 @@ class Genome {
|
||||
[[nodiscard]] bool carries(Capability kind) const noexcept;
|
||||
[[nodiscard]] std::expected<std::uint32_t, GenomeError>
|
||||
parameter(Capability kind) const noexcept;
|
||||
// A rate capability (movement, ingestion) per second, whatever the schema: a
|
||||
// schema 1 per-tick value times 20, exactly. Other capabilities are returned as
|
||||
// stored.
|
||||
[[nodiscard]] std::expected<std::uint64_t, GenomeError>
|
||||
per_second(Capability kind) const noexcept;
|
||||
// Covers identity and ancestry, so distinct origins never share a digest.
|
||||
// An integrity and deduplication aid, never a content key and never authenticity.
|
||||
[[nodiscard]] std::uint64_t content_digest() const noexcept {
|
||||
@@ -134,6 +171,7 @@ class Genome {
|
||||
private:
|
||||
Genome() = default;
|
||||
[[nodiscard]] std::vector<std::uint8_t> body() const;
|
||||
std::uint32_t schema_version_{genome_schema_v1};
|
||||
std::uint64_t id_{};
|
||||
std::uint64_t origin_event_{};
|
||||
std::uint32_t development_version_{};
|
||||
|
||||
Reference in New Issue
Block a user