feat(cellular): region ticks of up to 4,096 lives for testing (schema 68)
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / postgres-tools (push) Successful in 31s
Foundation / server-image (push) Successful in 4m29s
Foundation / image (push) Successful in 5m43s

ADR-0182 section 17. The plan's 2,000-organism cap became the rules-12
key region.organism_cap, which was parsed but never enforced; the real
bound was max_cellular_tick_lives = 256 (ADR-0106), which rules 13's
organism cap could not exceed. The bound is now 4,096, for testing limits
only; the DEV tuning file keeps 256.

- max_cellular_tick_lives (4,096) bounds the raw region path: step, owner
  state, batch trace (cellular_batch_bytes_for) and current checkpoint
  traces. max_cellular_frozen_lives (256) keeps cohort populations,
  population batches, migration traces and pre-v3 cellular traces, whose
  database checks are fixed.
- Tuning: reproduction.organism_cap and wildlife_cap accept up to 4,096.
- Schema 68: the trace checker under the current publishers
  (cellular_births_v45) accepts 4,096 intents, births and mutations per
  tick; spawn_wildlife takes up to 256 cells a command.
- Region view and portal: the lineage archive's fill (births of 65,536,
  genomes of 4,096), at which a region stops ticking.
- PostgreSQL suite: 256 wildlife spawned in one command, then a 289-life
  tick published and recovered exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-28 17:30:22 -04:00
co-authored by Claude Opus 5.5
parent 8005e7c4ae
commit 3c753970c8
29 changed files with 301 additions and 49 deletions
+5 -1
View File
@@ -12,7 +12,11 @@
#include <vector>
namespace evo::biology {
inline constexpr std::size_t max_cellular_tick_lives = 256;
// Lives one region tick may hold (ADR-0182 section 17: 4,096 for testing; regions run far
// fewer). Formats frozen at the original 256 (cohort populations, migration traces and the
// pre-v3 cellular traces) keep max_cellular_frozen_lives.
inline constexpr std::size_t max_cellular_tick_lives = 4'096;
inline constexpr std::size_t max_cellular_frozen_lives = 256;
// ADR-0124 (rules 3): a predator needs total mass >= ratio x prey total mass, with the
// ratio in thousandths per micrometre of prey membrane (tunable; 1.5 for 1 um).
@@ -89,13 +89,17 @@ inline constexpr std::size_t cellular_batch_mutation_bytes = 40;
inline constexpr std::size_t cellular_batch_admin_bytes = 64;
inline constexpr std::size_t max_cellular_tick_admin_commands = 16;
inline constexpr std::size_t max_cellular_batch_ticks = 64;
// The largest trace of a batch whose ticks hold at most `lives` lives.
[[nodiscard]] constexpr std::size_t cellular_batch_bytes_for(std::size_t lives) noexcept {
return cellular_batch_header_bytes +
max_cellular_batch_ticks *
(cellular_batch_tick_header_bytes +
lives * (cellular_batch_intent_bytes + cellular_batch_birth_bytes +
cellular_batch_mutation_bytes) +
max_cellular_tick_admin_commands * cellular_batch_admin_bytes);
}
inline constexpr std::size_t max_cellular_batch_bytes =
cellular_batch_header_bytes +
max_cellular_batch_ticks * (cellular_batch_tick_header_bytes +
biology::max_cellular_tick_lives *
(cellular_batch_intent_bytes + cellular_batch_birth_bytes +
cellular_batch_mutation_bytes) +
max_cellular_tick_admin_commands * cellular_batch_admin_bytes);
cellular_batch_bytes_for(biology::max_cellular_tick_lives);
enum class CellularBatchError : std::uint8_t { format, version, scope, state };
inline constexpr std::size_t cellular_action_record_bytes = 48;
inline constexpr std::size_t max_cellular_action_records = 1'024;
@@ -191,7 +191,7 @@ enum class CellularAdminKind : std::uint8_t { // A u16 in the trace.
add_bubbles = 3, // `amount` imported as `count` (1..256) bubbles sharing it.
add_pool = 4, // `amount` imported into the spent pool.
release_pool = 5, // Up to `amount` moved from the spent pool into `count` bubbles.
spawn_wildlife = 6, // `count` (1..64) random-genome roots, identities `target`.., imported.
spawn_wildlife = 6, // `count` (1..256) random-genome roots, identities `target`.., imported.
// ADR-0182 tuning amendment: the region's rules-13 rules become tuning revision `target`,
// whose canonical rules encoding (encode_cellular_revamp_rules) has the SHA-256 held in the
// energy, carbon, nitrogen and phosphorus amounts (little-endian words; `other` zero).
@@ -30,7 +30,7 @@ struct CellularMigrationTrace {
};
inline constexpr std::size_t migration_trace_header_bytes = 256;
inline constexpr std::size_t max_migration_trace_bytes =
migration_trace_header_bytes + 8 * biology::max_cellular_tick_lives + 8;
migration_trace_header_bytes + 8 * biology::max_cellular_frozen_lives + 8;
struct RecordedCellularMigration {
CellularMigrationTrace trace;
CellularMigrationExecution execution;
@@ -33,9 +33,9 @@ struct CellularTierPolicy {
};
inline constexpr std::size_t cellular_population_header_bytes = 80;
inline constexpr std::uint32_t cellular_population_inheritance_format = 3;
inline constexpr std::size_t max_cellular_population_bytes = cellular_population_header_bytes +
16 * biology::max_cellular_tick_lives +
max_cellular_lives_bytes + 8;
inline constexpr std::size_t max_cellular_population_bytes =
cellular_population_header_bytes + 16 * biology::max_cellular_frozen_lives +
max_cellular_lives_bytes + 8;
class CellularPopulation {
public:
@@ -26,8 +26,8 @@ struct CellularPopulationBatch {
};
inline constexpr std::size_t population_batch_header_bytes = 136;
inline constexpr std::size_t max_population_batch_bytes =
population_batch_header_bytes + max_cellular_batch_bytes +
max_cellular_batch_ticks * (16 + 16 * biology::max_cellular_tick_lives);
population_batch_header_bytes + cellular_batch_bytes_for(biology::max_cellular_frozen_lives) +
max_cellular_batch_ticks * (16 + 16 * biology::max_cellular_frozen_lives);
struct CellularPopulationExecution {
CellularPopulationBatch batch;
std::unique_ptr<CellularPopulation> state;