ADR 0127
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-15 09:32:51 -04:00
parent 0a0f6c3bb1
commit 817a830a8a
20 changed files with 474 additions and 28 deletions
+46 -1
View File
@@ -107,6 +107,12 @@ void cellular_assistance() {
CHECK(!steer_cellular(controls, {}, &view, &population, {}).patch);
view.patches[0].matter_fg[2] = 1;
CHECK(steer_cellular(controls, {}, &view, &population, {}).patch);
view.patches.push_back({0, 2000, 100, {}});
CHECK(steer_cellular(controls, {}, &view, &population, {}).patch ==
std::pair<std::uint32_t, std::uint32_t>{0, 2000});
view.patches.back().energy_pj = 0;
CHECK(steer_cellular(controls, {}, &view, &population, {}).patch ==
std::pair<std::uint32_t, std::uint32_t>{1000, 2000});
view.life_identity = 0;
CHECK(!steer_cellular(controls, {}, &view, &population, {}).patch);
network::CellularOfferedCandidate candidate;
@@ -122,7 +128,7 @@ void cellular_assistance() {
reserve.reserve_energy_pj = 9;
CHECK(!can_fund(candidate, reserve));
std::vector<render::Rectangle> scene;
patch_box(scene, {-10, 100}, {100, -10}, true, true, 80, 80);
patch_box(scene, {0, 80}, {80, 0}, true, true, true, 80, 80);
CHECK(scene.size() == patch_rectangles);
for (const auto& r : scene)
CHECK(r.x >= 0 && r.y >= 0 && r.x + r.width <= 80 && r.y + r.height <= 80);
@@ -465,6 +471,44 @@ void cellular_play() {
exhausted.initialize(std::numeric_limits<std::uint64_t>::max());
CHECK(exhausted.allocate_id() == 0 && exhausted.allocate_id() == 0);
}
void cellular_energy_and_birth_wait() {
using namespace evo::client_app;
using namespace evo::network;
CellularPlay play;
play.initialize(1);
play.connected();
CHECK(!play.can_restart());
play.birth({1, PrimitiveLifeResult::pending, 7, 0});
CHECK(!play.can_restart());
play.birth({1, PrimitiveLifeResult::insufficient_funding, 7, 0});
CHECK(!play.fresh() && play.can_restart()); // Refusal arrives without any world view.
CHECK(play.restart() && play.birth_request() == 2 && !play.restart());
play.birth({1, PrimitiveLifeResult::no_placement, 7, 0});
CHECK(play.birth_pending()); // Delayed answer to an older request is ignored.
play.birth({2, PrimitiveLifeResult::existing_life, 9, 0});
CHECK(!play.can_restart()); // Wait for that existing life instead of offering another birth.
CellularLifeDiagnostics d;
d.reserve_energy_pj = 200;
play.observe({10, 9, {}, d});
CHECK(!play.energy_change());
play.observe({11, 0, {}, {}}); // The bridge may clear a view before sending its replacement.
d.reserve_energy_pj = 150;
play.observe({11, 9, {}, d});
CHECK(required(play.energy_change()).falling && required(play.energy_change()).amount == 50);
play.observe({11, 9, {}, d});
CHECK(required(play.energy_change()).amount == 50); // Duplicate views retain the change.
d.reserve_energy_pj = 175;
play.observe({15, 9, {}, d});
CHECK(!required(play.energy_change()).falling && required(play.energy_change()).amount == 25 &&
required(play.energy_change()).from_tick == 11);
play.disconnected();
CHECK(!play.energy_change());
play.connected();
play.observe({16, 9, {}, d});
CHECK(!play.energy_change());
play.observe({17, 10, {}, d});
CHECK(!play.energy_change()); // A different life starts a new baseline.
}
} // namespace
int main() try {
@@ -474,6 +518,7 @@ int main() try {
outcome_log();
session_host();
cellular_play();
cellular_energy_and_birth_wait();
cellular_assistance();
std::puts("client UI model tests passed");
return 0;