Skip to content

Reach elements by id in the harness; Home's carousel holds still under a hero press - #1442

Merged
GLinnik21 merged 106 commits into
mainfrom
a11y/harness
Nov 18, 2026
Merged

GLinnik21 merged 106 commits into
mainfrom
a11y/harness

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What

This is the harness half of the accessibility-identifier series, after #1431 (the ids) and #1432 (the runtime tokens). Device and simulator scripts now reach elements by id instead of walking to them with direction keys. They check where focus landed before taking a shot, and they cannot press a title without naming it.

tools/tv-session.sh

  • New verbs. focus <id>, press <id> [--rk RK] and state [--out FILE], all under the TV lock.
  • Validation. Ids and ratingKeys are checked locally before anything reaches ssh or the FIFO.
  • The title guard. A press on an element that acts on a title refuses to run without --rk, so it always names the title it expects; the app then refuses the press if that title is not the element's. The rule is described under "Subjects" below.
  • One door per action. key refuses a focus:, press: or state: word and points to the verbs.
  • FIFO writes. The write escapes ' for the remote shell and refuses any whitespace inside a token, ASCII or Unicode. The app splits on whitespace, so a space would smuggle a second token past the checks. Every word is checked before any is sent.
  • state. It sends a random nonce, then polls plxnative-a11y.json in the runtime root until the nonce matches.
  • Usage. The usage text prints the header up to a marker line, so it cannot be cut short again. The self-test checks it.

tools/a11y.py

  • Helpers. focus, press(subject=) and expect_focus, which raises FocusMismatch naming both ids plus the route and owner, or TimeoutError when the app never answers. Parsers for tokens and refusal lines.
  • CLI. The verbs are focus, press, send and expect.
    • press and send press: apply the same title guard as tv-session.sh, with --subject, because the simulator boots against the owner's real server unless it is aimed at a mock.
    • send refuses a token that contains whitespace.
    • Exit code 2 means malformed input or a missing subject, and nothing is sent. Exit code 1 means a mismatch, a silent app or no FIFO.
  • Library. The library press() and press_token() are unguarded on purpose, for scripts that drive the mock. A script that imports them against a real server has no check.

Subjects: an element names the title its press acts on

The guard can only check a title the element carries. An element whose press acts on a title it names now carries that title's ratingKey as its A11y subject, through with_subject. "Acts on" means it plays, restarts, retries, marks, bookmarks or writes it. It also covers opening that title's own page or menu where the title can change under the press. Only a control whose target the page fixes carries none: Go to Show, Also available, the Play Version opener, More, a panel opener, a seek. SUBJECT_BEARING in tools/a11y.py is the one list, and a test holds tv-session.sh's copy equal to it.

The ids that newly carry a subject:

  • the Home hero's Play, Info and Watchlist (the carousel advances by itself; the retry button carries none);
  • every item-menu row;
  • the Detail hero's Play, Restart, Trailer, Mark watched, Mark unwatched and Watchlist. For a started show these name the episode they act on, not the page's show;
  • the Play Version rows;
  • the player HUD's queue steps, Next Episode, Play from Beginning and Skip, its positional controls and the Info card's buttons;
  • the failure screen's Try Again and Play Automatically. These name the request being retried, which can differ from the item that last played;
  • the More menu's quality rungs and queue folds;
  • the audio and subtitle track rows and the subtitle-search results. These write the choice to the server.

Each subject is read the way its activation reads its key, in a11y, from the frame's views: no state added, no IO.

tests/test_a11y_tool.py keeps it closed. It reads every non-test file of the screens, appkit and ui crates, finds the ones that construct a play, queue-step or write message, and holds that set equal to a table of the guarding SUBJECT_BEARING entries. It also counts with_subject calls per file. A new title-acting message in a new file fails until it is guarded or explained.

Home's hero/grid door

A press that lands while Home is still moving between its hero and its shelves acts on what the picture shows, so a person pressing OK mid-transition gets what they see. A by-id press queues its focus move and its OK in the same frame, so the press used to land on the element focused before the move: press home.shelf.2.card.0 --rk <card> from hero Play played the hero's title.

  • A scripted focus move (By::Script) now clears that remap, so a scripted press acts on what it names.
  • While a key's move has left the picture behind the focus, Home reports the focused element as not loaded, about 8 frames (130 ms) at 60 fps. Any by-id press of it is refused as unloaded until the picture catches up, whether or not the element carries a subject, because a linked collection heading carries none. The caller presses again once the screen has settled. focus: is unaffected.
  • A key move followed by a quick OK keeps today's behaviour.

The carousel holds still under a hero press

A press on a hero button commits about 200 ms after OK goes down (MIN_DIP_MS plus COMMIT_MS), and it reads the shown title only at the commit. The carousel's 8-second countdown kept running in that window, so a turn inside it played the next title. A person pressing OK just before a turn could hit this too. Now, while a press is armed on a hero button, the countdown restarts from full. A Flip request or an edge key in that window is refused, and the caller sends it again once the press has settled. The next automatic turn comes a full interval after the press.

The dispatcher reads the live focus and press

Two reads were taken before the frame's inputs were drained.

  • A by-id press resolved against the focus from before an earlier key in its batch moved it ([Down, press:X]). Ordinary deliveries already read the live focus.
  • Every delivery read the press state from before the drain, so a screen's tick did not see a press armed in the same frame.

Both are now read at the delivery's own position. Tests in plx_ui and through the real app pin each, and the replay fixtures are unchanged.

Captures

