Skip to content

HUD PR3: command vocabulary, control identity, one performer, OK on the engine - #1150

Merged
GLinnik21 merged 4 commits into
mainfrom
hud/pr3-commands
Oct 29, 2026
Merged

GLinnik21 merged 4 commits into
mainfrom
hud/pr3-commands

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

What

PR3 of the HUD-plugin plan: the command vocabulary, control identity, one shared performer, OK on the focus engine, and Up Next's fixed ids. No visual change: classic's frames, focus order and every key's effect are as before.

  • HudCommand (appkit/src/player_hud/command.rs): ten commands with typed parameters (toggle_play, seek, previous, next, open_tracks, open_more, toggle_section, from_beginning, go_to_detail, toggle_stats) and enabled predicates that read HudModel alone (Previous by previous || restart, Next by next, go_to_detail needs a ratingKey, toggle_section chapters needs chapters, seek needs a known duration). Classic's five discs are five controls with those commands, in today's order (CLASSIC_COMMANDS); Controls::command(i) == Controls::action(i).into() for every combination.
  • Control identity: a control's id is ELEM_CONTROL_BASE + ordinal, an open-ended range at 0x1_0000 (renamed from ELEM_ROW_BASE 10) clear of tabs (20), the failure read-out (30..) and the repair card (40 000). ELEM_CHAPTER_BASE = 0xFFFF_0000 is reserved for PR8. hud.nav.btn stays the ordinal, RowPop stays keyed by ordinal; control_elem(ordinal) is the id.
  • One performer: perform_hud_command (src/app/playback.rs) matches on all ten commands. activate_player_row is now a thin resolver over it (and over activate_stand_in), and it is the function the More fold calls in PR9. PlayerScreen::toggle_play(play, now) is one function the Play/Pause/PlayPause keys, OK on the picture and the command share (the pending-target SeekTo path included). PlayerScreen::jump_by(ps, step_ns, keep_hud, now) takes the signed step and a keep-HUD flag: a seek control press keeps the HUD up and extends its linger, the hidden-HUD tap still hides it, and both share one burst.
  • OK on the engine: key_ok returns Handled::No for a control-row element, so the dispatcher dips the control and PlayerScreen::step handles PressCommit through row_pressed, which asks for PlayerReq::Command(cmd) (a disc) or PlayerReq::StandIn (Skip, Up Next). The screen's key_ok no longer branches on GroupId for the row. The app ladder's player OK arm (app/input.rs::key_ok) is gone: a mounted player owns input, pinned by a_mounted_player_page_owns_input_so_the_ladder_never_sees_ok. The empty Key::Ok arm stays in the chain so OK keeps its place in front of the arms below.
  • Up Next: watch_credits/play_next are the fixed control ids 0 and 1 (BTN_CREDITS/BTN_NEXT kept as those ordinals, documented), and countdown_may_run(bare, row_focused, play_next_focused).
  • open_more {page}: OverlayKind::More { quality: bool } becomes More { page: Option<MorePage> } (None is the root); MoreMenuState::new_on(ps, page) opens on the Speed page when offered, and falls back to the root when not.

Replay fixtures

More(quality:bool) became More(page:u8), which moved SCREEN_SHAPES_PIN (previous 0x9425_f33f_3f53_6aa5). The three replay fixtures were re-recorded against it in 98ac444a8 (simulator stage); fixture_preflight_tests::committed_recordings_keep_valid_page_requests_and_initial_hashes passes again.

