From bda1631ded60ad3baa3a63abc306315ae110772a Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 15 Oct 2026 13:02:43 -0400 Subject: [PATCH] Finish birth refusal integration and stabilize client panel checks --- apps/evo-client/panels.cpp | 74 ++++++++++++++------------ apps/evo-server/main.cpp | 10 ++-- cmake/ClientProbe.cmake | 3 ++ docs/engineering/CLIENT_UI_STATE.md | 2 +- docs/engineering/VALIDATION.md | 38 +++++++++++++ tests/cellular_session_batch_tests.cpp | 6 ++- tests/client_panels.cpp | 12 +++-- tests/client_remote_session.cpp | 7 +++ 8 files changed, 108 insertions(+), 44 deletions(-) diff --git a/apps/evo-client/panels.cpp b/apps/evo-client/panels.cpp index 71f7015..271516f 100644 --- a/apps/evo-client/panels.cpp +++ b/apps/evo-client/panels.cpp @@ -635,16 +635,17 @@ void cell_vitals(const PanelView& v) { void cell_food(const PanelView& v, PanelActions& a, FormBuffers& form) { ImGui::TextColored(green, "FEED & SURVIVE"); ImGui::Checkbox("Feed automatically", &form.cellular_controls.auto_feed); - ImGui::Checkbox("Slow near food", &form.cellular_controls.slow_near_food); - ImGui::Checkbox("Precision steering (20%)", &form.cellular_controls.precision); - ImGui::SetNextItemWidth(-1); - ImGui::SliderInt("##speed", &form.cellular_controls.speed_percent, 1, 100, "Speed: %d%%"); - disabled_wrapped( - "Map key: gold E = energy, teal M = matter; no letters = empty (zoom in to " - "see letters). Auto feed prefers energy in contact. Choose a patch for manual feeding."); - disabled_wrapped("Patch stock is finite and shared. Matter does not replenish energy. Uptake " - "is limited by your cell; stock is not a promise of gain each tick. Upkeep is " - "paid before feeding."); + disabled_wrapped("Map: gold E = energy / teal M = matter. Zoom in to read markers."); + if (ImGui::CollapsingHeader("Steering assistance")) { + ImGui::Checkbox("Slow near food", &form.cellular_controls.slow_near_food); + ImGui::Checkbox("Precision steering (20%)", &form.cellular_controls.precision); + ImGui::SetNextItemWidth(-1); + ImGui::SliderInt("##speed", &form.cellular_controls.speed_percent, 1, 100, "Speed: %d%%"); + } + if (ImGui::CollapsingHeader("Feeding & energy explained")) + disabled_wrapped("Patch stock is finite and shared. Matter does not replenish energy. " + "Uptake is limited by your cell and upkeep is paid before feeding. " + "Auto feed prefers energy in contact. Choose a patch for manual feeding."); const bool active = v.cellular_play && v.cellular_play->fresh() && v.cellular_play->life() != 0; ImGui::BeginDisabled(!active); if (v.cellular_feed_target && ImGui::Button("Stop feeding", {-1, 0})) @@ -652,30 +653,35 @@ void cell_food(const PanelView& v, PanelActions& a, FormBuffers& form) { if (const auto* p = v.cellular_perception) { if (p->patches.empty()) disabled_wrapped("No food is visible within sensor range."); - for (const auto& patch : p->patches) { - ImGui::PushID(static_cast(patch.x_um)); - ImGui::PushID(static_cast(patch.y_um)); - ImGui::Separator(); - ImGui::Text("Patch %u / %u um", patch.x_um, patch.y_um); - const bool has_matter = - std::ranges::any_of(patch.matter_fg, [](auto amount) { return amount != 0; }); - ImGui::TextColored(patch.energy_pj != 0 ? amber : green, "%s", - patch.energy_pj != 0 ? "E ENERGY AVAILABLE" - : has_matter ? "M MATTER ONLY / NO ENERGY" - : "EMPTY / DEPLETED"); - ImGui::Text("Energy stock: %llu pJ", static_cast(patch.energy_pj)); - ImGui::TextWrapped("C %llu / N %llu / P %llu / other %llu fg", - static_cast(patch.matter_fg[0]), - static_cast(patch.matter_fg[1]), - static_cast(patch.matter_fg[2]), - static_cast(patch.matter_fg[3])); - const bool selected = v.cellular_feed_target == std::pair{patch.x_um, patch.y_um}; - if (selected) - ImGui::TextColored(green, "FEEDING TARGET"); - else if (ImGui::Button("Feed here", {-1, 0})) - a.feed_patch = {patch.x_um, patch.y_um}; - ImGui::PopID(); - ImGui::PopID(); + for (const bool target_first : {true, false}) { + for (const auto& patch : p->patches) { + const bool selected = v.cellular_feed_target == std::pair{patch.x_um, patch.y_um}; + if (selected != target_first) + continue; + ImGui::PushID(static_cast(patch.x_um)); + ImGui::PushID(static_cast(patch.y_um)); + ImGui::Separator(); + ImGui::Text("Patch %u / %u um", patch.x_um, patch.y_um); + const bool has_matter = + std::ranges::any_of(patch.matter_fg, [](auto amount) { return amount != 0; }); + ImGui::TextColored(patch.energy_pj != 0 ? amber : green, "%s", + patch.energy_pj != 0 ? "E ENERGY AVAILABLE" + : has_matter ? "M MATTER ONLY / NO ENERGY" + : "EMPTY / DEPLETED"); + ImGui::Text("Energy stock: %llu pJ", + static_cast(patch.energy_pj)); + ImGui::TextWrapped("C %llu / N %llu / P %llu / other %llu fg", + static_cast(patch.matter_fg[0]), + static_cast(patch.matter_fg[1]), + static_cast(patch.matter_fg[2]), + static_cast(patch.matter_fg[3])); + if (selected) + ImGui::TextColored(green, "FEEDING TARGET"); + else if (ImGui::Button("Feed here", {-1, 0})) + a.feed_patch = {patch.x_um, patch.y_um}; + ImGui::PopID(); + ImGui::PopID(); + } } } ImGui::EndDisabled(); diff --git a/apps/evo-server/main.cpp b/apps/evo-server/main.cpp index 2523d56..298864f 100644 --- a/apps/evo-server/main.cpp +++ b/apps/evo-server/main.cpp @@ -1097,8 +1097,8 @@ int serve_cellular(Options& o) { if (!builder) { bridge->dropped(actions, true); } else { - auto appended = builder->append(tick, baseline, actions, held_births, - host.queued_mutations()); + auto appended = builder->append_with_birth_refusals( + tick, baseline, actions, held_births, host.queued_mutations()); if (!appended && !actions.empty()) { // ADR-0127: one account's unusable action (its life died, or it // names an unperceived patch) refuses only that action, never the @@ -1112,8 +1112,8 @@ int serve_cellular(Options& o) { .push_back(action); bridge->dropped(refused, true); actions = std::move(usable); - appended = builder->append(tick, baseline, actions, held_births, - host.queued_mutations()); + appended = builder->append_with_birth_refusals( + tick, baseline, actions, held_births, host.queued_mutations()); } if (!appended) { bridge->dropped(actions, true); @@ -1122,6 +1122,8 @@ int serve_cellular(Options& o) { actions.end()); auto published = host.publish(builder->batch(), builder->actions(), builder->mutation_actions()); + if (published) + host.refuse_births(builder->refused_births()); if (!published && host.status().phase != server::HostPhase::resolving) { bridge->dropped(actions, true); std::erase_if(awaiting_outcomes, [&](const auto& action) { diff --git a/cmake/ClientProbe.cmake b/cmake/ClientProbe.cmake index 01ef675..ee54274 100644 --- a/cmake/ClientProbe.cmake +++ b/cmake/ClientProbe.cmake @@ -141,6 +141,9 @@ if(EVO_BUILD_CLIENT) add_test(NAME client-init-failure COMMAND evo-client --frames 1) set_tests_properties(client-lifecycle client-panels client-smoke PROPERTIES ENVIRONMENT "SDL_VIDEO_DRIVER=dummy" TIMEOUT 30 LABELS "client") + # Multiple layouts and real software-rendered widget interactions, including + # disabled buttons. This is a correctness gate, not a runner speed benchmark. + set_tests_properties(client-panels PROPERTIES TIMEOUT 120) set_tests_properties(client-init-failure PROPERTIES ENVIRONMENT "SDL_VIDEO_DRIVER=evo-invalid" WILL_FAIL TRUE TIMEOUT 20 LABELS "client") endif() diff --git a/docs/engineering/CLIENT_UI_STATE.md b/docs/engineering/CLIENT_UI_STATE.md index 630df96..3ed53e5 100644 --- a/docs/engineering/CLIENT_UI_STATE.md +++ b/docs/engineering/CLIENT_UI_STATE.md @@ -21,7 +21,7 @@ change. UI does not infer action success from a receipt, empty view or vanished `cellular_controls.hpp` selects only stocked patches in observed contact, scales movement intentions for speed/precision/food assistance, and compares every mutation cost channel with the displayed reserve. `cellular_scene.hpp` renders each patch -in at most three clipped rectangles; the application reserves that worst-case +in at most eleven clipped rectangles (border, inset, energy/matter letters); the application reserves that worst-case budget before drawing organisms. No dependency or simulation rule changes. The v10 panels consume this state and return actions; the app owns session sends. diff --git a/docs/engineering/VALIDATION.md b/docs/engineering/VALIDATION.md index fa0f3f9..60b48f5 100644 --- a/docs/engineering/VALIDATION.md +++ b/docs/engineering/VALIDATION.md @@ -7572,3 +7572,41 @@ Limits: no live Keycloak token was exercised yet. DEV deployment waits for: - the image promotion; - the out-of-band Secrets `aevolution-grant-issuer` and `aevolution-grant-broker-pg`; - the Ingress for `grants.aeternalisgames.com`. + +## 2026-10-15 — finish food/restart fixes and repair client CI timeout + +The supplied CI log compiled successfully and passed 12/13 client-probe checks; +`client-panels` hit its old 30-second timeout. Its cellular click scan now uses +half-frame spacing, which still crosses every button, and the correctness gate +allows 120 seconds for software rendering/sanitizers. Disabled/duplicate actions +remain covered. The optional screenshot rehearsal now settles tab-click events +and restores its mutation offer after resetting the energy baseline. A missing +action ledger in the new no-view birth fixture is supplied explicitly. + +The food panel prioritizes the current target and collapses steering/help text, +so energy and matter stocks are visible without a wall of instructions. The +server scheduler call sites omitted from commit 817a830 now use the validated +birth-refusal builder and record refusals after confirmed publication. + +Executed locally: +- Windows MSVC Release/NDEBUG client-package gate: 17/17, 117.72 s. +- Clang 19 Release client UI model, panels, real QUIC remote session and cellular + session batching: 4/4, 35.67 s; panels 6.06 s (previously about 11.5 s locally). +- Clang 19 ASan/UBSan UI model and panels: 2/2, 13.87 s; cellular batch regression + also passed under ASan/UBSan. +- Before the independent Keycloak commits, the isolated PostgreSQL C++ suite + passed with the birth-host regression in Release (422 s total) and ASan/UBSan + (250 s total). Current server/scheduler rebuilt against the new HEAD and its + batching regression passed. No live database was used. +- Production panels rendered and inspected at 640x480, 960x640 and 1280x800 in + build/food-review, including energy-free targets and the death screen. +- Clang 19 static analysis passed for the server integration with public-header + filtering and for the client/model/session sources. An expanded app-server + header scan additionally found five pre-existing findings in cellular_bridge, + m10_bridge and session_bridge; those unrelated helpers were not changed. + +Limits: live DEV logs were unavailable (no configured kubectl context). The +nursery stall is reproduced locally, not confirmed as this player's precise live +refusal. This gate changes neither nursery resources nor simulation/replay rules. +No deployment or World0 operation ran. Authentication is a following gate under +ADR-0131. The unrelated deployment edit and untracked files were preserved. diff --git a/tests/cellular_session_batch_tests.cpp b/tests/cellular_session_batch_tests.cpp index 5a0798c..1c49c33 100644 --- a/tests/cellular_session_batch_tests.cpp +++ b/tests/cellular_session_batch_tests.cpp @@ -218,10 +218,12 @@ void durable_mutation_reservations_bind_to_the_exact_offer() { auto revision_owner = owner.migrate_to_v3(); CHECK(revision_owner); const auto offer = (*revision_owner)->mutation_offer(life_id); - CHECK(offer && *offer && !(*offer)->candidates.empty()); + CHECK(offer && offer->has_value()); + const auto offered_candidates = offer->value_or(biology::MutationOffer{}); + CHECK(!offered_candidates.candidates.empty()); const auto& live = (*revision_owner)->lives()[0]; const auto action_tick = (*revision_owner)->tick() + 1; - const auto& candidate = (*offer)->candidates.front(); + const auto& candidate = offered_candidates.candidates.front(); persistence::CellularMutationReservation reservation; reservation.account = live.account; reservation.action_id = 42; diff --git a/tests/client_panels.cpp b/tests/client_panels.cpp index c82a1b3..efd406a 100644 --- a/tests/client_panels.cpp +++ b/tests/client_panels.cpp @@ -378,8 +378,8 @@ void cellular_panels(const std::filesystem::path& review) { camera->world_to_screen({static_cast(x), static_cast(y)}); const auto high = camera->world_to_screen({x + 1.0, y + 1.0}); CHECK(low && high); - patch_box(boxes, *low, *high, (x + y) % 4 != 0, (x + y) % 3 != 0, x == 2 && y == 3, - width, height); + patch_box(boxes, *low, *high, (x + y) % 4 != 0 && !(x == 2 && y == 3), + (x + y) % 3 != 0, x == 2 && y == 3, width, height); } OrganismCell organism; organism.id = 901; @@ -494,10 +494,12 @@ void cellular_panels(const std::filesystem::path& review) { (review / ("cellular-food-" + std::to_string(width) + ".bmp")).string())); draw(); choose_tab("Cell"); + const auto saved_offer = play.offer(); play.disconnected(); play.connected(); ++perception.tick; play.observe(perception); + play.observe_offer(saved_offer); view.cellular_feed_target.reset(); for (int i = 0; i < 3; ++i) draw(); @@ -511,7 +513,11 @@ void cellular_panels(const std::filesystem::path& review) { // Click the first production choice. Pointer ownership prevents world selection. const auto probe = [&](const ImGuiWindow* panel, float x_fraction, const auto& done) { const float x = panel->Pos.x + panel->Size.x * x_fraction; - for (int offset = 90; static_cast(offset) < panel->Size.y - 10; offset += 5) { + // Every button is at least a frame high. Half-frame spacing still hits + // each button, including disabled ones, without rendering every five pixels. + const int stride = std::max(1, static_cast(ImGui::GetFrameHeight() / 2)); + for (int offset = 90; static_cast(offset) < panel->Size.y - 10; + offset += stride) { const float y = panel->Pos.y + static_cast(offset); mouse(id, SDL_EVENT_MOUSE_MOTION, x, y); mouse(id, SDL_EVENT_MOUSE_BUTTON_DOWN, x, y); diff --git a/tests/client_remote_session.cpp b/tests/client_remote_session.cpp index 1f1640c..ebbc045 100644 --- a/tests/client_remote_session.cpp +++ b/tests/client_remote_session.cpp @@ -503,6 +503,12 @@ void crossing_regions(const Files& f) { CHECK(db1.claims == region1_claims && db2.claims == region2_claims + 1); } void cellular_birth_without_view(const Files& files) { + struct EmptyLedger final : ActionLedger { + std::expected, ActionLedgerError> + find(const AccountId&, std::uint64_t) override { + return std::nullopt; + } + } ledger; test::WorldDb world; test::RegionDb control{world, region}; const auto owner = account(0xD1); @@ -510,6 +516,7 @@ void cellular_birth_without_view(const Files& files) { auto answer = PrimitiveLifeResult::pending; Region r{files, [&](server::RegionSessionsConfig& config) { config.ledger = &control; + config.actions = &ledger; config.accept_cellular_actions = true; config.create_primitive_life = [&](const AccountId& a, std::uint64_t generation, std::uint64_t id) {