tools/watchlist_captures.py and tests/scenarios/watchlist_captures.json.

  • No capture walks with direction keys any more. w6/hold-menu focuses home.shelf.2.card.0, holds OK and checks that itemmenu.go_to_item is focused.
  • Every by-id token and every expect_focus is validated before the app boots.
  • Before each shot, the focus is checked through state. Any a11y: refused line fails the capture.
  • The scenario's title presses name their titles: press:itemmenu.watchlist_remove@2001, press:home.hero.watchlist@200622 and press:detail.hero.watchlist@1001.
  • A capture that failed before its shot used to crash the whole run. It now prints FAIL and the run continues.

tests/player_shots.sh presses the HUD controls and tabs by id. send right stays, because raising the HUD is that step's subject. On a clip without chapters, the chapters tab's refusal is handled.

Docs

The tv-session and ui-sim skills, docs/agent-reference.md ("Remote-driving"), tests/README.md, rust-modules/ui/src/CLAUDE.md and the focusprobe.rs doc carry two rules:

  • prefer ids, and walk only where focus travel is the subject (fps walks, focus fingerprints, hold, timed keys);
  • the subject rule above, pointing to SUBJECT_BEARING.

The site video is unchanged. Its storyboard compiles to the frame-dump key schedule, and the film's subject is travel.

Verification

macOS simulator (debug, with devtriggers, against the mock PMS and the mock plex.tv/Discover stand-in):

  • Captures. All 25 Watchlist captures pass their expect_focus and produce their shots, with no a11y: line and no panic.
    • Re-running with a bogus expect_focus made each check name the real focused id, so the checks are not vacuous.
    • The three writes the captures expect reached the mock.
    • After the subject changes, the three title-pressing captures were re-run; they pass and their writes reached the mock.
    • A scratch copy of w6/detail-added naming the wrong title failed with a11y: refused press detail.hero.watchlist subject_mismatch owner=detail.
  • Pixel identity. I compared home-bookmark-tab-focused by id (focus:nav.watchlist) against the old walk (up, right, right, right): 8 shots each, interleaved, all 64 pairs.
    • Outside the dev fps counter, the largest channel difference is 2/255.
    • Two shots of the same variant differ by the same amount, so this is the noise floor.
  • Guard.
    • A bare press home.hero.play exits 2 and sends nothing.
    • A wrong --subject is refused as subject_mismatch.
    • The right one, read from state, plays the mock's item.
    • The same holds for a Play Version row and a quality rung.
  • Home's door.
    • From hero Play, press:home.shelf.1.card.0@960005 opened that card's Detail, and the mock saw no request for the hero's title.
    • From the card, press:home.hero.play@200622 played the hero's title.
    • With the page resting on the hero and focus on a Continue Watching card, one write of down plus press:home.shelf.1.card.0@960005 was refused as unloaded, and nothing was requested. The same press at rest opened the card.
    • The simulator draws Home at 11-15 fps, which is too slow to reach the old bug's window, so the first two pass on the old code too. The discriminating tests are in screens and the app crate. A bare press of a linked heading, which activates on OK down, and the app-crate test that drives the real Home through the real dispatcher with [Down, press:<card>@<rk>] fail on the old code at any timing. The 60 fps card test commits at 100 ms, earlier than the press machine's ~200 ms, standing in for a stalled frame that leaves the page behind the press clock. It fails on the old code only because of that early commit. All pass on the new code.
  • tests/player_shots.sh. Every press:player.* was accepted. The chapters tab was refused as unknown on a clip without chapters, and the script skipped that shot as designed.

Television. I ran this on a debug ARM build of e4cb24c merged with main at the time. It booted --guest --mock against the synthetic mock PMS, and the lease lasted under 4 minutes, muted.

  • focus nav.watchlist, then state: the nonce matched, and the file read back with nav.watchlist focused.
  • press nav.profile opened the account menu, focused on account.change_profile.
  • press account.change_profile opened the profile picker, focused on profiles.back. No profile was picked, and one back returned to Home.
  • press home.shelf.0.card.0 without --rk exited 2 locally and sent nothing.
  • tv-session.sh selftest passed under the lease.
  • An unknown id logged exactly a11y: refused focus nav.nosuchelement unknown owner=home: an id, a reason word and the owner, with no label or title.

The later commits add element subjects and Home's door fix, both covered by host tests, and tighten host-side checks in tv-session.sh, which its self-test covers in ci/test_tv_session.py. The token path to the set is unchanged.

Gates

On the committed head 9a4beb7:

  • tests/test_a11y_tool.py: Ran 69 tests OK
  • ci/test_tv_session.py: Ran 48 tests OK
  • tests/test_mock_pms_discover.py: Ran 24 tests OK
  • tests/test_replay_fixtures.py: Ran 22 tests OK
  • tests/test_site_video.py: Ran 150 tests OK (skipped=3)
  • tests/test_harness.py: Ran 746 tests OK
  • ci/check-localization.py: green.
  • ci/check-deps.sh: all gates green
  • ci/check-module-layers.py: green.
  • make check-nodef: green.
  • make check-replay: 6 fixtures, 12 replays, SAME=4 REFUSED_EXPECTED=8 unexpected=0
  • Rust suites. The skipped tests in the runs below segfault on this Mac, on main too, and pass in CI.
    • plx_screens: test result: ok. 2270 passed; 0 failed; … 1 filtered out
    • plx_ui: test result: ok. 1753 passed; 0 failed
    • App crate (hostsim): test result: ok. 1687 passed; 0 failed; … 2 filtered out
    • plx_appkit and plx_media at b10513f, untouched since: 960 passed and 2155 passed; … 104 ignored

The Rust changes are the subjects, Home's door and carousel fixes and the dispatcher's live focus and press reads, in ui (the dispatcher), screens (home, detail, item menu, versions panel, registry, player), appkit (HUD commands, More menu, track menu) and media (route::retry_rk, a read accessor), plus doc comments. There is no Makefile, Cargo or workflow change, so there is no build-bench table.

