feat: durable liquid regions (bundle 14, schema 58), cellular-v9 and session v13
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m25s
Foundation / postgres-tools (push) Successful in 1m12s
Foundation / server-image (push) Successful in 4m20s
Foundation / image (push) Successful in 4m54s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m25s
Foundation / postgres-tools (push) Successful in 1m12s
Foundation / server-image (push) Successful in 4m20s
Foundation / image (push) Successful in 4m54s
ADR-0178. Bundle 14 (rules 12 on owner format 10) is admitted by schema 58 through parser-local normalization to bundle 13, with an exact fenced 13 -> 14 upgrade whose only input, the liquid rules, recovery reads from the target. Schema 58 also widens the canonical action input: byte 13 bit 0 is brake. evo-world-clone gains the cellular-v9 opening: cellular-v8 followed by the liquid upgrade from --tuning FILE (region size must match) and an optional --current-seed; resumable and idempotent at bundle 14. Session v13 adds the owner's velocity, heading and the region's current configuration to its perception, each deposit's world velocity, and a brake on cellular actions; older sessions keep their layouts. A rules-12 server lists every pool and the nearest 256 moving bubbles. The client speaks v13, brakes on Space (rebindable; older controls files take the default), draws currents as drifting streaks and carries bubbles along their velocities between perceptions. Tests: protocol v13 round trips and refusals, action-input brake, controls files, and a PostgreSQL cellular-v9 provisioning test whose player is born, swims and brakes through the live host. Full local PostgreSQL qualification, the Linux debug suite and the Windows client suite pass. Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// the object volume's free-space reserve, a genuinely failing write, the
|
||||
// check-store probe (retention across runs, missing-volume refusal, privilege
|
||||
// boundary) and a server whose volume is full. Run by tools/ci/postgres-check.sh.
|
||||
#include "evo/biology/cellular_tuning.hpp"
|
||||
#include "evo/persistence/account_control_store.hpp"
|
||||
#include "evo/persistence/checkpoint_store.hpp"
|
||||
#include "evo/persistence/region_checkpoint.hpp"
|
||||
@@ -13,6 +14,7 @@
|
||||
#include "fixtures/server_process.hpp"
|
||||
#include <algorithm>
|
||||
#include <csignal>
|
||||
#include <fstream>
|
||||
#include <source_location>
|
||||
#include <sys/resource.h>
|
||||
|
||||
@@ -753,6 +755,126 @@ void cellular_v8_provisioning_declares_light() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Rules 12 (ADR-0177): cellular-v9 is cellular-v8 followed by the 13 -> 14 liquid upgrade from
|
||||
// the Git tuning file, whose region size must match the opening; resumable and idempotent.
|
||||
void cellular_v9_provisioning_declares_liquid() {
|
||||
const ServerRegion r{{9777, 1}, fresh("cellular-v9-provision-9777")};
|
||||
const std::string build(64, 'e');
|
||||
const std::string commit = "b0b81e5c0f7e1d2ba1a0ce5c0f7e1d2e"; // Unique to this test.
|
||||
const std::string motes = "40,1,2000000,50000,20000,0,0";
|
||||
const auto write_tuning = [&](std::uint32_t side) {
|
||||
auto parsed = evo::biology::parse_cellular_tuning(
|
||||
"tuning.version = 1\nregion.width_um = 60000\nregion.height_um = 60000\n"
|
||||
"region.organism_cap = 2000\nregion.deposit_limit = 8192\n"
|
||||
"region.perception_radius_um = 5000\nfounder.thrust_um_per_s2 = 400\n"
|
||||
"founder.reverse_thrust_um_per_s2 = 400\nfounder.drag_ppm_per_tick = 95163\n"
|
||||
"founder.lateral_drag_ppm_per_tick = 95163\nfounder.turn_heading_per_s = 65536\n"
|
||||
"currents.min_count = 2\ncurrents.max_count = 4\ncurrents.min_width_um = 3000\n"
|
||||
"currents.max_width_um = 6000\ncurrents.min_speed_um_per_s = 60\n"
|
||||
"currents.max_speed_um_per_s = 300\ncurrents.grid_pitch_um = 250\n"
|
||||
"food.merged_bubble_cap_multiple = 8\nfood.visible_moving_bubbles = 256\n"
|
||||
"food.induced_drift_radius_um = 200\nfood.induced_drift_max_um_per_s = 100\n"
|
||||
"food.induced_drift_decay_ppm_per_tick = 95163\nthermal.ambient_min_mk = 278150\n"
|
||||
"thermal.ambient_max_mk = 313150\nfounder.preferred_mk = 293150\n"
|
||||
"founder.comfort_band_mk = 5000\nfounder.body_tau_ms = 20000\n"
|
||||
"founder.lethal_cold_mk = 273150\nfounder.lethal_heat_mk = 318150\n"
|
||||
"thermal.off_preference_per_mille_per_k = 80\n"
|
||||
"thermal.transition_per_mille_per_k = 40\nthermal.multiplier_cap_per_mille = 8000\n"
|
||||
"lifecycle.logout_delay_ms = 10000\nmutation.step_points = 5\n"
|
||||
"mutation.paired_points = 2\nmutation.recovery_floor_per_mille = 100\n"
|
||||
"mutation.offer_interval_ms = 25000\nmutation.offer_options = 3\n");
|
||||
CHECK(parsed);
|
||||
parsed->region_width_um = parsed->region_height_um = side;
|
||||
const auto path = r.root / ("cellular-" + std::to_string(side) + ".tuning");
|
||||
std::ofstream{path, std::ios::binary} << evo::biology::encode_cellular_tuning(*parsed);
|
||||
return path.string();
|
||||
};
|
||||
int code = -1;
|
||||
provision_cellular(r, "9777", "cellular-v9", build, commit, motes, code, "--motes",
|
||||
{"--light-pj", "40"});
|
||||
CHECK(code != 0); // cellular-v9 requires --tuning.
|
||||
provision_cellular(r, "9777", "cellular-v9", build, commit, motes, code, "--motes",
|
||||
{"--light-pj", "40", "--tuning", write_tuning(20'000)});
|
||||
CHECK(code != 0); // The tuning region size must match the opening's.
|
||||
const auto tuning = write_tuning(10'000);
|
||||
const auto first = provision_cellular(r, "9777", "cellular-v9", build, commit, motes, code,
|
||||
"--motes", {"--light-pj", "40", "--tuning", tuning});
|
||||
CHECK(code == 0 && has(first, "provisioned world=9777 region=1 sequence=6 tick=1"));
|
||||
const auto again = provision_cellular(r, "9777", "cellular-v9", build, commit, motes, code,
|
||||
"--motes", {"--light-pj", "40", "--tuning", tuning});
|
||||
CHECK(code == 0 && has(again, "already-provisioned world=9777 region=1 sequence=6 tick=1"));
|
||||
auto db = owner();
|
||||
const auto head = load_region_checkpoint(*db, r.key, 5s);
|
||||
CHECK(head);
|
||||
const auto manifest = decode_manifest(head->manifest);
|
||||
CHECK(manifest && manifest->cellular_versions == cellular_v14_versions &&
|
||||
manifest->history_profile == cellular_revision_history_profile);
|
||||
#ifdef EVO_POSTGRES_M10
|
||||
// A player is born on the liquid head and swims and brakes through the live server path:
|
||||
// host reservation, session batch builder, host publication with a braking trace.
|
||||
using namespace evo::server;
|
||||
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
|
||||
return Postgres::connect({env("PGHOST"),
|
||||
{},
|
||||
env("PGPORT"),
|
||||
env("PGDATABASE"),
|
||||
env("EVO_PG_RUNTIME_USER"),
|
||||
{},
|
||||
{}},
|
||||
5s);
|
||||
};
|
||||
CHECK(db->query("INSERT INTO evolution.life_allocators VALUES(9777,1000)", {}, 5s));
|
||||
Sha256Digest digest{};
|
||||
digest.fill(0xEE);
|
||||
auto objects = FilesystemObjectStore::open(r.root, r.key, max_cellular_lives_bytes);
|
||||
CHECK(objects);
|
||||
auto made =
|
||||
CellularRegionHost::create({r.key, 9, {}, digest, {digest}}, connect, std::move(*objects));
|
||||
CHECK(made);
|
||||
auto host = std::move(*made);
|
||||
CHECK(host->step().ready && host->state() &&
|
||||
host->state()->rules_version() == cellular_lives_liquid_rules &&
|
||||
host->state()->flow_field() != nullptr);
|
||||
auto runtime = connect();
|
||||
CHECK(runtime);
|
||||
Uuid account{};
|
||||
account[0] = 0x9E;
|
||||
account.back() = 0x14;
|
||||
const auto control =
|
||||
claim_account_control(**runtime, r.key, *host->authority(), account, 1, 1, 20'000ms, 5s);
|
||||
CHECK(control);
|
||||
CHECK(host->create_primitive_life(account, control->generation, 5).result ==
|
||||
evo::network::PrimitiveLifeResult::pending);
|
||||
const std::vector births(host->queued_births().begin(), host->queued_births().end());
|
||||
auto builder = CellularSessionBatchBuilder::create(*host->state(), host->committed()->head);
|
||||
CHECK(builder);
|
||||
CHECK(builder->append_with_birth_refusals(host->state()->tick() + 1, {}, {}, births, {}));
|
||||
CHECK(builder->refused_births().empty() &&
|
||||
builder->batch().format_version == cellular_batch_inheritance_format);
|
||||
CHECK(host->publish(builder->batch(), builder->actions(), builder->mutation_actions()));
|
||||
CHECK(host->query_primitive_life(account, control->generation, 5).result ==
|
||||
evo::network::PrimitiveLifeResult::born);
|
||||
// Ticks of swimming then braking publish and leave the founder in motion state.
|
||||
for (int tick = 0; tick < 6; ++tick) {
|
||||
std::vector<CellularLifeIntent> intents;
|
||||
for (const auto& life : host->state()->lives()) {
|
||||
CellularLifeIntent intent{life.identity.life, {}};
|
||||
intent.intent.movement = {1'000, 0};
|
||||
intent.intent.brake = tick >= 4;
|
||||
intents.push_back(intent);
|
||||
}
|
||||
std::ranges::sort(intents, {}, &CellularLifeIntent::life_id);
|
||||
auto next = CellularSessionBatchBuilder::create(*host->state(), host->committed()->head);
|
||||
CHECK(next && next->append(host->state()->tick() + 1, intents, {}));
|
||||
CHECK(host->publish(next->batch(), next->actions(), next->mutation_actions()));
|
||||
}
|
||||
CHECK(host->state()->lives().front().identity.genome != 0);
|
||||
const auto genome =
|
||||
host->state()->archive().find(host->state()->lives().front().identity.genome);
|
||||
CHECK(genome && genome->schema_version() == evo::biology::genome_schema_v6);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EVO_POSTGRES_M10
|
||||
// A player on a cellular-v8 region feeds by contact until offered a mutation, chooses it
|
||||
// and publishes the choice, all through the host and session builder as evo-server does.
|
||||
@@ -884,6 +1006,7 @@ void run_region_store_tests() {
|
||||
cellular_v6_provisioning_uses_the_reproduction_bundle();
|
||||
cellular_v7_provisioning_scatters_bubbles();
|
||||
cellular_v8_provisioning_declares_light();
|
||||
cellular_v9_provisioning_declares_liquid();
|
||||
#ifdef EVO_POSTGRES_M10
|
||||
cellular_v8_player_chooses_a_mutation();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user