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

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:
dingo
2026-10-21 18:08:59 -04:00
co-authored by Claude Opus 5.5
parent 3f82795c18
commit d2f603b582
39 changed files with 1106 additions and 103 deletions
+67 -1
View File
@@ -110,9 +110,14 @@ void v7_reliable_action_is_stable_and_strict() {
auto malformed_input = canonical;
malformed_input[12] = 2;
CHECK(!decode_cellular_action_input(malformed_input));
// Byte 13 is a flags byte (schema 58): bit 0 brake, every other bit refused.
malformed_input = canonical;
malformed_input[13] = 1;
malformed_input[13] = 2;
CHECK(!decode_cellular_action_input(malformed_input));
auto braking_input = canonical;
braking_input[13] = 1;
const auto braking = decode_cellular_action_input(braking_input);
CHECK(braking && braking->brake && encode_cellular_action_input(*braking) == braking_input);
malformed_input = canonical;
// The canonical biological input itself requires a nonzero tick.
std::fill(malformed_input.begin(), malformed_input.begin() + 8, std::uint8_t{0});
@@ -542,6 +547,66 @@ void v12_perception_carries_light_and_producers() {
CHECK(encode_session(SessionMessage{offer}, session_protocol_v12).empty());
}
// Rules 12: v13 is v12 plus liquid motion: the owner's velocity and heading and the region's
// current configuration in its view, each deposit's world velocity, and a brake on actions.
// Earlier versions refuse every liquid field.
void v13_perception_carries_liquid_motion() {
CellularLifeDiagnostics d;
d.reserve_energy_pj = 9;
d.light_pj = 3;
d.velocity_x_q10 = -190 * 1'024;
d.velocity_y_q10 = 12;
d.heading = 49'152;
CellularPerception view{77, 7, {}, d};
CellularPerceivedDeposit bubble{9, 9'000, 400, 30, CellularDepositShape::bubble,
false, {1, 0, 0, 4, 0}};
bubble.velocity_x_um_s = -250;
bubble.velocity_y_um_s = 60;
view.deposits.push_back(bubble);
view.currents = CellularCurrentsView{5, 60'000, 60'000, 250, 2, 4, 3'000, 6'000, 60, 300};
const auto bytes = encode_session(SessionMessage{view}, session_protocol_v13);
CHECK(bytes.size() == session_header_bytes + 18 + 64 + 40 + 16 + 56 + 30);
std::uint16_t version{};
const auto decoded = decode_session(bytes, &version);
CHECK(decoded && version == session_protocol_v13 &&
std::get<CellularPerception>(*decoded) == view);
// v12 has room for none of it.
CHECK(encode_session(SessionMessage{view}, session_protocol_v12).empty());
auto still = view;
still.currents.reset();
still.diagnostics->velocity_x_q10 = still.diagnostics->velocity_y_q10 = 0;
still.diagnostics->heading = 0;
still.deposits[0].velocity_x_um_s = still.deposits[0].velocity_y_um_s = 0;
CHECK(!encode_session(SessionMessage{still}, session_protocol_v12).empty());
// A region without currents sends a v13 view with the liquid flag clear.
CHECK(std::get<CellularPerception>(*decode_session(
encode_session(SessionMessage{still}, session_protocol_v13))) == still);
// The flag is 0 or 1, the reserved byte zero, and a cleared view carries no currents.
constexpr std::size_t flags = session_header_bytes + 18 + 64 + 40 + 16 + 10;
auto bad = bytes;
bad[flags] = 2;
CHECK(!decode_session(bad));
bad = bytes;
bad[flags + 1] = 1;
CHECK(!decode_session(bad));
auto cleared = still;
cleared.life_identity = 0;
cleared.diagnostics.reset();
cleared.deposits.clear();
cleared.currents = view.currents;
CHECK(encode_session(SessionMessage{cleared}, session_protocol_v13).empty());
// A brake travels only on v13 actions.
CellularAction braking{1, 2, 3, 4, 500, 0, false, 0, 0};
braking.brake = true;
const auto action = encode_session(SessionMessage{braking}, session_protocol_v13);
CHECK(std::get<CellularAction>(*decode_session(action)) == braking);
auto old_brake = encode_session(SessionMessage{CellularAction{1, 2, 3, 4, 500, 0, false, 0, 0}},
session_protocol_v12);
old_brake[session_header_bytes + 37] = 1;
CHECK(!decode_session(old_brake));
}
int main() {
try {
round_trip_and_version_gate();
@@ -556,6 +621,7 @@ int main() {
v10_effects_and_life_end_are_owner_only();
v11_perception_carries_deposits();
v12_perception_carries_light_and_producers();
v13_perception_carries_liquid_motion();
std::puts(
"PASS cellular protocol: v6 intention, v7 action, v8-v10 perception/action framing");
} catch (const std::exception& error) {