🤖 Generated with Claude Code

GLinnik21 and others added 30 commits November 17, 2026 17:38
…erage table)

plx_ui::a11y holds the id grammar (`<ns>.<path>`, ns [a-z][a-z0-9_-]*, segments
[a-z][a-z0-9_]* or a decimal index), A11yPath (built from &'static str names and
indices, parsed from a test's text for comparison only), Role, A11y,
default_walk and the conformance suite (every element projects, ids unique per
view, a11y_find inverts a11y including off-screen elements, a11y_elems matches
GroupSpec.len).

Focusable gains the three defaulted hooks a11y, a11y_elems and a11y_find;
Screen gains a11y_ns (defaults to name()); composed_a11y* delegate through
layout() parts and both focusable_via_* macros forward the hooks (the view macro
hands back an owning projection, since its view is a temporary).

The screens crate gets the coverage table: an exhaustive match over every AppArg
arm (and ContentArg and SettingsPage), all Pending, so a new screen fails to
compile until it is tabled. No behaviour change: nothing produces or reads ids
at run time yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e Watchlist options menu

catalog.primary (the pill, subject = the record's hex), itemmenu.<row> named by ItemRow
(itemmenu.version.<n> on the Play Version page), watchlist_menu.<row> named by OptionsRow.
Each view runs a11y::conformance in its host tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t the player, collection and person pages

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ing deck and the linked headings

hero.play|info|watchlist, shelf.<row>.card.<col>, continue.card.<col>, shelf.<row>.heading and the
plaintext question's alert.cancel|connect; a card's subject is its ratingKey. By::Script is a
deliberate arrival like Dir at the strip-chosen and hero-rotation sites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every FormId of the Settings family (root, language, diagnostics, under
posters and its details picker, playback and audio fields, legal index,
privacy rows, account menu) answers a static a11y name per variant. A
variant that repeats in one form (a server's plaintext switch, a language
choice) answers None: its position names it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ty ids

tracks answers body; Also available and Play Version answer row.<n>, the
position among the focusable rows (what GroupSpec::len counts).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Login answers control, details and the alert's answers (alert.cancel,
alert.send) for the group it declares now. Profiles answers the roster
under roster.<the shared shelf's id> (labelled with the profile's name),
sign_out and back for the footer and the read-out, and the PIN pad as
pad.digit.<n> / pad.delete; the pad group's len now counts its eleven
keys, not its twelve cells, because the hole is no element. Onboard
forwards the three hooks through its view to the shared table screen, and
all three mountings keep the one namespace `onboard`.

Each screen's hand-written groups run a11y::conformance in host tests.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…eir own id namespace; By::Script at the Detail and Library arrival sites

filmography.tab.<i> and filmography.row.<i> (a held copy's ratingKey is a row's subject), a11y_ns
overrides for Filmography and Recommended (their name() words are shared), and By::Script treated as a
deliberate Dir arrival in detail/mod.rs, library/mod.rs and library/recommended.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RouteSurface forwards to the top page and answers the top page's namespace;
RootPage, the Playback picker, the HUD page and the consent view answer
their alert's two answers alone while it is open (AlertAnswers, written once
in plaintext_question beside PlaintextAlert's own hooks); the HUD preview
answers back and scene.<i>; the account menu answers one row per action.
DocumentPage and PreviewPage answer namespaces of their own so no two
screen types of the family share one. A script's arrival on a HUD row is as
deliberate as a key's.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Surface-level conformance and namespace uniqueness over every page the
Settings surface mounts; the preview's back and scene.<i> controls; the
delete alert's alert.cancel / alert.delete answers alone; the account menu's
rows; AlertAnswers; every FormId's names valid and distinct; a script's
arrival ends the HUD page's provisional focus as a key does.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The player names its elements from the HUD's own groups and slots: scrub,
control.<word|i>, tab.info|chapters, section.<i>, chapter.<i>,
failure.<action>, repair.cancel|confirm. The overlay forwards the active panel's
part. about and bio declare no group and conform vacuously.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The HUD census runs a11y::conformance for every occupant (discs, Skip, Up Next,
read-out, chapters). Collection, Person and Search run it over their card-harness
mounts: their ids are the stack's own, and these tests are what holds them to it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Dispatcher::a11y_snapshot is a pure projection of the input owner (page composed with the strip):
route word, owner kind, focused full id, every group (prefix, len, role) and every element with
rest_rect, visible, focused, loaded, label and subject (an unloaded element carries no text), no
cap. The projection is a free function over any Focusable, driven in host tests by a hand-written
view.

The app parses state:<nonce> in ingress_token before dispatch_remote_token (no damage, not
recorded), keeps the latest nonce in a one-slot frame-thread cell, and serves it at the frame tail
(run.rs::report, which both the presented and the skipped path reach). The JSON is built in the app
and written by one storage_worker job through the fixed temp name: stale temp removed, create_new
0600, rename over plxnative-a11y.json. Both names join DIAG (49 -> 51) and runtime_file::LOGS
(9 -> 11); the whole module is devtriggers.

tools/a11y.py (send, state, wait_for) waits until the file names the nonce it sent;
tests/test_a11y_tool.py grades that matching with a fake clock and a real FIFO.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SectionSpec takes an optional static name (named / named_at), defaulting to
section.<i>. The card stack projects <section>.card.<j> for the cards of a
Shelf or Grid and <section>.<leaf|n> for the focusable elements of a Custom or
Overlay section (StackPage::plain_name names a leaf), with an indexed
a11y_find and a11y_elems; CardSource::subject (defaulted) carries the card's
ratingKey. PageWithStrip names the strip pills (nav.home|movies|shows|search|
profile|watchlist, nav.tab.<n>), qualifies the page's relative ids with the
page's a11y_ns and routes a11y_find by namespace. The More and Track menus
name their rows by identity, through shared popover_a11y helpers. By::Script is
a deliberate arrival at the card sites that treat By::Dir as one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…rms and the page header