Pins and tests I edited (each is a behaviour change, so each is listed)

  • screens/src/player/hud_pins_tests.rs: the hit census is renumbered mechanically (PROBES and the 63 places tuples: elements 10..15,19 become CONTROL + 0..5,+9 with CONTROL = 0x1_0000; the rects and expected hits are untouched), because the plan's PR3 line is "element ranges re-cut". The 30 "ArmControlRow" request strings in the key tables become what the engine now commits: Command(Next), Command(Previous), Command(OpenTracks(Subtitles)), Command(OpenTracks(Audio)), Command(OpenMore(Root)), StandIn. Those are the only edits; each row's key sequence, cursor, tab, visibility and ordering fields are unchanged and still pass. (A pointer click still asks ArmControlRow, as the census asserts.)
  • screens/src/player/mod.rs step-ladder tests: ok_on_the_control_row_arms_the_deferred_press becomes ok_on_the_control_row_leaves_the_press_to_the_engine (Handled::No, nothing at key-down, then PressCommit yields the control's Command); a_segment_offer_arms_the_row_only_once_the_engine_is_re_seated becomes a_segment_offer_hands_ok_to_the_engine_only_once_it_is_re_seated (OK is Handled::No after the re-seat, where it was ArmControlRow). every_control_the_dpad_reaches_is_clickable... and the click tests use ELEM_CONTROL_BASE.
  • appkit/src/up_next.rs inline tests: the countdown_may_run calls pass b == BTN_NEXT for the new third parameter (same assertions).
  • screens/src/registry.rs: SCREEN_SHAPES_PIN bump (above) and ARG_SHAPE.
  • screens/src/player/overlay_tests.rs, src/app/surface_navigation_tests.rs, src/dev/scenarios.rs: More { quality: false/true } becomes More { page: None / Some(Quality) }, nothing else.
  • The pins named by the brief, a_skip_pill_that_retires_on_a_movie_sends_the_ring_to_the_scrubber and an_up_next_stand_in_that_leaves_an_episode_sends_the_ring_to_the_scrubber, pass unedited, and every app-side nav write is still followed by reseat_player_focus.

Decisions

  • hud.nav.btn stays an i32 ordinal and the id is derived (control_elem), so the pins that assign and compare nav.btn == BTN_* stay unedited.
  • Action/Controls::action are kept (the pins name them); HudCommand is what the performer matches on, with impl From<Action> for HudCommand and a test over every Controls combination that the two agree.
  • Activate::Direct stays for the scrubber, the tabs and the pointer click on a row. The scrubber's OK means the toggle or a pending target, and a click needs its x, which a bare ScreenEvent::Activate cannot carry. A tab opens its panel at once with no dip to wait for. The row's pointer click stays ArmControlRow because the hit census asserts [ArmControlRow] for a click; both routes converge on perform_hud_command. Residual: the pointer click on a row still takes the loop's commit-frame route, not the engine's.
  • Enabled predicates read HudModel only; HudModel gains controls, chapters and detail, sampled in app/run.rs::hud_model. detail uses the allocation-free info_panel::detail_rk, shared with the Info card's on_ok.
  • Previous and Next return early from the performer, leaving the HUD as it was (as before); every other command extends the HUD and publishes.
  • OK on a seek control does not reset the seek burst (continues_seek_burst). Classic has no seek control, so this is unit-tested only.
  • No new PlayerScreen field (it would move the shape pin a second time); no new MAX_* constant; no ci/allow line.

Tests

Red first (each shown failing against a deliberately broken implementation, then restored): a seek control press keeps the HUD up while a hidden-HUD tap hides it; two seek presses in one burst give one target; toggle_play from the key and from the command share one path; OK on a control row is the engine's press (Handled::No, then PressCommit gives the command); Up Next's two ids press as StandIn and seat the cursor; continues_seek_burst. Also: a table test over every classic control (command.rs) and in the app crate (hostsim) over perform_hud_command (Previous/Next leave the HUD and open no panel, Subtitles opens Tracks { tab: 1 }, Audio Tracks { tab: 0 }, More the root, open_more Speed the Speed page, toggle_section opens then closes), an overlay test that More mounts on the Speed page, an appkit test for new_on, and the mounted-player-owns-input test.

Gates

Run on the committed tree, head c8c0e00db (git status --short empty before and after; includes the merge of origin/main at c0b61dff8, #1148). CI is the full gate; make check, check-nodef, check-replay, clippy, rustfmt and the ARM build were not run here.

make test-crate C='plx_appkit plx_screens':

test result: ok. 557 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 11.72s
test result: ok. 1769 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 29.61s

(plus three single-test binaries: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1768 filtered out; finished in 0.00s)

make test-crate C=plxnative-modules:

test result: ok. 1094 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.29s

make test-hostsim:

test result: ok. 1223 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 36.78s

Not verified here: anything on the television or in the simulator (the OK dip's look and timing against main, Skip/Up Next presses, the Speed page).

No issue tracks the HUD-plugin work; none was opened for this PR.

Review

Round 1 verdict MERGE with three minors; round 2 listed the two still open.

  1. MINOR, seek-burst guard untested through the key path: fixed. handle_key now takes the focused control's command from its caller (step passes focused_command(focused)), so a test can hand it a seek control, since no slot holds one yet. two_ok_presses_on_a_seek_control_inside_one_burst_give_one_target drives two OK key-downs, each followed by the performer's jump_by, and gets one accumulated target; an OK on another control restarts it. Red first: with the continues_seek_burst guard made to always reset, the second target is 50 s instead of 60 s. The PressCommit leg is not driven in that test, because classic's PressCommit can only ask for a classic command; the performer's jump_by is called directly where Command(Seek) would lead.
  2. MINOR, performer arms unpinned: fixed, in the app crate (hostsim), each red against the mutation the review named:
    • previous_steps_the_queue_back_and_next_steps_it_forward: swapping QueueStep::Previous and Next fails.
    • the_toggle_play_command_takes_a_pending_scrub_target_as_the_play_keys_do: replacing the SeekTo arm with apply_transport(pa, None, ..) fails.
    • a_seek_command_keeps_the_hud_up_and_accumulates_inside_one_burst: jump_by(.., false, ..) fails (the transport is dismissed).
  3. MINOR, stale SCREEN_SHAPES_PIN comment: already done by the simulator stage in 98ac444a8.

No finding was judged wrong; none left open.

🤖 Generated with Claude Code

GLinnik21 and others added 4 commits October 30, 2026 01:58
…he engine

HudCommand (player_hud/command.rs) is the vocabulary a HUD control performs, with
typed parameters and enabled predicates read off HudModel alone. A control's id is
ELEM_CONTROL_BASE + ordinal in an open-ended range (ELEM_ROW_BASE renamed and moved
to 0x1_0000, clear of the tabs, the failure read-out and the repair card; the
chapters' range is reserved at the top of u32 for PR8). Classic's five discs are
five controls with those commands, in today's order.

One performer, perform_hud_command, matches on every command; activate_player_row
resolves the cursor and calls it. toggle_play is one function the Play/Pause keys,
OK on the picture and the toggle_play command share; jump_by takes the signed step
and a keep-HUD flag, so a seek control press keeps the HUD up and a hidden-HUD tap
still hides it, both in one burst.

OK on the row goes through the focus engine: key_ok leaves a row element unhandled,
the engine dips the control and PressCommit asks for Command(..) or StandIn. The
app ladder's dead player OK arm is removed (a mounted player owns input, pinned).
Up Next's two keys are fixed ids and countdown_may_run takes focused == play_next.

OverlayKind::More { quality } becomes More { page } so the Speed page is
addressable; this moves SCREEN_SHAPES_PIN (previous 0x9425_f33f_3f53_6aa5) and the
replay fixtures need re-recording by the owner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`OverlayKind::More { quality: bool }` became `More { page: Option<MorePage> }`, which moved
SCREEN_SHAPES_PIN (0x9425_f33f_3f53_6aa5 -> 0xb633_b65b_ed93_ca93) and the recorded state shape from
2452334830893428010 to 12149748892022442062, so the three anchors could not be loaded.
All three were recorded afresh against the synthetic server (tests/focusfp.sh --rec --only 1,6,12),
passed plxnative-rec check, and were installed with plxnative-rec rerecord, anchors retained.
make check-replay replays all three with verdict=SAME in Targets and Resolve, every difference
counter zero.

The closed alphabet gains the mock's two rating-image URIs (rottentomatoes://image.rating.ripe and
.upright): the Library poster ratings carry them into the recorded hubs result, and a fresh
recording was refused by plxnative-rec check without them. The SCREEN_SHAPES_PIN comment now says
the fixtures were re-recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
handle_key takes the focused control's command from its caller, so a test can hand
it a seek control (no slot holds one yet): two OK key-downs on it inside one burst
give one accumulated target, and OK on another control restarts it.

The app crate pins perform_hud_command's arms: Previous steps back and Next steps
forward (a swap fails both ways), TogglePlay takes a pending scrub target as the
play keys do, and Seek keeps the HUD up and accumulates inside one burst.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review October 29, 2026 23:41
@GLinnik21
GLinnik21 merged commit 58876a0 into main Oct 29, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the hud/pr3-commands branch October 29, 2026 23:48
GLinnik21 added a commit that referenced this pull request Oct 30, 2026
Brings in PR3 (#1150: command vocabulary, control identity, the shared performer), which touched
up_next.rs and player_hud/. No conflict.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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