feat(cellular): session v14, bundle 15 and rules-13 wildlife
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s

Session v14 carries the rules-13 revamp: a body block in the owner's view
(members, emergence threshold, exclusions, Emerge open, payable energy,
mass and the 20 traits), become, emerge and channel exclusions on actions,
become on mutation choices, catalog offers (id, chance, cost) and the
emerged ending. Older sessions never see a v14 field. The client shows
Stay / Become offspring offers named from the shared catalog, continuing
as a bud, the organism and its Emerge button, kept channels, the body and
the emerged end screen.

Bundle 15 (rules 13 on owner format 11) is durable: schema 60 admits it
raw-only, stores become as bit 15 of the choice's operator, widens the
action input and mutation results, and publishes the 14 -> 15 revamp
profile migration. evo-world-clone opens cellular-v10 (cellular-v9 plus the
revamp upgrade from --revamp-tuning), resumable and recoverable.

Wildlife counts reserve matter as energy, waits for the bud fee, grows
organisms one short of emerging, and hunts by the region step's rules-13
engulf test. The play summary adds organisms, offers and the spent pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-26 07:31:32 -04:00
co-authored by Claude Opus 5.5
parent f454e038a1
commit 4bc5d5eee7
48 changed files with 1602 additions and 174 deletions
+30 -4
View File
@@ -93,7 +93,8 @@ std::optional<std::uint64_t> applied_tick(const server::CellularBatch& trace,
if (selection.life_id == action.input.life_id &&
selection.event_index == action.input.event_index &&
selection.offer_tick == action.input.offer_tick &&
selection.operator_id == action.input.operator_id) {
selection.operator_id == action.input.operator_id &&
selection.become == action.input.become) {
if (found)
return std::nullopt;
found = trace.header.begin_tick + i + 1;
@@ -120,7 +121,10 @@ bool prepared_mutations_are_canonical(const CellularPreparedCommit& prepared,
prepared.mutations, manifest.begin_tick, manifest.end_tick);
if (!decoded || decoded->size() != selections || prepared.results.size() != selections ||
std::ranges::any_of(prepared.results, [&](std::uint8_t result) {
return cellular_plan_bundle(manifest.cellular_versions)
// Rules 13 (bundle 15): applied (an organism), life died, insufficient funding,
// declined, split applied and split refused.
return manifest.cellular_versions == cellular_v15_versions ? result == 4 || result > 6
: cellular_plan_bundle(manifest.cellular_versions)
? result != 1 && result != 3 && result != 4
: result > 3;
}))
@@ -396,6 +400,17 @@ std::expected<CommittedCheckpoint, CellularProfileMigrationFailure> migrate_cell
},
cellular_liquid_upgrade_manifest);
}
std::expected<CommittedCheckpoint, CellularProfileMigrationFailure> migrate_cellular_revamp_profile(
Postgres& db, const FilesystemObjectStore& objects, const LeaseGrant& lease,
const CommittedCheckpoint& predecessor, Uuid commit, const Sha256Digest& build,
const server::CellularRevampRules& rules, milliseconds timeout, const PublishHooks& hooks) {
return migrate_rules_profile(
db, objects, lease, predecessor, commit, build, timeout, hooks,
[rules](std::span<const std::uint8_t> payload, const CheckpointManifest& previous) {
return cellular_revamp_upgrade_payload(payload, previous, rules);
},
cellular_revamp_upgrade_manifest);
}
std::expected<CommittedCheckpoint, CellularProfileMigrationFailure>
migrate_cellular_profile_to_v2(Postgres& db, const FilesystemObjectStore& objects,
@@ -685,7 +700,9 @@ verify_cellular_no_tick_checkpoint(Postgres& db, const FilesystemObjectStore& ob
const bool inheritance = m.cellular_versions == cellular_v12_versions;
const bool photosynthesis = m.cellular_versions == cellular_v13_versions;
const bool liquid = m.cellular_versions == cellular_v14_versions;
const auto derive = liquid ? cellular_liquid_upgrade_manifest
const bool revamp = m.cellular_versions == cellular_v15_versions;
const auto derive = revamp ? cellular_revamp_upgrade_manifest
: liquid ? cellular_liquid_upgrade_manifest
: photosynthesis ? cellular_photosynthesis_upgrade_manifest
: inheritance ? cellular_inheritance_upgrade_manifest
: maturation ? cellular_maturation_upgrade_manifest
@@ -698,7 +715,16 @@ verify_cellular_no_tick_checkpoint(Postgres& db, const FilesystemObjectStore& ob
auto bytes = objects.get({source->payload_sha256, source->payload_bytes});
if (!bytes)
return fail(RecoveryError::tail);
if (liquid) {
if (revamp) {
// The declared revamp rules are the upgrade's only input: read them from the target,
// then require the source to re-derive the exact target bytes with them.
auto target = restore_cellular_payload(payload, m);
if (!target)
return fail(RecoveryError::payload);
auto upgraded = cellular_revamp_upgrade_payload(*bytes, *source, (*target)->revamp_rules());
if (!upgraded || !std::ranges::equal(*upgraded, payload))
return fail(RecoveryError::history);
} else if (liquid) {
// The declared liquid rules are the upgrade's only input: read them from the target,
// then require the source to re-derive the exact target bytes with them.
auto target = restore_cellular_payload(payload, m);
+27
View File
@@ -251,4 +251,31 @@ cellular_liquid_upgrade_payload(std::span<const std::uint8_t> payload,
return std::unexpected(CheckpointError::payload);
return (*upgraded)->snapshot();
}
std::expected<CheckpointManifest, CheckpointError>
cellular_revamp_upgrade_manifest(const CheckpointManifest& previous,
const Sha256Digest& previous_digest, Uuid commit,
const LeaseGrant& lease, const Sha256Digest& build,
std::uint64_t bytes, const Sha256Digest& digest) {
if (previous.profile != CheckpointProfile::cellular_lives_v1)
return std::unexpected(CheckpointError::unsupported);
return upgrade_manifest(previous, previous_digest, commit, lease, build, bytes, digest,
cellular_v14_versions, cellular_v15_versions);
}
std::expected<std::vector<std::uint8_t>, CheckpointError>
cellular_revamp_upgrade_payload(std::span<const std::uint8_t> payload,
const CheckpointManifest& previous,
const server::CellularRevampRules& rules) {
if (!supported(previous) || previous.profile != CheckpointProfile::cellular_lives_v1 ||
previous.cellular_versions != cellular_v14_versions)
return std::unexpected(CheckpointError::unsupported);
if (!encode_manifest(previous) || previous.sequence == 0 || previous.end_tick == 0)
return std::unexpected(CheckpointError::chain);
auto state = restore_cellular_payload(payload, previous);
if (!state)
return std::unexpected(state.error());
auto upgraded = (*state)->revamp_upgrade_candidate(rules);
if (!upgraded)
return std::unexpected(CheckpointError::payload);
return (*upgraded)->snapshot();
}
} // namespace evo::persistence
+1 -1
View File
@@ -606,7 +606,7 @@ load_cellular_mutation_publications(Postgres& db, RegionKey key, const LeaseGran
const auto action = parse_integer<std::uint64_t>(row[1]);
const auto input = unhex<34>(row[2].value_or(std::string{}));
const auto result = parse_integer<std::uint32_t>(row[3]);
if (!account || !action || *action == 0 || !input || !result || *result > 4)
if (!account || !action || *action == 0 || !input || !result || *result > 6)
return std::unexpected{malformed(false)};
publications.push_back({*account, *action, *input, static_cast<std::uint8_t>(*result)});
}