Shelf (card.<i>), Table (row.<i>), TabRow (tab.<i>), Grid (shelf.<r>.card.<c>) and Document
(document) project, enumerate and find their elements; indexed widgets answer a11y_find by the
index they parse. TablePart (plain and form-backed), BandPart (band.<i>), DocumentFocus,
DocumentPart and the composed TableScreen/DocumentScreen follow; a form-backed group's len now
counts its keyed rows only (a separator or note has no key, so no element).

FormId gains a11y() -> Option<&'static str> (default None = row.<index>), carried beside the
binding through Form::map and exposed by RowKeys::a11y_name. HeaderItem gains an optional a11y
name (the sort control is 'sort'); HeaderRow projects its stops under header.*. MasterDetail
delegates the three hooks to its parts; LinkedHeading::a11y gives the shared button projection.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ivery)

Workstream C of the accessibility-id plan (a11y-ids D3/D5/D6/D7). A UI test can now
focus or press an element by its id instead of walking keys to it.

- machine: InputKind::ById{id, press: Option<OkTap>, expect}, OkTap, By::Script
  (Canon tag 9).
- ui dispatcher: a by-id input is intercepted at its ORDERED delivery position
  (dispatch/by_id.rs), resolved against the input owner's view only (namespace,
  a11y_find, a11y, place, loaded and subject guards), then expands to a
  FocusMoved{by: Script} and, for a press, the OK Down/Up a remote OK is.
  A refusal moves no focus, emits no key and logs one id/word line. Every by-id
  input yields exactly one Id resolution through ReplayAuthority::resolve_id.
- recording: one tap per input (bootstrap::effects encoder and decoder, the
  fixture codec), a ProductResolutionV2 Id row, the family-based resolution
  identity, validate_resolution_recording pairs Id rows with by-id inputs over
  the recording, and By::Script is code 4 (refused in a Focus row).
- FIFO: devtriggers-gated focus:<id>, press:<id>, press:<id>@<subject> parsed in
  ingress_token after a drain_sdl; a malformed id is refused with one remote: line.
- shapes: STATE_SHAPE gains ById and the Pan it had left out; ProductResolutionV2
  is current and V1 is kept for the frozen historical vectors. The fixture pin and
  the APP_SHAPES pin move; ALPHABET.json gains the words and the id pattern.
- fixture: FixtureRow and FixtureModal project ids; tests cover focus, press,
  refusals, batch ordering, an element past the canvas edge and record/replay in
  both modes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ts like `drive`

`replay_mode` registers Home's two inflight requests after the first frame, so the
recording scenario must do the same for the by-id record/replay test to compare like
with like. Also corrects the scenario's doc comment to the order it actually runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ings

The route of an A11ySnapshot is the top PAGE's heartbeat word (Screen::name), also while a surface
owns input (ns names the owner), with a fixture test that opens the modal and tells the two apart.
The symlink test lists directory names in sorted order, and the no-log scan avoids the spelling
the libm lint reads as a float ln.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The writers matched By::Script, which only exists once the write side
(plx_machine::machine::By) lands. The ids layer keeps the pre-Script arms; the
runtime layer reverts this commit after merging the write side.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	rust-modules/src/app/run.rs
This reverts commit 8e83a06: By::Script exists now that the write side is merged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…1y tool test in CI

plxnative-a11y.json and its temp name are named by release code for erasure (paths::runtime_file::LOGS)
and sit in DIAG; tests/test_a11y_tool.py joins the python steps so ci/test_ci_split.py sees it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 and others added 23 commits November 18, 2026 00:14
…gs and reports the failure

A `w6/x.png` capture whose expect_focus (or FIFO wait) fails gets to its finally before
the shot's own mkdir ran, so copying <stem>.log/.out raised FileNotFoundError: the
Failure was hidden and the whole run ended with a traceback instead of a FAIL line and
the next capture. The finally makes the directory first. The new test fails without it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…and an exit code

Run against the simulator, `a11y.py focus <runtime> Bad.Id` and a bad `--subject` ended
in a ValueError traceback, and `expect`/`state` with no app, or a runtime without a FIFO,
in a TimeoutError/FileNotFoundError one. main() now says one line: exit 2 for an id, subject
or token the grammar refuses (nothing sent), exit 1 for a focus mismatch, a silent app or no
FIFO. watchlist_captures also closes the mock's listening socket after each capture.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… test module)

rust-modules/screens/src/a11y_coverage_tests.rs does not exist: the table is the
#[cfg(test)] mod a11y_coverage_tests in registry.rs (coverage(), an exhaustive match over
AppArg), and a new screen fails to compile in the TEST build, not the product build.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… quoted for the remote shell

tv-session.sh press refused only `*.card.*` without --rk, but Detail's episodes
(detail.episodes.still|text.<i>, Role::Card with the episode's ratingKey as subject) are
pressed the same way and OK on a still PLAYS it at once, so the real-account rule (never press
OK on a title whose ratingKey you have not read) was open for them. The guard now covers every
element that carries a subject, read off the production A11y::with_subject calls: cards
(*.card.*), Detail episodes and season tabs, Filmography credits and the catalog pill.
tools/a11y.py's CLI press (and send press:<id>) takes the same guard (--subject, exit 2,
nothing sent) from ONE list there (SUBJECT_BEARING); the library press_token stays unguarded so
the mock scenario can press a coming-soon card whose subject is null. Tests hold the two lists
(a11y.py, tv-session.sh) equal and the production with_subject sites equal to the sites the
list was derived from.

fifo_send single-quoted its argument into the remote command, so an apostrophe in a word that
cmd_key or click forwarded (a txt: token) broke the remote quoting. It now escapes the POSIX
way and refuses a newline, selftested by a round trip through sh -c, and ci/test_tv_session.py
grades the script's own selftest (every other case there sources it and never read its verdict).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…s say what is true

w6/hold-menu.png walked Down four times from the Home hero with no expect_focus. Measured on
the simulator against the mock (guids: all, heropin 0): after the four Downs the focused id is
home.shelf.2.card.0, and a hold there opens the item menu on itemmenu.go_to_item (route home,
input owned by the surface), the same picture. The capture is now focus:home.shelf.2.card.0,
hold, with expect_focus itemmenu.go_to_item; KEPT_WALKS and its test are gone, NO_EXPECT loses
the entry, and a test names w6/detail-offline.png (pointer clicks, ck:) as the one capture that
navigates by pointer. The driver docstring, the scenario comment and tests/README.md said no
direction key stands between boot and target and that a capture may leave expect_focus out when
no id is read for its target: each now says exactly what holds. The driver also closes the
simulator console handle it opened (a ResourceWarning that surfaced in a later test under 3.15).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…oor, count the subject calls

Review of #1442 found three holes in the "never press OK on a title whose ratingKey you
have not read" guard.

