Skip to content

Keys and text reach the loop as a HostEvent with a canonical Action - #1487

Merged
GLinnik21 merged 4 commits into
mainfrom
platform/w5b-key-actions
Nov 20, 2026
Merged

GLinnik21 merged 4 commits into
mainfrom
platform/w5b-key-actions

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Step W5b of the platform plan (discussion #1460). Keys and text reach the loop as HostEvents, beside W5a's lifecycle and quit. A key carries a canonical Action where one is defined, and the raw pair it arrived as where there is one. A platform with no SDL key codes, such as Tizen, can then deliver an Action alone. No behaviour change on webOS or the simulator, and tapes, tests/keytable.json and the machine's InputKind::Key are untouched.

What changes

  • plx_ui::consts: added beside classify and is_remote_bound.
    • Action has 19 variants: Up Down Left Right Ok Back Play Pause PlayPause Stop Rewind FastForward Exit PageUp PageDown Backspace ClearAll Digit(0-9) PointerHidden.
    • raw_pair(Action) is the one pair the app builds for an action. Back is (SDLK_ESCAPE, 0) and Stop is (0, 413), the pairs the remote FIFO already sent.
    • action_of(sym, wcode) reads in this order: classify, then paging, then the edit keys, then digits. A digit is read from sym only, as is_remote_bound always did. A note there says W5d decides the wcode-only 48..=57 case.
    • is_remote_bound(sym, wcode) is now action_of(..).is_some(). A whole-grid test checks it against the old predicate.
    • pin_digit is screens/src/profiles.rs's digit_of, moved unchanged. It still reads both fields, and the PIN screen calls it.
  • app/events.rs: HostEvent gains Key(KeyPress) and Text(String).
    • KeyPress has private fields: an optional Action, the Edge, and an optional RawKey. Its constructor makes a press one key:
      • with a raw pair, the action is action_of of that pair, and a stated action that differs is refused;
      • with no raw pair, the action must round-trip (action_of(raw_pair(a)) == Some(a)), which refuses Digit(10..=255);
      • a press with neither is refused.
    • decode_host_event now also decodes SDL KEYDOWN, KEYUP and TEXTINPUT, at this build's offsets (LG and stock layouts).
    • The 17 named remote-FIFO tokens build their pair through raw_pair. chup, chdown and k: stay literal pairs.
    • There is no Edit variant yet: nothing produces one. It arrives with its first producer (W9).
  • app/run.rs: ingest_host_event gains the Key and Text arms. The drain's old key and text branches move, dedented, into ingest_key and ingest_text_commit.
    • The order, the input prelude (telemetry session::input, the controlled-replay return, the input damage note) and the controlled-replay suppression are as before.
    • A press with action: None takes today's raw path. The pointer-hide early return still reads classify(sym, wcode) == Key::PointerHidden on the pair, as every other arm does.
    • The hex log (key type=0x300 raw=) stays in the SDL drain behind !controlled_replay, now in log_raw_input_event. ci/list-caps.ini re-keys its &ev[..48] entry to that function.
  • textinput.rs: queue(String) is split out of on_event. The FIFO's txt: keeps Source::RemoteFifo, and a hosted Text is Source::Sdl.
  • Docs: docs/remote-keys.md follows digit_of becoming pin_digit.

The diff stat is about 900 lines, mostly the key body moved and dedented. The content change is the two entry points, the two arms, and the consts additions.

Inventory

This is W5b step 1 (spec, W5 lane). There is one row per consumer of a raw (sym, wcode) pair, and the Action list derived from it. Line numbers are at efad77e (W5a), where the inventory was taken.

The loop (moves behind HostEvent::Key)
file:line pairs read what it does Action consumed keeps raw pair?
app/events.rs:80 decode_key all 3 raw fields (state, wcode, sym) at two layouts the ONLY SDL byte decoder for keys produces raw and, via action_of, action it IS the raw source; unchanged, called by decode_host_event
app/events.rs:121 host_wcode sym 32/112/115/8 to wcode 72/450/413/482 (hostsim desktop stand-in) feeds decode_key on the host only none (a decode helper) stays in decode_key; the (8,482) pair is Back to classify, Backspace to Search, both kept because raw is retained
app/events.rs:281 remote_token_key the 17 named FIFO pairs + k:<sym>,<wcode> builds the synthetic press for the remote FIFO, holddown/holdrep/holdup, Lab Control 17 tokens fold through raw_pair; chup/chdown/k: stay literal the pair goes to remote_synth_key_* and re-enters through the SDL decoder, so it is a raw producer by design
app/run.rs:1409-1442 hex log none (raw bytes) key/text/edit type=0x.. raw=<48 bytes hex> forensic line none stays in the SDL drain, gated !controlled_replay; line text must not change (many tests and docs/remote-keys.md grep it)
app/run.rs:1444-1458 classify(sym,wcode) then Key::PointerHidden early return (both edges) the LG pointer-hide notification must not wake the HUD or spend Back's latch Action::PointerHidden no (action only)
app/run.rs:1459-1468 key_input(sym,wcode,state) boot_initial controlled-boot key: controlled_key_input Key{raw} keeps raw: builds InputKind::Key{sym,wcode}
app/run.rs:1469-1475 enc_key(sym,wcode,down,repeat) the tape row Key{raw,edge} keeps raw: the tape format IS the pair
app/run.rs:1496-1534 state&0xff != 1, state&0x100, sym == app.down_sym, is_ok(sym), on_key_up(sym, down_sym), key_input(...) edge routing: Up, Repeat gate (RepeatGate for directions, ungated OK), repeat-vs-fresh by raw sym identity edge, is_ok to Action::Ok down_sym compares RAW sym (every remote transport key has sym 0, so they share slot 0); raw sym retained
app/run.rs:1536-1552 classify result key for WakePress Play wakes+plays, PlayPause toggles, others only wake Action::Play, Action::PlayPause no
app/run.rs:1556-1562 plx_os::labcfg::is_trigger_key(sym,wcode) lab trigger bypasses the player-HUD ordering (ordered_player_key) none (lab.json driven, not an Action) YES: lab.json names an arbitrary pair; const-false without lab-diagnostics
app/run.rs:1563-1574 begin_fresh_press(session, key, sym, wcode, ...); app/input.rs begin_fresh_press/note_global_press/on_key_up global fresh-press side effects (HUD wake, abort armed click) gated by is_bound(sym,wcode) action.is_some() replaces is_bound on the non-lab arm is_bound keeps the lab arm: needs raw pair
app/run.rs:1575-1590 crate::lab::key_press(sym,wcode,...) (lab/mod.rs) lab diagnostics trigger none YES, raw (lab.json)
app/run.rs:1620-1625 key_input(sym,wcode,state & !0x100 if ordered_player_key) hands the press to the tree Key{raw, edge}; edge Repeat -> Down replaces state & !0x100 raw retained (machine key still takes sym/wcode)
app/bridge.rs:5457 key_input (sym,wcode,state) -> InputKind::Key{key:canon(sym,wcode), sym, wcode, edge, at_edge} derives machine Key (Up/Down/Left/Right/Ok/Back/Other) and Edge from state bits edge raw retained until W5d; signature unchanged in W5b (4 callers incl. bootstrap/effects.rs:160)
app/run.rs:1075 ingress_token + app/events.rs:618 dispatch_remote_token token string FIFO/Lab/replay token ingress; okdown/okup/holddown/holdrep/holdup call remote_synth_key_* none produce raw SDL events; unchanged
app/run.rs:3814 replay_inject tape row {"kind":"key","sym","wcode","down","repeat"} re-synthesizes through remote_synth_key_edge/remote_synth_key_repeat, i.e. back through SDL none tape format unchanged (so tests/replay_fixtures.py anchors need nothing)
app/run.rs:3921 controlled_key_input InputEvent<u32> controlled replay/boot key none takes the machine event
Screens and ui (unchanged in W5b; each one is a W5d consumer)
file:line pairs read what it does Action it would consume keeps raw in W5b?
screens/src/player/mod.rs:743 classify_input(key,sym,wcode): Back/Stop, Up/Down repair (playback-failure) alert answer + scroll Back, Stop, Up, Down yes (W5d)
screens/src/player/mod.rs:1033-1039 classify_input the HUD key ladder: Play/Pause/PlayPause/Rewind(Left alt)/FF(Right alt)/Stop/Exit, ring walk Play, Pause, PlayPause, Rewind, FastForward, Stop, Exit, Up/Down/Left/Right, Ok, Back yes (W5d)
screens/src/player/mod.rs:3433 classify_input Up/Down ordered HUD ring direction Up, Down yes (W5d)
screens/src/player/overlay.rs:773 classify_input then self.key(...) track menu/info/chapters surfaces, transport falls through as PlayerReq::Transport transport Actions + directions yes (W5d)
screens/src/login.rs:2228 classify_input Up/Down scroll the login report alert Up, Down yes (W5d)
screens/src/detail/mod.rs:2365, detail/trailer.rs:72-89 classify_input via trailer_key(key,sym,wcode) full-screen trailer: PLAY/PAUSE/PLAYPAUSE, FF/REW alternates, scrub Play, Pause, PlayPause, Rewind, FastForward yes (W5d)
screens/src/hud_settings.rs:904-912 (key, sym): Left/Right, sym == SDLK_BACKSPACE/SDLK_CLEAR HUD-settings text-edit mode (caret, backspace, clear) Left, Right, Backspace, ClearAll yes (W5d)
screens/src/hud_settings.rs:1137 classify_input == Play refetch on PLAY Play yes (W5d)
screens/src/search/mod.rs:404-409 (key, sym): Left/Right, SDLK_BACKSPACE, SDLK_CLEAR Search system-keyboard edit keys (the "edit-key readers") Left, Right, Backspace, ClearAll yes (W5d)
screens/src/library/mod.rs:1641 consts::page_dir(sym,wcode) Library CH+/CH- and PAGE keys page the grid PageUp, PageDown yes (W5d)
screens/src/library/recommended.rs:1112 consts::page_dir(sym,wcode) Recommended page paging PageUp, PageDown yes (W5d)
screens/src/person_bio.rs:212 step_page(sym) bio prose paging, sym Up/Down (via ui/src/prose_scroll.rs:149) Up, Down yes (W5d)
screens/src/about_panel.rs:519 scroll.step_page(sym) About panel paging Up, Down yes (W5d)
screens/src/tracks_panel.rs:1174 step_page(sym as c_int) track menu paging Up, Down yes (W5d)
ui/src/prose_scroll.rs:149 match sym { SDLK_UP, SDLK_DOWN } the shared prose scroller Up, Down yes (W5d)
ui/src/dispatch/by_id.rs:290 builds InputKind::Key{key:Ok, sym:tap.sym, wcode:tap.wcode} the by-id press injects "the OK key's own pair" Ok (raw_pair(Ok)) PRODUCER of a raw pair: after W5b could call raw_pair(Action::Ok) instead of reading tap.sym/wcode; leave for W5d (it reads the machine's tap, not the loop)
screens/src/profiles.rs:340 digit_of and :1757-1776 [sym, wcode] any in 48..=57 PIN pad digit typing Digit(n) moves to consts::pin_digit UNCHANGED in W5b (see Digit divergence below); the call site stays raw
screens/src/profiles_pin_tests.rs:48-55 digit_of table pins digit_of n/a test retargets to consts::pin_digit
ui/src/consts.rs:322/380/433/483/488 classify, classify_input, page_dir, is_bound, is_remote_bound the decode/predicate set that action_of subsumes all classify_input keeps taking the machine key + raw (W5d); is_remote_bound is re-expressed as action_of(..).is_some()
The Action list: raw_pair and every pair action_of maps to each Action

action_of(sym, wcode) applies these in order:

  1. classify: directions by sym first, then Rewind/FF in either field, then PointerHidden, OK, Pause, Play, PlayPause, Stop, Exit and Back;
  2. page_dir;
  3. the edit keys, by sym;
  4. a digit, by sym only.

Every row obeys action_of(raw_pair(a)) == Some(a).

Action raw_pair (sym, wcode) action_of maps these pairs to it
Up (SDLK_UP, 0) sym == SDLK_UP (any wcode)
Down (SDLK_DOWN, 0) sym == SDLK_DOWN
Left (SDLK_LEFT, 0) sym == SDLK_LEFT (classify Left{alt:false})
Right (SDLK_RIGHT, 0) sym == SDLK_RIGHT
Rewind (0, 452) sym or wcode == 452 when sym is not a plain direction (classify Left{alt:true})
FastForward (0, 451) sym or wcode == 451 when sym is not a plain direction (Right{alt:true})
PointerHidden (0, 0x1e4) wcode == 0x1e4
Ok (SDLK_RETURN, 0) is_ok(sym): RETURN 13, KP_ENTER (88|1<<30), SELECT (77|1<<30, which is really End; name left alone)
Pause (0, 72) wcode == 72; sym or wcode == 415
Play (0, 450) wcode == 450; sym or wcode == 19; sym or wcode == 402
PlayPause (0, 261) wcode == 261 or sym == 261
Stop (0, 413) wcode in {413, 120, 260}; sym == 413
Exit (0, 505) wcode == 505 or sym == 505
Back (SDLK_ESCAPE, 0) sym == 27, sym == 'q', wcode == 461, wcode == 482 (so hostsim (8,482) is Back)
PageUp (SDLK_PAGEUP, 0) page_dir == -1: sym == SDLK_PAGEUP or wcode == 300 (CH up)
PageDown (SDLK_PAGEDOWN, 0) page_dir == 1: sym == SDLK_PAGEDOWN or wcode == 301 (CH down)
Backspace (SDLK_BACKSPACE, 42) sym == 8, after classify said Other
ClearAll (SDLK_CLEAR, 156) sym == SDLK_CLEAR (156|1<<30)
Digit(0..=9) (b'0'+n, 0) sym in 48..=57, after classify said Other

pin_digit (moved unchanged) reads [sym, wcode] for 48..=57, while action_of reads the digit from sym only, as is_remote_bound always did. In W5b the PIN screen still reads the raw pair, so nothing changes. W5d decides the wcode-only case when the PIN pad moves onto Action::Digit.

Tests

The guard: a native pair, then the decoder, then the real consumer's effect

Each case feeds the pair the set or simulator really sends, as literal bytes, and asserts what the consumer did. The path differs by case:

  • Transport, rewind and FF, paging, pointer hide and the unbound key on the player go through encode_key → decode_host_event → the loop.
  • Search editing and the input.rs unknown-pairs test go through the decoder and then the key_input call ingest_key makes (native_key_input, a test-side copy of it), not the whole loop.
  • The PIN keypad test is screen-level. It hands the pair to the screen with no decoder, which is enough here because the decoder passes digit pairs through unchanged, and the decode table pins each one.

Where a hosted platform could send the key, a second door delivers the same key as an action-only HostEvent::Key.

Case Rig What is asserted
Transport mounted player, the loop rig 450 asks Transport(Some(true)), 72 asks Some(false), 261 asks the toggle. The alternates 415, 19 and 402 ask what their base key asks. Native and hosted doors
Rewind and FF player at 60 s of 100 s 452 commits CommitSeek(50 s) and 451 commits CommitSeek(70 s). A plain LEFT or RIGHT asks nothing and only moves the pending target. Both doors
Paging the real Library grid in the loop rig, 120 items PAGE DOWN, PAGE DOWN, CH−, PAGE UP, CH+, PAGE UP leave rows 2, 4, 6, 4, 2, 0. Both doors
Search editing the Dispatcher-tier Search rig (the loop rig cannot raise the keyboard on a host) Backspace (8, 42) deletes one character, the simulator's (8, 482) does too, and Clear empties the field
PIN keypad profiles_pin_tests.rs Each digit types its own digit by sym, with a scancode beside it, and wcode-only in 48..=57 types through pin_digit as before. 47, 58, (0,0), (0,504), DOWN, 450 and 72 type nothing
Unknown pairs input.rs (0,504), (0,269), (0,270), ('a',4), (0,0) and wcode-only 48..=57 have no Action, keep the raw pair and wake no dismissed HUD. Bound keys are the control
Pointer hide the loop rig (0, 0x1e4) stops the pointer and does nothing else, whether it arrives as SDL bytes, a raw-only hosted press or a hosted action. Colour button 504 is the control
Lab trigger input.rs labcfg::is_trigger_key is const-false without lab-diagnostics, so the hostsim build cannot arm one. The test pins that
Decode table events.rs Every named native pair decodes to the action it means
KeyPress events.rs A disagreeing action and pair are refused, Digit(10) is refused, and a raw-only 0x1e4 press derives PointerHidden

Mutations. Each break was applied to the committed tree, run, and restored. A swap in raw_pair or action_of alone leaves the native effect tests green, because production consumers still read the raw pair until W5d. Other guards catch it: the decode table, the input.rs decode literals, or the hosted door's round-trip refusal.

Break Red
classify Play/Pause swapped native transport effect (PAUSE asked Some(true)), hosted refusal, decode table
raw_pair Play/Pause swapped the hosted door's constructor refusal
action_of Play/Pause swapped decode table, input.rs literal, hosted refusal
raw_pair and action_of Play/Pause swapped together hosted transport as an effect (PAUSE asked Some(true)), decode table
page_dir up/down swapped native paging effect (PAGE DOWN left row 0), hosted refusal, decode table
action_of PageUp/PageDown swapped decode table, input.rs, hosted refusal
raw_pair PageUp/PageDown swapped hosted refusal
classify REW as a plain Left native rewind effect, hosted refusal, decode table
raw_pair Rewind as (SDLK_LEFT, 0) hosted refusal
the pointer-hide early return removed pointer-hide effect (the pointer still drawn)
KeyPress::new without its pair check, or without its round trip a_press_is_one_key_and_its_action_and_pair_cannot_disagree

Runs

On the committed head d893dece5, through tools/check-lock.py:

  • make test-crate C=plx_ui T=consts: test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 1753 filtered out
  • make test-crate C=app T=events (default features, so the LG offsets): test result: ok. 22 passed; 0 failed; 0 ignored; 0 measured; 1479 filtered out
  • make test-crate C=app T=native_key_effect: test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 1497 filtered out
  • make test-crate C=plx_screens T=native_key_effect: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2285 filtered out
  • make test-hostsim T=native_key_effect: test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 1738 filtered out
  • The whole app hostsim suite, with the two macOS-only no-GL SIGSEGV tests skipped: test result: FAILED. 1746 passed; 2 failed. The two failures are the deeplink_route_tests pair, a_play_landing_behind_a_preview_that_never_returns_gives_up and a_play_landing_waits_for_an_abandoning_preview.
    • They pass alone (9 passed; 0 failed).
    • They fail the same way with all the new tests skipped.
    • They fail on the base 1adff84's default-feature suite in 3 runs of 3.
  • At ef88a5b3c, make test-crate C=plx_ui gave test result: ok. 1775 passed, including ui/src/fixture.rs's pin on ingest_host_event, and make test-crate C=plx_screens T=profiles gave ok. 66 passed.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0. Every real replay is verdict=SAME.
  • Unchanged against the base: tests/keytable.json, the tapes and ci/proofs.
  • Green: ci/check-deps.sh, ci/check-module-layers.py, ci/check-ledger-ratchet.py and ci/check-list-caps.py.

Not run here: make check, check-nodef and the ARM cross-build. This PR's own CI gates them.

Television

The dev set ran the same remote-key script on this change at ef88a5b3c. The later commits change KeyPress::new's validation, which no SDL or FIFO press can fail. They also put ingest_key's pointer-hide early return back on classify of the pair, as on main: for every SDL press that agrees with the action test it replaced, because action_of answers PointerHidden only from classify's own arm. KeyPress::action() becomes test-only. The rest is tests and comments. Main (1adff841e) ran it for comparison, with one 8-minute lease per build. Each lease held two --guest --mock boots of plain make builds against tests/mock_pms.py: a library grid, and the player on the mock's verification episode. No ok was pressed.

  • Identity, checked before the first key of every boot: token: using /tmp/plxnative-token (test identity) and pms: server 0 version=1.41.0.0000-synthetic.

  • Binary. For each build, the binary's md5 matched on the host, in the app directory and at /proc/<pid>/exe.

  • Raw bytes. Each build logged 38 key type=0x300/0x301 raw= lines, in the same order, two edges per press:

    • down down right, pagedown pageup, chdown chup, back;
    • the pointer-hide 0x1e4 and the unbound 0x1f8, on the grid and in the player;
    • play pause playpause ff rew stop;
    • exit.

    With the [ms] stamp stripped, the lines are byte-identical except bytes 4-7. Those hold SDL's event timestamp, which SDL_PushEvent stamps on each FIFO key; it equals the line's own [ms] stamp.

  • Effects. Every key had the same effect on both builds:

    • the 20 state snapshots match, apart from nonce and frame;
    • the grid focus moves card.0 → 6 → 12 → 13;
    • paging and CH± move it to card.25 and back;
    • 0x1e4 and 0x1f8 change nothing;
    • pause and playpause pause and resume the timeline;
    • ff and rew each do one 10 s seek;
    • stop returns to Home.
  • Clean run. Neither build logged a crash record, *** EXIT, panic or unknown token.

  • Text. Text through LG's on-screen keyboard is host-graded only. The FIFO cannot reach that panel, and uinput and the keymanager luna API do not reach the app. The LG text offset is pinned byte for byte by key_event_tests::a_text_commit_decodes_at_this_builds_offset under the default features.

  • Not caused by this change: EXIT pressed on Home did not end the process on either build. SAM's close ended it. Its running = false arm sits behind the tree-owns-key return, on main as well.

🤖 Generated with Claude Code

GLinnik21 and others added 4 commits November 20, 2026 13:48
W5b of the platform plan (discussion #1460). A host that is not SDL has no
(sym, wcode) pair to hand the loop, so the loop's input now arrives as an
app-private HostEvent: HostEvent::Key(KeyPress) and HostEvent::Text(String),
beside the Lifecycle and Quit W5a added. The SDL drain decodes a key or text
event into one and hands it to the same ingest_host_event every other host
event reaches; ingest_key and ingest_text_commit are the old key and text
branches of the drain, moved, with the same order and the same controlled-replay
suppression.

What a key press means is now one vocabulary. plx_ui::consts gains Action
(Up .. Back, the transport keys, Exit, paging, Backspace, ClearAll, Digit,
PointerHidden), raw_pair(Action) as the only builder of an SDL pair and
action_of(sym, wcode) as the only decode. is_remote_bound is defined as
action_of(..).is_some(), so the map has one spelling and a test grades it
against the previous predicate over the whole (sym, wcode) grid. The PIN pad's
digit reader moves down unchanged as pin_digit and keeps reading both fields;
action_of's digit reads sym only, which is is_bound's existing term, and the
wcode-only 48..=57 case is left for W5d to decide.

A KeyPress holds an optional action, the edge and an optional raw pair, and its
constructor refuses a press that names neither. The loop still runs its ladder
on the raw pair: an unsupported key flows on as exactly the pair it was, the lab
trigger and the tape keep reading a pair, and a host that sent only an action
reaches the same arms through raw_pair. The FIFO's named tokens now press the
pair raw_pair gives their action; chup, chdown and k: stay literal pairs. The
raw-event hex log stays in the SDL drain and is still skipped under a
controlled replay. Text reaches the loop as Source::Sdl, and the txt: token
keeps Source::RemoteFifo through ingest_text.

Nothing the tape or the keytable records changes for any event SDL produces:
machine.rs, STATE_SHAPE, tests/keytable.json and the tapes are untouched, and
the edge is re-derived into the state word the way bridge::key_input reads it.
(A release stamped with the repeat bit, which SDL never sends, now records as
a plain release.)

The diff of run.rs is mostly the moved key body, dedented; its content change
is the two entry points and the HostEvent arms. There is no Edit variant: it
arrives with the first producer of an edit, in W9.

Co-Authored-By: Claude <noreply@anthropic.com>
…one key

Review follow-up to the W5b HostEvent::Key change (PR #1487).

The first guard graded the decoder and showed that a hosted key and an SDL key
agree, but both doors carried the pair raw_pair gave them, so a wrong mapping
passed. The new native_key_effect_* tests feed the pair a television or the
simulator really sends, written out as literals, through the real decoder and
loop, and grade what the real consumer did:

* transport, on the mounted player: PLAY (wcode 450) asks to play, PAUSE (72)
  to pause, PLAYPAUSE (261) for the toggle, and their alternate spellings the
  same; the hosted action-only press of each asks what its native key asks.
* REWIND (452) commits a seek one interval back where a plain LEFT only moves
  a pending target; FAST-FORWARD (451) and RIGHT likewise forward.
* paging, on the real Library grid in the loop rig: PAGE DOWN and CH- move the
  focus two rows down, PAGE UP and CH+ two rows up, graded by the exact cell.
* search editing: Backspace, Clear and the simulator's Backspace (sym 8 beside
  BACK's wcode) edit the field. Search is graded in the Dispatcher-tier rig,
  because the loop rig cannot raise its keyboard on a host.
* the PIN keypad types each digit by sym and by a wcode-only press in 48..=57,
  and nothing beside those ranges; the unbound colour button and the same
  wcode-only press wake nothing and abandon no armed click through
  note_global_press, with bound keys as the positive control.
* a pointer hide is a notification whichever way it arrives (SDL bytes, a
  raw-only hosted press, a hosted action) and an unbound key flows on as the
  pair it was; an unbound key leaves a dismissed transport dismissed.
* the lab trigger is const-false without lab-diagnostics, so its arm cannot be
  armed in a test build; what the build does is pinned instead.

KeyPress::new now makes the action and the pair one key. With a raw pair the
action is action_of of it, and a stated action that differs is refused; with no
raw pair the action must read back from its own raw_pair, which refuses
Digit(10..=255). The pointer-hide early return in ingest_key reads classify of
the pair again, as before the HostEvent change, so a raw-only press with wcode
0x1e4 takes it. action() is test-only until the screens move onto it.

bridge::text_owner's comment pointed at the SDL_TEXTINPUT branch of
ingest_sdl_event, which moved to ingest_text_commit.

Co-Authored-By: Claude <noreply@anthropic.com>
…hat broke

The native_key_effect_* guards in run.rs fed a pair through the decoder and the
loop, then asserted the decoded action first. A wrong classify therefore
failed on the decode line and never reached the effect it was meant to show,
and the native, hosted and decoded readings of one key shared one test.

Each reading is now its own test, red under its own kind of break:

* the NATIVE door (transport, rewind, paging): the SDL pair as literals, graded
  by what the player or the Library grid did. A wrong classify or page_dir
  reading fails these, which are what the consumers read today.
* the HOSTED door of the same three: the action alone, which goes through
  raw_pair and KeyPress::new's round trip. A wrong raw_pair fails here, as a
  refusal (the .expect) or as another key's effect.
* the decoded action, as one table of literal native pairs in events.rs
  (native_key_effect_the_native_pairs_decode_to_the_actions_they_mean). No
  production reader of the loop reads the action before W5d, so a wrong
  action_of is seen by this table and by nothing else.

The pointer-hide test no longer asserts the decode either; the table owns it.

Co-Authored-By: Claude <noreply@anthropic.com>
…ons showed

The guard's header in run.rs, the decode table's doc in events.rs and the previous
commit's message said a wrong action_of is seen by that table "and by nothing
else", and that each door is red under a different break. Swapping the mapping's
halves in turn (Play/Pause, PageUp/PageDown, Rewind for Left) showed otherwise:

* a wrong classify or page_dir turns the NATIVE effect red, and also the hosted
  door and the decode table, because action_of is built on classify;
* a wrong raw_pair alone turns ONLY the hosted door red, as KeyPress::new's
  round-trip refusal (the .expect panics);
* a wrong action_of leaves every native effect green. The decode table,
  input.rs's decode literals and the hosted door's round trip see it;
* a raw_pair and an action_of that agree on a swap pass the round trip, and turn
  the hosted transport test red as the effect of another key (PAUSE asks to play).

The comments now say that. Comments only; no behaviour moves.

Co-Authored-By: Claude <noreply@anthropic.com>
@GLinnik21
GLinnik21 merged commit ca76531 into main Nov 20, 2026
14 checks passed
@GLinnik21
GLinnik21 deleted the platform/w5b-key-actions branch November 20, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant