Fix M9.8c review findings in the engineering client

Resolve pointer ownership per SDL event so same-batch panel clicks, wheel and
click-to-focus typing never reach the world; keep the Tab toggle independent of
idempotent external capture release; own launcher phase and remote session
together so Local fixture ends any remote attempt; wrap notices beside a
reserved close column within a bounded stack. Adds client-panels test and
host/session, same-batch and host-order Tab regressions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-02 11:10:32 -04:00
co-authored by Claude Opus 5.5
parent 897055883a
commit bb8c2fc359
15 changed files with 571 additions and 55 deletions
+14 -15
View File
@@ -1,6 +1,7 @@
#include "evo/client/application.hpp"
#include "evo/client/launcher.hpp"
#include "evo/client/selection.hpp"
#include "evo/client/session_host.hpp"
#include "evo/client/ui_state.hpp"
#include "evo/render/environment.hpp"
#include "evo/render/organism.hpp"
@@ -264,13 +265,14 @@ int main(int argc, char** argv) try {
}
if ((start_fixture && connect_now) || (!screenshot.empty() && frames == 0))
return 2;
evo::client::Launcher launcher;
// Launcher phase and remote session change together (fixture/live distinction).
evo::client::SessionHost<evo::client_app::RemoteSession> host;
const auto& launcher = host.launcher();
evo::client::UiState ui;
evo::client::Selection selection;
evo::client_app::FormBuffers buffers;
buffers.load(form);
std::optional<evo::client::LaunchError> form_error;
std::optional<evo::client_app::RemoteSession> remote;
std::optional<FixtureAuthority> authority;
evo::client::EnvironmentLayer environment;
evo::client::OrganismLayer population;
@@ -287,12 +289,12 @@ int main(int argc, char** argv) try {
form_error = material.error();
return false;
}
remote = evo::client_app::RemoteSession::open(*material);
if (!remote) {
auto opened = evo::client_app::RemoteSession::open(*material);
if (!opened) {
form_error = evo::client::LaunchError::endpoint;
return false;
}
return launcher.begin_connect();
return host.connect(std::move(opened));
}
};
const auto enter_fixture = [&] {
@@ -304,7 +306,7 @@ int main(int argc, char** argv) try {
environment.reset();
population.reset();
selection.clear();
launcher.start_fixture();
host.enter_fixture(); // Ends any remote attempt: nothing runs behind the banner.
return true;
};
if (start_fixture && !enter_fixture()) {
@@ -341,14 +343,14 @@ int main(int argc, char** argv) try {
const auto shown_environment = [&]() -> const evo::client::EnvironmentLayer* {
if (mode() == Mode::fixture)
return &environment;
if (mode() == Mode::remote && remote)
if (const auto* remote = host.session(); remote && mode() == Mode::remote)
return &remote->environment();
return nullptr;
};
const auto shown_organisms = [&]() -> const evo::client::OrganismLayer* {
if (mode() == Mode::fixture)
return &population;
if (mode() == Mode::remote && remote)
if (const auto* remote = host.session(); remote && mode() == Mode::remote)
return &remote->organisms();
return nullptr;
};
@@ -364,7 +366,7 @@ int main(int argc, char** argv) try {
view.organisms = shown_organisms();
view.selection = &selection;
view.ui = &ui;
if (remote && view.mode == Mode::remote) {
if (const auto* remote = host.session(); remote && view.mode == Mode::remote) {
view.remote = remote->status();
view.outcomes = &remote->outcomes();
}
@@ -394,8 +396,7 @@ int main(int argc, char** argv) try {
selection.clear();
}
if (actions.cancel || actions.back) {
remote.reset(); // Drops the connection; its unresolved outcomes are unknown.
launcher.cancel();
host.cancel(); // Drops the connection; its unresolved outcomes are unknown.
selection.clear();
}
if (actions.ask_disconnect && !disconnect_dialog)
@@ -406,8 +407,7 @@ int main(int argc, char** argv) try {
if (actions.confirm_dialog && actions.confirm_dialog == disconnect_dialog &&
ui.close_dialog(*actions.confirm_dialog)) {
disconnect_dialog.reset();
remote.reset();
launcher.cancel();
host.cancel();
selection.clear();
}
if (actions.cancel_dialog && ui.close_dialog(*actions.cancel_dialog))
@@ -422,8 +422,7 @@ int main(int argc, char** argv) try {
const auto intention = (*app)->sample_intention(count);
if (!intention)
return 1;
if (remote && launcher.phase() != evo::client::LaunchPhase::failed)
remote->step(now, *intention, ui, launcher);
host.step(now, *intention, ui); // Only while connecting or connected.
// The fixture authority advances at its own cadence. Presentations refresh
// every N authority ticks; in between the advanced watermark shows as stale.
if (mode() == Mode::fixture && count % frames_per_authority_tick == 0) {
+39 -14
View File
@@ -281,32 +281,57 @@ void session(const PanelView& v) {
ImGui::End();
}
// Newest at the bottom right. Each notice wraps its text beside a reserved close
// column, so the button is always visible; the stack stops at 60 % of the viewport
// height and counts what it could not show (those still expire or can be dismissed
// once space frees). Notices are not the outcome record (Session panel is).
void notices(const PanelView& v, PanelActions& a) {
const auto& io = ImGui::GetIO();
const float width = std::min(notice_width, io.DisplaySize.x - 16);
const float top = io.DisplaySize.y * 0.4F;
float y = io.DisplaySize.y - 8;
for (const auto& n : v.ui->notices()) {
const auto list = v.ui->notices();
std::size_t hidden = 0;
for (auto it = list.rbegin(); it != list.rend(); ++it) {
const auto& n = *it;
if (y < top || width < 120) {
++hidden;
continue;
}
ImGui::SetNextWindowPos({io.DisplaySize.x - 8, y}, ImGuiCond_Always, {1, 1});
ImGui::SetNextWindowSize({320, 0}, ImGuiCond_Always);
const std::string id = "##notice" + std::to_string(n.id);
ImGui::SetNextWindowSize({width, 0}, ImGuiCond_Always);
const std::string id = notice_window_prefix + std::to_string(n.id);
ImGui::Begin(id.c_str(), nullptr,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
ImGui::TextColored(n.level == client::NoticeLevel::error ? red
: n.level == client::NoticeLevel::warning ? amber
: green,
"%s", n.text.c_str());
ImGui::SameLine();
if (ImGui::SmallButton(("x" + id).c_str()))
a.dismiss_notice = n.id;
if (ImGui::BeginTable("notice", 2)) {
ImGui::TableSetupColumn("text", ImGuiTableColumnFlags_WidthStretch);
ImGui::TableSetupColumn("close", ImGuiTableColumnFlags_WidthFixed, notice_close_width);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushStyleColor(ImGuiCol_Text, n.level == client::NoticeLevel::error ? red
: n.level == client::NoticeLevel::warning ? amber
: green);
ImGui::TextWrapped("%s", n.text.c_str());
ImGui::PopStyleColor();
ImGui::TableNextColumn();
if (ImGui::Button(("x" + id).c_str(), {notice_close_width, 0}))
a.dismiss_notice = n.id;
ImGui::EndTable();
}
y -= ImGui::GetWindowHeight() + 4;
ImGui::End();
}
if (v.ui->evicted_notices() > 0) {
if (v.ui->evicted_notices() > 0 || hidden > 0) {
ImGui::SetNextWindowPos({io.DisplaySize.x - 8, y}, ImGuiCond_Always, {1, 1});
ImGui::Begin("##evicted", nullptr,
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize);
ImGui::TextDisabled("%llu older notices discarded",
static_cast<unsigned long long>(v.ui->evicted_notices()));
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
if (hidden > 0)
ImGui::TextDisabled("%zu more notices (dismiss to show)", hidden);
if (v.ui->evicted_notices() > 0)
ImGui::TextDisabled("%llu older notices discarded",
static_cast<unsigned long long>(v.ui->evicted_notices()));
ImGui::End();
}
}
+3
View File
@@ -16,6 +16,9 @@
namespace evo::client_app {
enum class Mode : std::uint8_t { launcher, fixture, remote };
// Notice layout (logical pixels); the window name is the prefix plus the notice id.
inline constexpr float notice_width = 320, notice_close_width = 22;
inline constexpr const char* notice_window_prefix = "##notice";
// Text-field storage for the connect form (bounded; never persisted).
struct FormBuffers {
std::array<char, client::max_field_bytes> endpoint{}, server_name{}, authority{}, grants{};