1. The Home hero buttons (home.hero.play|info|watchlist) and every item-menu row
   (itemmenu.<row>) acted on a title but carried no subject, so the guard could not name it.
   Each hero button now carries the shown hero's ratingKey (the carousel advances by itself,
   so a bare press acted on whichever title was showing), each item-menu row the menu item's
   (none for a Catalog menu, a Watchlist title no server holds; none for home.hero.action,
   the failure read-out's retry). Both are built from the ratingKey only. `home.hero.*` and
   `itemmenu.*` join SUBJECT_BEARING (tools/a11y.py) and a11y_subject_bearing
   (tools/tv-session.sh); detail.hero.* stays unguarded. The two scenario presses name their
   titles: press:itemmenu.watchlist_remove@2001, press:home.hero.watchlist@200622.

2. `tv-session.sh key press:<card>` sent a title's press with no subject, and a FIFO word
   with a space in it (`key "back press:<card>"`) became two tokens in the app, the second
   past every check (remote.rs cuts at ASCII whitespace and then at any Unicode whitespace).
   `key` now refuses a focus:/press:/state: word (the three verbs are their one door), and
   fifo_write refuses ANY whitespace in a token, ASCII or Unicode, before anything is sent.
   a11y.py's raw `send` refuses it too. The doors judge every word before sending any.

3. test_a11y_tool.py tabled the FILES that call with_subject, though its text says one entry
   per call site: it now holds the COUNT per file, including the new home and item_menu sites.

Tests: screens (hero and item-menu subjects), tv-session selftest (the key doors, the
whitespace set, the new guarded ids), ci/test_tv_session.py, tests/test_a11y_tool.py.
Docs: tv-session and ui-sim skills, agent-reference, tests/README, ui CLAUDE.md.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The selftest's lines start with an ANSI colour escape, so a startswith on the cross never
matched. RC:0 and the contract lines already fail on any failed check.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
home.hero.* is now the three explicit ids home.hero.play, home.hero.info and
home.hero.watchlist in SUBJECT_BEARING and a11y_subject_bearing. home.hero.action, the
failure read-out's retry, acts on no title and stays pressable bare. itemmenu.* is unchanged
(a Catalog menu's rows have no ratingKey and stay unpressable through the guarded tools).
The selftest, tests/test_a11y_tool.py (including the per-site table's glob check) and the
texts that named 'a Home hero button' follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…hey act on

The previous round exempted `detail.hero.*` as "reached only through a named route". That was wrong: the
route names the page's item, and a hero control does not always act on it. Mark watched / unwatched write
view state for `hero::hero_episode(d)`, the on-deck episode of a started show, so a chain `press
detail.episodes.text.0 --rk E`, `press detail.hero.go_to_show`, `press detail.hero.mark_watched` marked an
episode nobody named; Play and Restart play a title, the bookmark writes to plex.tv.

`hero_control_subject` (screens/detail) is the one rule for which ratingKey each hero control acts on, an
exhaustive match over `HeroCtl`, and both the projection (`with_subject`) and the Mark activation read it,
so the subject the harness names is the key the press writes. Play and Restart: the on-deck or first episode
of a show, the loaded card or the page's item otherwise; Mark watched / unwatched: the on-deck episode of a
started show, else the page's item; Watchlist and Trailer: the page's item. Go to Show, Also available,
Play Version and More only navigate or open a menu or panel and stay bare.

The six ids are listed explicitly (not `detail.hero.*`) in `SUBJECT_BEARING` (tools/a11y.py) and
`a11y_subject_bearing` (tools/tv-session.sh); a test reads the screens test's control table back so the two
cannot drift from the controls. The scenario's `w6/detail-added.png` names its press,
`press:detail.hero.watchlist@1001`. The selftest and test_a11y_tool.py hold that a bare hero Play and Mark
watched are refused and a bare Go to Show goes out; the sentences that named the guarded set or called
Detail exempt now say the six.

`tv-session.sh`'s usage text was `sed -n '3,60p'`, which stopped inside `--remote` once the header grew.
It now runs to the line that opens the prose (`usage`), and `selftest_usage` holds that it starts at the
title and ends on the `--keep` row with the `--remote` entry whole. `ui/src/a11y.rs` described the subject as
"the ratingKey of a catalog card"; it is the ratingKey of the title the element acts on.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…l_subject's doc names the unguarded Play Version rows

The id table's opening paragraph listed what each subject-bearing button does and had no Detail hero entry.
The doc of `hero_control_subject` said the rows a menu-opening control opens are "where a title is acted
on", which reads as if they were guarded: a library item's menu is, the Play Version panel's
`versions.row.<n>` (OK delivers `AppMsg::PlayVersion`, which plays) is not.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…e, with a census

The guard was grown one id per review (Home hero, Detail hero, ...). This closes it by
sweeping from the messages to the elements and by making the missing ones fail a test.

Sweep: every Focusable whose activation constructs Play, PlayVersion, a queue step, a
restart, a retry, a quality re-resolve, a track or subtitle write to the server, a watched /
watchlist write or the catalog write (in every screen and panel). Guarded = it carries a
subject built from the ratingKey the activation reads, and its id is in SUBJECT_BEARING
(tools/a11y.py) and a11y_subject_bearing (tools/tv-session.sh).

id shape | message | ratingKey it acts on | guarded before this round? | action this round
*.card.* (Home, Library, Recommended, Search, Watchlist, Collection, Person, Detail Related/Extras/Cast) | Detail open, HomeReq/LibraryReq::Play, PlayIntent::Item | the card's own key (CardSource::subject) | yes | none
detail.episodes.still|text.<i> | play_episode_at / open | the episode's key | yes | none
detail.season.<i>, filmography.row.<i> | select / open | season, local copy key | yes | none
catalog.primary | AppFx::Catalog(Add|Remove) | the hex id | yes | none
home.hero.play|info|watchlist | HomeReq::Play / open / WatchlistAdd|Remove | the hero item | yes | none
home.hero.action | the failure read-out's retry | none | bare (no title) | none
detail.hero.play|restart|trailer|mark_watched|mark_unwatched|watchlist | ContentReq::Play, Write::Watched|Unwatched, WatchlistAdd|Remove | hero_control_subject | yes | none
detail.hero.go_to_show|alt|version|more | navigation / opens a panel | none | bare | none
itemmenu.<row>, itemmenu.version.<n> | item-menu Action (play, mark, remove from deck, watchlist) | arg.rk | yes | none
versions.row.<n> | AppMsg::PlayVersion -> play_hero | the Play pill's key (hero_control_subject(Play)) | NO | guarded: registry::versions_subject, versions.row.*
player.control.previous|next | PlayerReq::Command(Previous|Next) -> queue_transport::step | queue_neighbor(ps, step).rk | NO | guarded: HudCommand::plays_rk
player.control.next_episode | StandIn -> play_up_next | up_next(ps).rk | NO | guarded
player.control.from_beginning | PlayerReq::Command(FromBeginning) | cur_rk(ps) | NO | guarded
player.control.skip | StandIn -> perform_skip_prompt (a final credits segment finishes the item) | cur_rk(ps) | NO | guarded
player.control.<i> (an id spelled by position: a package placing a command twice hides its word) | any of the above | its command's key, else cur_rk | NO | guarded whole: player.control.[0-9]*
player.section.<i> (the Info card's buttons) | PlayerReq::Command(from_beginning|go_to_detail) | its command's key, else cur_rk | NO | guarded whole: player.section.*
player.failure.try_again|play_automatically | RetryPlayback / PlayAutomatically -> route::retry_current_play | ps.request.rk (route::retry_rk), NOT cur_rk: the request is recorded when the play is asked for, cur_rk only when its plan lands, so a play that failed earlier differs | NO | guarded
more.rung.<name> (the Quality page) | PlayerReq::More(SetQuality) -> failed: retry_failed_playback of ps.request; live: route::set_quality re-resolves | failed: retry_rk; live: cur_rk (quality_pick_subject) | NO | guarded: more.rung.*
more.fold.previous|next|from_beginning | PlayerReq::Command via Action::Hud | HudCommand::plays_rk | NO | guarded: MoreMenuPart::action_at
menu.audio.<i>, menu.sub.<i>, menu.off, menu.forced | PlayerReq::CommitTrack -> route select_streams (PUT /library/parts/{id}) | cur_rk (the playing item's part) | NO | guarded: TrackRow::writes_title
menu.hit.<i> (a subtitle-search result) | SubSearchCmd::Download -> PUT /library/metadata/{rk}/subtitles | cur_rk | NO | guarded: TrackRow::writes_title
player.control.play_pause|seek_*|subtitles|audio|more|chapters|info|go_to_detail|watch|watch_credits; player.tab.*; player.chapter.<i>; player.scrub; player.failure.change_quality|repair|back; more.quality|speed|stats|rate.*|fold.<other> | transport, panels, local settings, a speed (a URI speed pick re-resolves the playing request through request_viewer_reconfigure, which needs a proven playhead and refuses without a live attempt) | none | bare | none (tests/player_shots.sh presses only panel openers)
menu.boost|loudness|timing|style|field.*|<field>.<n>|search|search_language|retry|other|lang.*|language.* | live-stream reconfigure (the same request_viewer_reconfigure), a page, a local setting | none | bare | none (TrackRow::writes_title says false, an exhaustive match). The discriminator: only a quality rung can START a title from a failed session (it retries ps.request); the reconfigures cannot
alt.*, tracks.*, watchlist.* page and menus, library header/menus, settings.*, account | navigation or query edits | none | bare | none
Catalog item-menu rows | WatchlistAdd|Remove, GoToCatalog | none: a Watchlist title no server holds has a guid, no ratingKey | unpressable through the guarded doors | none

The key is read from the session / metadata view the way the activation reads it, derived
in a11y() from the frame's views: no state added to a screen (the recorded SHAPE of
VersionsPanelScreen is unchanged), no IO.

The census regex also holds PlayerReq::CommitTrack and SubSearchCmd::Download: only
screens/src/player/overlay.rs and appkit/src/track_menu.rs construct them. menu.hit.* names cur_rk,
which is the key the download PUTs for: the overlay re-opens the search store on (cur_sid, cur_rk)
whenever its item differs, and the PUT quotes the rk the store was opened with.

A systematic check: tests/test_a11y_tool.py now also reads every non-test file of the
screens, appkit and ui crates, finds those that construct a title-acting message and holds
that set equal to a table naming the SUBJECT_BEARING entries guarding each. A new Play,
queue step or write in a new file fails there until it is guarded or explained.

The prose that listed the guarded set (skills, agent-reference, tests/README, ui CLAUDE.md,
tool headers, the refusal message) now states the rule and points to SUBJECT_BEARING as the
one list.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Conflict: rust-modules/screens/src/detail/mod.rs. Main (#1457) replaced the hero's
hero_episode_played(d) with Detail::play_episode() (the same rule: the resumed episode, else
the season's first) and deleted the helper; this branch's hero_control_subject read the
helper. It reads d.play_episode() now, so the subject of Play and Restart (and of the Play
Version rows, play_subject) is still the key play_episode_value / hero_versions act on.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…grid door; the rule's wording says what it guards

Home keeps a picture-versus-engine remap (`visible_activation`) so a human's quick
OK after a Dir key across the hero/grid door activates what the picture still
shows. A by-id press put FocusMoved, OK Down and OK Up at the front of ONE frame,
before the dive had run a tick, so the remap applied to it: `press
home.shelf.2.card.0@<rk>` from the hero's Play played the HERO item, and
`press home.hero.play@<hero rk>` from a shelf opened the card the page came from.
The subject check passed on the named element while another title started.

Two changes, both shared semantics, no state field and no SHAPE change:

- FocusMoved with `By::Script` clears `visible_activation` on every Script move
  (a stale value an earlier key left does not survive a same-page Script move
  either). The dive still runs: the remap is where a press lands, not the
  picture, so the snap is not jumped (`activate()` reads nothing else that
  depends on the picture).
- A by-id press on the element focus ALREADY rests on emits no FocusMoved
  (`FocusEngine::set` answers Nothing), so `[Down, press:X@rk]` kept the remap a
  key left. Home's `a11y` now projects, for the engine's focused element, the
  subject of the element `activation_elem` says its press lands on (and its
  `loaded`), i.e. "the ratingKey of the title the press acts on", so the
  dispatcher refuses the press that names the other title (`subject_mismatch`).

Only Home has the pattern (`visible_activation`/`activation_elem`; the other
By::Script consumers only treat it as deliberate, like Dir).

Tests (red on b10513f, green here): a scripted arrival on a card across the
door presses that card; the reverse presses the hero; a same-page Script move
clears the remap a key left; a key then a quick OK still lands on what the
picture shows (human behaviour kept); the focused element's subject is the title
its press lands on, in both directions.

Wording (the guarded rule was stated as "plays or writes; navigation stays
bare", which `home.hero.info` and `filmography.row.*` contradict): an element
whose press acts on a title it names, including one that opens that title's own
page or menu where the title can change under the press, carries the ratingKey
of the title the press acts on; only a control whose target the page fixes
carries none. Restated by that rule, with a pointer to `SUBJECT_BEARING`, in
ui/CLAUDE.md, agent-reference, the tv-session and ui-sim skills, tests/README,
a11y.py, tv-session.sh, watchlist_captures and ui/src/a11y.rs. agent-reference
now says exactly where the guard is: `tv-session.sh press` and the command line
of `tools/a11y.py` (`press`, `send press:`) refuse; the library `a11y.press()` /
`press_token()` are unguarded on purpose, and a script importing them against a
real server has no check.

Census: `TITLE_ACTING` also reads `Write::RemoveFromDeck` and the item menu's
actions (`ItemMenuAction::{Play, PlayFromStart, PlayTrailer, PlayVersion,
MarkWatched, MarkUnwatched, RemoveFromDeck}`), including under the
`ItemMenuAction as Action` import Detail's hero and Home use. It still lists
every constructing file.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ision runs

The by-id press's OK is held for the press machine's 90 ms dip floor, which is
six 60 Hz frames (100 ms); the page's snap spring has crossed only 41% of the
door by then (its midpoint is 119 ms away), so the remap a key's arrival leaves
is still live when the commit lands. The screens test that pins it runs the real
frame spacing: a scripted arrival on a card, six 16.667 ms ticks, then the
commit. It is red on b10513f's Home (the hero's item plays) and green here.

The simulator cannot show the unfixed behaviour: its Home draws at 11-15 fps
(software rendering, still ~12 fps in an optimized host build), so the dive is
past its midpoint by the second frame and the old code also passes a by-id press
there. A mock-only simulator run of the fixed tree (hero Play to a shelf card
opens that card; a shelf card to the hero's Play plays the hero) is in the
handback; this test is the deterministic red/green.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…d land elsewhere; a by-id press reads the live focus

Home's hero/grid door remaps a human's quick OK to what the picture still shows. A by-id press of the
element focus already rests on moves nothing, so the scripted-arrival clear never runs, and the round-5
subject swap protected only elements that carry a subject: a bare press of a linked collection heading
(no subject) after a Down from the hero played the hero, and after a Down from a Continue Watching card
resumed the card.

Home's `a11y` now projects the focused element `loaded: false` while `activation_elem(key) != key`
(its own subject kept), so the dispatcher refuses ANY by-id press of it as `unloaded`, subject or not,
until the picture catches up. `focus:` asks no `loaded` and is unaffected. The human Dir-then-quick-OK
remap and the scripted-arrival clear are unchanged.

`resolve_by_id` asked the view with the context built BEFORE the drain, so in a `[Down, press:X]` batch
the focused-element rule read the focus from before the Down and let the press through. It now reads the
engine's focus as the delivery position finds it (red on the old read: the dispatcher test refuses nothing).

Wording that claimed the door "cannot press a different title" / "refused, never played" now says what
happens: while Home's picture lags its focus a by-id press of the focused element is refused as `unloaded`
and the caller presses again once the screen has settled.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…sure the lag the prose quotes

An app-level hostsim test drives the real Home through the real dispatcher with `[Down, press:<card>@<rk>]`
in ONE batch: the press is refused as `unloaded`, focus moved, nothing opened or played; once the picture has
settled the same press opens the card's title. Red when `resolve_by_id` asks with the pre-drain focus (no
refusal is logged), green with the live read.

A screens test measures how long the lag lasts in both directions (8 frames, about 130 ms at 60 fps: the snap
spring's midpoint), and the prose says that instead of an unmeasured figure.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… the press where it runs

A hero control is a Control: OK arms a press that commits a dip (about 200 ms) later, and its
activate re-reads the title the billboard shows at the commit. Pressing the control that already
has focus moves no focus, so nothing restarted the 8 s countdown; if it ran out inside the dip the
page turned and a press accepted against one title (`press home.hero.play --rk X`, or a person's OK
a moment before the turn) played the next page's.

- Home: `hero_press_armed` reads the press machine through `cx.press` (live, and the owner is one of
  this page's hero controls), and `flip` refuses while it is true. Every turn goes through `flip`:
  the 8 s countdown (left byte-identical, so `hero_auto` and the SHAPE string are unchanged and the
  turn happens on the first tick after the press settles), `HomeCmd::Flip`, and Left/Right at the
  hero's edge (which moves no focus, so it never abandoned the press). `SelectHero`/`PinHero` (the
  dev scenarios' direct selection) and `reconcile_carousel` (the title left the pool) are not held.
- Dispatcher: a screen delivery reads the press as it stands at its position, as it already read
  the focus. `parts` is built before the drain and an OK-down arms its press inside it, ahead of the
  frame's own Tick, so that Tick read a press that was not live yet: the frame the press began on
  was the one frame the hold could not see.
- `loaded: false` documented as "not pressable yet" (Home's door lag one case), and that the state
  file then lists no label or subject, while `a11y` keeps its own; by_id.rs says what closes the
  commit-time race ("The dip is the screen's"), and the tv-session skill and DESIGN.md say why a
  moved hero cannot press a different title.

Tests: the screens trio (a press in its dip plays the armed title with the countdown run out inside
it; the carousel still turns on schedule with no press, a press on a card, another page's hero or a
cancelled press; a cancelled press releases it; Flip and the edge key wait too; the predicate over
the three slots), a dispatcher test that the arm frame's Tick reads the press live, and an app
hostsim test that delivers `press home.hero.play@X` in the very frame the carousel turns on and
asserts X plays (red with either half removed: it played the next title).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…o turn is owed when it settles

Round 7 made the carousel refuse a turn while a press stands on a hero control and left the
countdown run out, so the turn fell due on the first tick after the press settled. After Play or
Info that tick is often the person's return to Home: the carousel slid as they came back.

A press on a hero control is a deliberate interaction, so Home's Tick now restarts the countdown
from its full length every tick the press stands (`HomeScreen::restart_hero_countdown`, the one
reset a turn, an uncover, a Dir/Pointer/Script focus move and a page off the hero already made,
now spelled once), as a focus move does. No turn is owed afterwards: the next one comes a full
interval after the press. `flip()` still refuses while a press stands, which covers
`HomeCmd::Flip` and Left/Right at the hero's edge, and the shared press refresh in the
dispatcher's delivery is unchanged. Without a press the decrement is the same arithmetic, so the
schedule and `hero_auto`'s hashed value are unchanged.

Tests: a Play or Info press with the countdown about to run out inside its dip plays/opens the
armed title and holds `hero_auto` at its full length, the page then turns only a full interval
after the press settled (1 frame after, before this change); a cancelled press releases the hold
and the countdown runs from the restart; the no-press schedule, the edge key and Flip are as
before. Prose that described the deferred turn (code docs, by_id.rs, the tv-session skill,
docs/DESIGN.md) now describes the restart.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21 GLinnik21 changed the title UI tests: device and simulator scripts reach elements by id Reach elements by id in the harness; Home's carousel holds still under a hero press Nov 18, 2026
…ds, not held; the dip figure is the whole 200 ms

The prose in docs/DESIGN.md, dispatch/by_id.rs and the tv-session skill said `HomeCmd::Flip` and
Left/Right at the hero's edge "wait for the press". They do not wait: `HomeScreen::flip` refuses,
the page answers `Handled::No`, and the turn is dropped, not applied when the press settles, so the
caller sends it again. The three now say so, and the renamed test
(`a_manual_turn_is_refused_while_a_hero_press_stands_and_not_applied_after`) also asserts that the
page has not turned a tick after the press has settled.

Every figure that stood for the whole dip-to-commit now says about 200 ms after OK goes down
(`MIN_DIP_MS` 90 + `COMMIT_MS` 120): the `hero_press_armed` doc and the round-7 test doc said
"no sooner than `MIN_DIP_MS`", and the door test's doc used the 90 ms release floor as the commit
time; it now says the test commits earlier than the machine does. No behaviour changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 marked this pull request as ready for review November 18, 2026 14:14
@GLinnik21
GLinnik21 merged commit aea8752 into main Nov 18, 2026
17 checks passed
@GLinnik21
GLinnik21 deleted the a11y/harness branch November 18, 2026 14:21
tiper added a commit to tiper/fin-native that referenced this pull request Nov 19, 2026
Upstream's plxnative#1442 makes every hero control that writes to a title name it
for the harness's press guard; the favourite toggle writes the page's item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JLzd9SJCCZ5zFGv23XMA8h
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