Files
aevolution/docs/engineering/CLIENT_UI_STATE.md
T
dingoandClaude Opus 5.5 bb8c2fc359 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>
2026-10-02 11:10:32 -04:00

4.7 KiB

M9.8b/c UI state, launcher and event bounds

Owned, toolkit-independent state; all calls on the client main thread. No authority or simulation state. Time is explicit monotonic milliseconds supplied by the host.

Notifications: at most eight, text at most 240 bytes; reject invalid/oversized input, expire by deadline, dismiss by unique id. Overflow evicts oldest and increments a visible saturating counter. Notifications are not durable outcome history. Dialogs: one active modal, title at most 96 bytes and body at most 240; opening a second fails. Close requires the matching id so a stale click cannot close a newer dialog. IDs never wrap. No credentials or grant bytes enter display messages.

SessionClient keeps at most 1024 queued ClientEvents. At 766 regular events it emits a local backpressure event, disconnects, and has room for loss plus 256 unknown intentions. It preserves all previously queued events and pauses reconnect until take_events drains the queue. This is a local condition, not a protocol change. Unprocessed wire outcomes remain unknown, never assumed failed or committed.

The native adapter's externally requested capture cannot be disabled by the legacy Tab toggle. Releasing capture drains already queued input before new world actions. M9.8c renders these through the toolkit overlay (below).

M9.8c launcher, selection and panels

Toolkit-independent models (src/client/ui, tested by client-ui-model):

  • Launcher (launcher.hpp): phases choosing, fixture, connecting, connected, failed. Fields are at most 1024 bytes; endpoint is host:port with port 1-65535. Files are read only when Connect is pressed: the CA at most 64 KiB and PEM-shaped, the grant bundle 1-64 whole 108-byte records. Nothing is persisted; material lives only in the session client. Errors are an enum with fixed text that never contains paths or file bytes. Before the first Welcome, three losses (including refused TCP/TLS attempts, counted by SessionClient::unreachable_attempts()) fail as unreachable; a refused grant or exhausted bundle fails at once. Failed offers Retry/Cancel; Cancel drops the session (its unresolved intentions become unknown).
  • Selection (selection.hpp): topmost organism under the click, else the habitat cell, else none. A selected organism absent from the latest view is cleared; with no view at all the selection is kept but shows nothing.
  • Labels (labels.hpp): value, present zero, missing (requested, no value), not requested and undefined moisture are distinct kinds and texts. Freshness is printed as current, stale or none.
  • Outcome log (outcome_log.hpp): last 64 intentions by sequence with sent, admitted, rejected, durable, not committed or unknown. It is the visible record; notifications are not.

Native adapter (Application): toolkit events are processed first. Keyboard focus in a widget (reported by the toolkit's last frame) captures world keys. Pointer ownership is resolved per event against the panel rectangles retained from the last frame (and any open popup), so a move onto a panel followed by a press or wheel in the same SDL batch never reaches the world; a press that begins on a panel owns the button until release. After a press on a panel, world key-downs in the same batch are dropped (releases still pass) because that press may focus a text field before the toolkit can report it; those keys need a fresh press. A click is a left press and release within 4 pixels, both outside any panel. Capture changes from toolkit focus release world actions and require fresh presses. External capture (launcher, modal) and the Tab toggle are independent: Tab is ignored while external capture holds, and an external release (sent every host frame outside a modal) does not cancel the toggle. The overlay callback runs after world drawing; request_screenshot saves the next frame as BMP (engineering review). Toolkit settings files and logs are disabled (IniFilename/LogFilename null).

Host ownership (session_host.hpp): the launcher phase and the remote session change together. Entering the local fixture, Cancel, Disconnect or a launcher failure drops the session at once (unresolved intentions become unknown); the session is serviced, and intentions sent, only while connecting or connected, so nothing runs behind a LOCAL FIXTURE banner. Retry opens a new session.

Notices (app panels): newest at the bottom right, at most 320 logical pixels wide (narrower viewports shrink them), text wrapped beside a reserved close column. The stack stops at 60 % of the viewport height and shows how many notices are not drawn and how many were discarded. client-panels renders the production panels through the adapter and checks notice geometry and close-button dismissal.