feat(ecology): make photosynthesis regions playable on DEV
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 16m48s
Foundation / checks (network) (push) Canceled after 16m46s
Foundation / checks (postgres) (push) Canceled after 16m47s
Foundation / checks (client) (push) Canceled after 16m53s
Foundation / checks (tsan) (push) Canceled after 14m33s
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 16m48s
Foundation / checks (network) (push) Canceled after 16m46s
Foundation / checks (postgres) (push) Canceled after 16m47s
Foundation / checks (client) (push) Canceled after 16m53s
Foundation / checks (tsan) (push) Canceled after 14m33s
ADR-0176 and schema 57 admit raw cellular bundle 13 (rules 11 on owner format 9) through parser-local normalization to bundle 12, and a fenced no-tick 12 -> 13 upgrade that declares the region's light; recovery reads the light from the target and re-derives the whole target from the source. The resumable cellular-v8 opening provisions a cellular-v7 genesis, one empty tick and the durable upgrades to bundle 13. Session v12 adds the owner's captured light and the producers it can see to its perception, and lets offers name photosynthesis; older sessions keep their layouts and never receive photosynthesis candidates. The client draws chloroplasts by efficiency, shows sunlight in the HUD and offers photosynthesis cards. DEV now provisions and serves region 9 with the trial light; region 8 stays stored but unserved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,7 +89,8 @@ struct Fixture {
|
||||
};
|
||||
|
||||
// A real funded raw region with player-derived wildlife and fully suspended players.
|
||||
void funded_source(Fixture& f) {
|
||||
// `nursery` founders are funded; four are born here, so any extra stay funded for later.
|
||||
void funded_source(Fixture& f, std::uint32_t nursery = 4) {
|
||||
f.build.fill(0xE6);
|
||||
const std::array<std::string, 1> build{hexadecimal(f.build)};
|
||||
take(f.owner->query("INSERT INTO evolution.retained_builds(build_identity) VALUES($1::bytea) "
|
||||
@@ -103,7 +104,7 @@ void funded_source(Fixture& f) {
|
||||
f.objects =
|
||||
take(FilesystemObjectStore::open(variable("PGHOST"), f.key, max_cellular_environment_bytes),
|
||||
"environment object namespace");
|
||||
f.raw = opening(f.key.world - 200, true, 4, false, f.key.region);
|
||||
f.raw = opening(f.key.world - 200, true, nursery, false, f.key.region);
|
||||
f.head =
|
||||
take(provision_cellular_region(*f.owner, *f.objects, f.key, 1, *f.raw, f.id(), f.build, 5s),
|
||||
"empty cellular genesis");
|
||||
@@ -399,9 +400,98 @@ void forged_evidence(Fixture& f) {
|
||||
require(!refused && refused.error().kind == RecoveryError::tail,
|
||||
"recovery accepted forged environmental flows");
|
||||
}
|
||||
// ADR-0176: durable bundle 9 -> 10 -> 11 -> 12 -> 13 on raw profile 4, declaring light;
|
||||
// exact retry, reused-identity conflict, continued publication and recovery.
|
||||
void photosynthesis_bundle(Fixture& f) {
|
||||
f.head = take(
|
||||
migrate_cellular_boundary_profile(*f.db, *f.objects, f.lease, f.head, f.id(), f.build, 5s),
|
||||
"durable boundary upgrade");
|
||||
f.head = take(migrate_cellular_maturation_profile(*f.db, *f.objects, f.lease, f.head, f.id(),
|
||||
f.build, 5s),
|
||||
"durable maturation upgrade");
|
||||
f.head = take(migrate_cellular_inheritance_profile(*f.db, *f.objects, f.lease, f.head, f.id(),
|
||||
f.build, 5s),
|
||||
"durable inheritance upgrade");
|
||||
const auto source = f.head;
|
||||
const CellularLight light{cellular_light_trial_irradiance, 1, {1ULL << 50}};
|
||||
const auto upgrade_id = f.id();
|
||||
f.head = take(migrate_cellular_photosynthesis_profile(*f.db, *f.objects, f.lease, source,
|
||||
upgrade_id, f.build, light, 5s),
|
||||
"durable photosynthesis upgrade");
|
||||
const auto upgraded = decode_manifest(f.head.manifest).value();
|
||||
require(upgraded.cellular_versions == cellular_v13_versions &&
|
||||
upgraded.profile == CheckpointProfile::cellular_lives_v1 &&
|
||||
upgraded.begin_tick == upgraded.end_tick,
|
||||
"bundle 13 upgrade changed profile or tick");
|
||||
const auto retried =
|
||||
take(retry_cellular_profile_migration(*f.db, {f.key, upgrade_id, f.head.manifest}, 5s),
|
||||
"exact photosynthesis upgrade retry");
|
||||
require(retried.head == f.head.head, "photosynthesis upgrade retry changed its receipt");
|
||||
const auto conflicting = migrate_cellular_photosynthesis_profile(
|
||||
*f.db, *f.objects, f.lease, source, upgrade_id, f.build,
|
||||
{light.numerator * 2, 1, {1ULL << 50}}, 5s);
|
||||
require(!conflicting && conflicting.error().kind == PublicationError::rejected,
|
||||
"photosynthesis upgrade identity reused with other light");
|
||||
const auto builds = f.builds();
|
||||
auto recovered =
|
||||
take(recover_cellular_checkpoint(*f.db, *f.objects, f.key, f.lease, builds, 5s),
|
||||
"bundle 13 recovery");
|
||||
require(recovered.state->rules_version() == cellular_lives_photosynthesis_rules &&
|
||||
recovered.state->format_version() == cellular_lives_light_format &&
|
||||
recovered.state->light() == light,
|
||||
"recovered region lost its rules or light");
|
||||
// An unattended raw interval continues on bundle 13 and recovers exactly.
|
||||
auto inputs = take(unattended_population_inputs(*recovered.state, f.header(64)),
|
||||
"bundle 13 interval inputs");
|
||||
auto next = take(replay_cellular_batch(*recovered.state, inputs), "bundle 13 interval");
|
||||
f.head = take(publish_cellular_batch(*f.db, *f.objects, f.lease, f.head, inputs, *next, f.id(),
|
||||
f.build, 5s),
|
||||
"bundle 13 interval publication")
|
||||
.committed;
|
||||
auto again = take(recover_cellular_checkpoint(*f.db, *f.objects, f.key, f.lease, builds, 5s),
|
||||
"bundle 13 interval recovery");
|
||||
require(again.state->snapshot() == next->snapshot(), "bundle 13 interval recovery diverged");
|
||||
// A funded birth on bundle 13 is founder 4 (genome schema 5), through the same journals.
|
||||
Uuid account{};
|
||||
account[0] = 0xE6;
|
||||
account.back() = 9;
|
||||
const auto control =
|
||||
take(claim_account_control(*f.db, f.key, f.lease, account, 1, 9, 60000ms, 5s),
|
||||
"bundle 13 account control");
|
||||
const auto reserved =
|
||||
take(reserve_primitive_life(*f.db, f.key, f.lease, account, control.generation, 1, 1, 5s),
|
||||
"bundle 13 funded reservation");
|
||||
auto birth = take(unattended_population_inputs(*again.state, f.header(1)), "birth tick");
|
||||
birth.ticks.front().births.push_back({account, 1, control.generation, reserved.identity});
|
||||
auto born = take(replay_cellular_batch(*again.state, birth), "bundle 13 birth");
|
||||
f.head = take(publish_cellular_batch(*f.db, *f.objects, f.lease, f.head, birth, *born, f.id(),
|
||||
f.build, 5s),
|
||||
"bundle 13 birth publication")
|
||||
.committed;
|
||||
auto with_birth =
|
||||
take(recover_cellular_checkpoint(*f.db, *f.objects, f.key, f.lease, builds, 5s),
|
||||
"bundle 13 birth recovery");
|
||||
const auto life = std::ranges::find(with_birth.state->lives(), reserved.identity,
|
||||
[](const auto& l) { return l.identity.life; });
|
||||
require(life != with_birth.state->lives().end(), "bundle 13 birth missing after recovery");
|
||||
const auto genome = with_birth.state->archive().find(life->identity.genome);
|
||||
require(genome && genome->schema_version() == biology::genome_schema_v5 &&
|
||||
with_birth.state->snapshot() == born->snapshot(),
|
||||
"bundle 13 birth is not founder 4 or recovery diverged");
|
||||
std::printf("photosynthesis bundle: head %llu at tick %llu\n",
|
||||
static_cast<unsigned long long>(f.head.head.sequence),
|
||||
static_cast<unsigned long long>(f.head.head.end_tick));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void run_environment_publication_tests() {
|
||||
{
|
||||
Fixture producer;
|
||||
producer.key = {30412, 1};
|
||||
producer.next_id = 4096; // Commit IDs are unique across every region.
|
||||
funded_source(producer, 5);
|
||||
photosynthesis_bundle(producer);
|
||||
}
|
||||
Fixture fixture;
|
||||
funded_source(fixture);
|
||||
joint_profile(fixture);
|
||||
|
||||
Reference in New Issue
Block a user