diff --git a/deploy/kubernetes/region/dev-session-route/listener.yaml b/deploy/kubernetes/region/dev-session-route/listener.yaml index ef0074c..829248a 100644 --- a/deploy/kubernetes/region/dev-session-route/listener.yaml +++ b/deploy/kubernetes/region/dev-session-route/listener.yaml @@ -12,7 +12,7 @@ spec: env: - {name: REGION_SESSION, value: "dev"} - {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"} - - {name: REGION_SESSION_WINDOW, value: "dev-20261009T192945-09ad:1791587985"} + - {name: REGION_SESSION_WINDOW, value: "dev-20261009T204103-7a93:1791592263"} - {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"} ports: # QUIC (ADR-0090): UDP only; nothing listens on TCP 7400. diff --git a/docs/adr/0099-time-based-biological-rates.md b/docs/adr/0099-time-based-biological-rates.md index 3310037..de88fe7 100644 --- a/docs/adr/0099-time-based-biological-rates.md +++ b/docs/adr/0099-time-based-biological-rates.md @@ -126,9 +126,11 @@ contract and a versioned migration that preserves 50 ms behaviour. ## Development version 2 and the first bud (2026-10-09) The maintainer chose to set the birth-cost target now and tune it in playtests (ADR-0098 decision 7). -- **Development version 2** is defined per second. Phenotype and budget rates carry - their period (`rate_microseconds`: 50 ms for version 1, 1 s for version 2), and the - M2 fixture adapters accept only version 1. +- **Development version 2** is defined per second. The rate period follows from the + development version (`development_rate_microseconds`: 50 ms for version 1, 1 s for + version 2), and the metabolic budget carries it as `rate_microseconds`. The phenotype + stays as it was, because it is replicated unchanged on both session protocols. The M2 + fixture adapters accept only version 1. - **Its constants are tunable values, not locked rules:** - maintenance 10 and membrane upkeep 15 pJ/s per 1000 fg, a quarter of version 1's per-second equivalent; diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index 1d08638..5e1e657 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -5426,8 +5426,9 @@ Executed: ## 2026-10-09 — M11.1 development version 2 and the primitive founder (ADR-0099) -Development version 2 is defined per second. Phenotype and budget rates carry -`rate_microseconds`, and the M2 fixture adapters refuse anything but version 1. +Development version 2 is defined per second. The rate period follows from the +development version (`development_rate_microseconds`), and the budget carries it as +`rate_microseconds`. The M2 fixture adapters refuse anything but version 1. `bud_funding_seconds` and `primitive_founder` were added. `development_v2_and_the_first_bud` checks: - the hand-calculated per-second phenotype and budget; @@ -5444,3 +5445,20 @@ Executed: - clang-tidy 19: clean, after a zero-surplus guard and value reads in the test. - The 18 Postgres suites: passed. - Windows `debug`: 61/61. + +## 2026-10-09 — CI run 136 network failure: the phenotype stays wire-stable + +CI run 136 (`51cf23d`) failed `network` at the organism-view canonical re-encoding +(`network_protocol.cpp:162`). The cause was `Phenotype::rate_microseconds`, added with +development version 2. Both session protocols encode phenotypes field by field, so the +period did not survive a round trip. My local checks had not built the network presets. + +Fix: the phenotype is restored to its replicated shape. The rate period follows from +the development version (`development_rate_microseconds`), and `MetabolicBudget`, +which is not replicated, carries it. No protocol change; first-bud times unchanged. + +Executed: +- WSL `linux-debug` 61/61 and `linux-asan` 61/61. +- WSL `network-clang` 65/65 and `quic-linux` 68/68. +- clang-tidy 19: clean. +- Windows `debug` 61/61, `quic` 5/5, `client-network` 15/15. diff --git a/include/evo/biology/development.hpp b/include/evo/biology/development.hpp index c000683..acd20a6 100644 --- a/include/evo/biology/development.hpp +++ b/include/evo/biology/development.hpp @@ -25,6 +25,16 @@ inline constexpr std::uint64_t development_v1_tick_microseconds = 50'000; // Development version 2 (ADR-0099, M11.1) is defined per second: its rate constants and // its rate outputs (maintenance, movement, ingestion) are per second. inline constexpr std::uint64_t development_v2_rate_microseconds = 1'000'000; +// The period a development version's rates are per (phenotype maintenance, movement and +// ingestion; budget rates): 50 ms for version 1, one second for version 2; 0 when the +// version is unknown. Phenotypes are replicated unchanged, so the period is not a field +// of them: it follows from the genome's development version. +[[nodiscard]] constexpr std::uint64_t +development_rate_microseconds(std::uint32_t development_version) noexcept { + return development_version == 1 ? development_v1_tick_microseconds + : development_version == 2 ? development_v2_rate_microseconds + : 0; +} // Chosen constants, reviewable as a unit and selected by the genome's // development version. Declared model parameters, not balance. struct DevelopmentRules { @@ -51,9 +61,6 @@ struct Phenotype { std::uint32_t conversion_per_thousand{}; // Millikelvin beyond the genome's tolerance. A reported quantity, not a rule. std::uint32_t thermal_shortfall{}; - // The period the rates above are per: the development version's (50 ms for version - // 1, one second for version 2). A process converts with accounting::per_tick. - std::uint64_t rate_microseconds{}; auto operator<=>(const Phenotype&) const = default; }; // A proposal. It reserves nothing, pays for nothing and commits nothing; the diff --git a/include/evo/biology/metabolism.hpp b/include/evo/biology/metabolism.hpp index a90c935..cc4b885 100644 --- a/include/evo/biology/metabolism.hpp +++ b/include/evo/biology/metabolism.hpp @@ -36,7 +36,7 @@ struct ConstructionTransition { struct MetabolicBudget { Phenotype phenotype; accounting::Inventory body; // matter only; a body is not energy - // Rates are per phenotype.rate_microseconds (the development version's period). + // Rates are per rate_microseconds, the development version's period. accounting::Picojoules maintenance; // per rate period accounting::Picojoules movement; // per rate period at full speed, a capacity accounting::Picojoules demand; // maintenance plus movement @@ -45,6 +45,8 @@ struct MetabolicBudget { // Zero without the reproduction capability, rather than a default. accounting::Inventory reproduction_investment; std::uint16_t assimilation_per_thousand{}; + // The period of the rates above and of the phenotype's (development_rate_microseconds). + std::uint64_t rate_microseconds{}; auto operator<=>(const MetabolicBudget&) const = default; }; [[nodiscard]] std::expected diff --git a/src/biology/development.cpp b/src/biology/development.cpp index 471c001..8b02d70 100644 --- a/src/biology/development.cpp +++ b/src/biology/development.cpp @@ -107,12 +107,9 @@ derive_phenotype(const Genome& genome, GrowthState growth, EnvironmentState envi // Version 1 is defined in 50 ms ticks: genome rates (per second) enter it at that // quantum, rounded down as capacities (ADR-0099; exact for schema 1 records). // Version 2 is defined per second and reads them as they are. - const bool v1 = genome.development_version() == 1; - phenotype.rate_microseconds = - v1 ? development_v1_tick_microseconds : development_v2_rate_microseconds; - const auto rate_per_tick = [&](std::uint64_t per_second) { - return accounting::per_tick(per_second, phenotype.rate_microseconds, - accounting::Rounding::down); + const auto period = development_rate_microseconds(genome.development_version()); + const auto rate_per_tick = [period](std::uint64_t per_second) { + return accounting::per_tick(per_second, period, accounting::Rounding::down); }; if (genome.carries(Capability::movement)) { const auto speed = rate_per_tick(*genome.per_second(Capability::movement)); diff --git a/src/biology/metabolism.cpp b/src/biology/metabolism.cpp index 7e3141c..6ac019c 100644 --- a/src/biology/metabolism.cpp +++ b/src/biology/metabolism.cpp @@ -130,6 +130,7 @@ metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState envi } MetabolicBudget budget; budget.phenotype = *phenotype; + budget.rate_microseconds = development_rate_microseconds(genome.development_version()); budget.assimilation_per_thousand = static_cast(phenotype->conversion_per_thousand); budget.body = compose(phenotype->structural_mass, rules->structure); @@ -212,7 +213,7 @@ metabolic_budget(const Genome& genome, GrowthState growth, EnvironmentState envi std::optional bud_funding_seconds(const MetabolicBudget& budget, std::uint32_t feeding_per_thousand) noexcept { - const auto period = budget.phenotype.rate_microseconds; + const auto period = budget.rate_microseconds; if (period == 0 || accounting::microseconds_per_second % period != 0 || feeding_per_thousand == 0 || feeding_per_thousand > thousand || matter_total(budget.reproduction_investment) == 0) diff --git a/src/processes/genome_strategy.cpp b/src/processes/genome_strategy.cpp index 03b7266..521f6c3 100644 --- a/src/processes/genome_strategy.cpp +++ b/src/processes/genome_strategy.cpp @@ -10,7 +10,7 @@ consumer_for(const biology::Genome& genome, biology::GrowthState growth, } // The M2 fixtures step in tick-abstract units that match development version 1's // 50 ms rates; a per-second version would be read twenty times too fast (ADR-0099). - if (budget->phenotype.rate_microseconds != biology::development_v1_tick_microseconds) { + if (budget->rate_microseconds != biology::development_v1_tick_microseconds) { return std::unexpected{biology::DevelopmentError::unsupported_rules}; } return ConsumerConfig{opening, budget->intake_limit, budget->assimilation_per_thousand}; @@ -24,7 +24,7 @@ strategy_for(const biology::Genome& genome, biology::GrowthState growth, if (!budget) { return std::unexpected{budget.error()}; } - if (budget->phenotype.rate_microseconds != biology::development_v1_tick_microseconds) { + if (budget->rate_microseconds != biology::development_v1_tick_microseconds) { return std::unexpected{biology::DevelopmentError::unsupported_rules}; } return StrategyConfig{opening, diff --git a/tests/metabolism_tests.cpp b/tests/metabolism_tests.cpp index 968bf63..3fac5d6 100644 --- a/tests/metabolism_tests.cpp +++ b/tests/metabolism_tests.cpp @@ -479,7 +479,7 @@ void development_v2_and_the_first_bud() { const auto budget = metabolic_budget(*founder, {1000, 0}, temperate); CHECK(budget); const auto& p = budget->phenotype; - CHECK(p.rate_microseconds == 1'000'000 && p.extent == 20 && p.surface == 2400); + CHECK(budget->rate_microseconds == 1'000'000 && p.extent == 20 && p.surface == 2400); CHECK(p.membrane_mass == 2'880'000 && p.total_mass == 10'880'000); CHECK(p.maintenance == 108'800 + 43'200); // 10 and 15 pJ/s per 1000 fg. CHECK(p.movement_speed == 200 && p.ingestion_rate == 22'960); // 574000 * 2400 / 60000. @@ -498,7 +498,7 @@ void development_v2_and_the_first_bud() { CHECK(!at(0) && !at(1001)); // Version 1 rates stay per 50 ms tick, and the M2 fixtures accept only version 1. const auto v1 = metabolic_budget(build(capable()), {1000, 0}, temperate); - CHECK(v1 && v1->phenotype.rate_microseconds == 50'000); + CHECK(v1 && v1->rate_microseconds == 50'000); CHECK(!evo::processes::consumer_for(*founder, {1000, 0}, temperate, {})); CHECK(evo::processes::consumer_for(build(capable()), {1000, 0}, temperate, {})); // Without the reproduction capability there is nothing to fund.