Skip to content

ui: the tab row scrolls, so every library is reachable - #16

Merged
GLinnik21 merged 1 commit into
mainfrom
worktree-agent-a2b97c0056f6a02ee
Jul 30, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
worktree-agent-a2b97c0056f6a02ee

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Unit 10 — libraries past the fourth are unreachable

docs/parity-gaps.md §2 theme C. MAX_TABS = 5 ("Home + up to 4 sections") hard-capped the only
navigation we have into a library. Everything under it was already fine and provably so:
browse::ensure_sections discovers every movie/show section, browse::set_cur accepts any
index below the count, and /tmp/plxnative-library=N browses section 4 and beyond correctly. Only
the pill row could not address them — so a user with Movies / TV / Kids Movies / Kids TV / 4K Movies
had a fifth library the app knew about, could load, and could not open.

What changed

The cap is gone rather than raised — a bigger constant only moves the unreachable library further
out. The invariant in the old doc comment ("a pill that can't be drawn must never be focusable") is
kept, and now holds by construction instead: the pill strip scrolls horizontally, so every pill
can be brought into view, so every pill is focusable.

The treatment is ours, not the reference client's sidebar-with-an-overflow: the detail page's season
tabs already solve exactly this for a many-season show, and the tab pills are the same element by
explicit user directive. So the strip reuses that pattern — card_row::reveal minimal
scroll-into-view on a critically-damped spring at the season row's own stiffness (240). The track
stays centred and caps at a width that clears the profile chip on both sides; past that the pills
slide inside it, scissor-clipped at the pill area's edge (the bounded-panel clip case from
ui/CLAUDE.md, which doubles as the "there is more over there" affordance). A row that fits is
untouched
: no clip, no scroll, the same centred tvOS bar as before — so on a server with four or
fewer video libraries this change is invisible.

  • widgets.rs — MAX_TABS → tab_count() (the one source of the focusable pill count); pure
    geometry (tab_content_w / tab_view_w / tab_pill_x / tab_scroll_target), tab_row_update
    (the per-frame spring step both screens call) and tab_row_reveal (a jump, for screen entry).
    PILL_RECTS is a Vec of the pills clipped to the viewport, and that same clipped width
    decides whether to draw — one rule, so the scissor and the pointer can't disagree about a sliver
    at the strip's edge.
  • home.rs — the top-band clamp goes through tab_count(); home_update steps the strip; the
    profile chip now draws after the track (its unfurled name capsule and a wide track can now
    meet, and under the track the name was painted over).
  • library.rs — the Tabs-area walk goes through tab_count(); update steps the strip; enter
    reveals the entered section's own tab; the focused-pill expression is factored to one
    tab_focus() so draw and scroll can't disagree.
  • mod.rs — Rect::intersect, in the retui core where the next clipped hit test can find it.

Design note: what the strip does when the row is NOT focused

It tracks the selected pill rather than holding (this is where it departs from the season tabs,
which hold). The way back into the top band is the profile chip and then the Home pill — the strip's
left end — so a strip parked far to the right would be showing pills the next keypress cannot reach
without scrolling back anyway, under a row with no selected tab visible. Reveal is minimal-scroll,
so this is a no-op whenever the selected pill is already on screen, which is the whole of the
Library screen's life after enter placed it.

Known limitation, worth a follow-up if pointer parity matters: from Home's grid view, pointer
hover on the pills is deliberately disabled (it used to park focus on a tab so the next ENTER opened
a library), so a pointer-only user can click only the pills currently on screen. Every pill is
reachable by D-pad, and by pointer from the hero view where hover moves focus and the strip reveals.

Verification (host tier)

  • make check → 63 pass (+5). make (ARM cross-build) → clean, no new warnings.
  • The >4-section case is proven here, since the dev server cannot exercise it:
    • every_pill_scrolls_fully_into_the_strips_viewport — for 1..=16 pills and from any
      starting scroll (0, mid, negative, far past the end), the target for pill i puts that whole
      pill inside the viewport and never over-scrolls. This is the "no focusable index lacks a drawn
      rect" proof.
    • the_strip_scrolls_only_once_it_outgrows_the_row_and_only_as_far_as_it_must — a 4-pill row
      provably still fits and has no scroll range; a 12-pill row provably overflows, scrolls to its
      last pill, and holds for a pill already in view (at the start and mid-strip).
    • a_stale_pill_index_clamps_instead_of_panicking — graded on an overflowing row so the clamp
      has a real range: in-range scroll kept, over-scroll pulled to the end, negative pulled to 0.
    • top_band_focus_walks_to_the_last_section_whatever_the_count — for N = 1..8, RIGHT from
      the Home pill reaches the last pill and never lands on a non-pill; LEFT walks back through
      Home to the profile chip.
    • set_hero_focus_clamps_onto_the_last_drawable_pill — drives the real setter (the line the cap
      used to live on), not just the pure helper.
  • A correctness review pass ran over the diff before commit; its findings on the clipped-rect hit
    test, the &'static borrow out of the label cache (now a scoped closure), the off-focus scroll
    rule, the chip/track collision and two vacuous assertions are all folded in above.

Device verification: deferred to coordinator

Not run — the TV queue was centralised mid-task. Nothing here has been on the device.

How many video sections the test server has: TWO. 192.168.0.3:32400 returns three sections —
1 movie "Movies", 2 show "TV Shows", 3 artist "Music" — and ensure_sections skips
music/photo. So the row is 3 pills, which fits un-scrolled: the device cannot prove the >4
case at all
, and a device pass can only show non-regression of the shared row. Boot logs the
count itself as pms: nmovies=<n> nsections=2.

What to run, in one boot:

  1. ./tests/run.py --fps — covers library-scroll and library-switch, which drive the Library
    screen and switch_section, i.e. the shared row on both screens. No playback case is affected.

  2. One FIFO drive to walk the whole band. Boot with a picker-suppressing trigger
    (printf 0 > /tmp/plxnative-heroidx) plus the injected token, then write to
    /tmp/plxnative-remote, one token per line, ~1s apart:

    up      # hero action row -> profile chip (focus -1)
    right   # chip -> pill 0 (Home)
    right   # -> pill 1 (Movies)
    right   # -> pill 2 (TV Shows) — the LAST pill on this server
    right   # clamped: must stay on pill 2, not fall off the band
    ok      # opens the last section
    

    Expected in /tmp/plxnative-events.log: pms: ... nsections=2 at boot, then the once/sec
    heartbeat flipping from FPS=<n> route=home to FPS=<n> route=library after ok. There is no
    log line naming the section, so confirm which library opened from a capture:
    tools/capture-screen.sh /tmp/unit-10.png DISPLAY — the TV Shows pill should carry the selected
    treatment and the grid should be TV Shows.

  3. Worth an eyeball in that capture: the tab row is centred and un-clipped (3 pills), and the
    profile chip sits cleanly beside it — the two z-order and geometry changes are the only things
    that can look different on a server this size.

Teardown: tests/run.py cleans up after itself; the by-hand boot needs the app closed and every
/tmp/plxnative-* trigger (including the injected token) cleared, sparing the three *.log files.

🤖 Generated with Claude Code

https://claude.ai/code/session_018GuSHrq9oydnX7nhKE1Hvc

The centred tab-pill row is our only way into a library, and it was capped at
Home plus four sections. The cap was applied honestly and consistently — the
draw truncated at `MAX_TABS - 1`, the hit rects were a fixed `[Rect; 5]`, and
both focus walks clamped to the same number, because the rule was that a pill
which cannot be drawn must never be focusable. Everything under it was already
fine: `browse::ensure_sections` discovers every movie/show section, `set_cur`
accepts any index, and `/tmp/plxnative-library=N` browses section 4 and beyond
correctly. So a user with Movies / TV / Kids Movies / Kids TV / 4K Movies had a
fifth library the app knew about, could load, and could not open.

Keep the rule, remove the cap, by making "can be drawn" true of every pill: the
strip now scrolls horizontally inside its track. That is the problem the detail
page's season tabs already solve for a many-season show, solved the same way —
`card_row::reveal` minimal scroll-into-view on a critically-damped spring at the
season row's own stiffness. The two rows are the same element by user directive,
and that now covers their motion as well as their geometry. The track stays
centred and caps at a width that clears the profile chip; past that the pills
slide inside it and are cut by the scissor at the pill area's edge, which is
also the affordance that says there is more over there. A row that fits is
untouched: no clip, no scroll, the same centred bar as before.

`MAX_TABS` is gone rather than raised — a bigger constant only moves the
unreachable library further out. `tab_count()` replaces it as the one source of
the focusable pill count.

Three things the row now has to get right, none of which the old fixed geometry
could get wrong:

  - The recorded hit rect is the pill CLIPPED to the viewport, and the same
    clipped width decides whether to draw at all. One rule, so the scissor and
    the pointer cannot disagree about a sliver at the strip's edge — an
    off-screen pill has zero width and is neither drawn nor clickable.
  - Off the row the scroll tracks the SELECTED pill rather than holding, which
    is where this departs from the season tabs. The way back into the band is
    the chip and then the Home pill, its left end, so a strip parked far right
    would be showing pills the next keypress cannot reach anyway, under a row
    with no selected tab in view. Landing straight in a far section is handled
    at entry instead, by a jump, so arriving costs no slide.
  - Home draws the profile chip AFTER the track. The chip's focused capsule
    unfurls the profile name to its right, and a wide enough strip now reaches
    far enough left to meet it; under the track, that name was painted over.

`Rect::intersect` lands in the retui core, where the next clipped hit test can
find it.

Tests: +5 host (63)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_018GuSHrq9oydnX7nhKE1Hvc
Copilot AI review requested due to automatic review settings July 29, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GLinnik21
GLinnik21 merged commit badfa3b into main Jul 30, 2026
@GLinnik21
GLinnik21 deleted the worktree-agent-a2b97c0056f6a02ee branch August 2, 2026 18:37
GLinnik21 added a commit that referenced this pull request Aug 3, 2026
… machine

Replace the five entangled `let mut` route bools (playing/detail_open/menu_open/
info_open/chapters_open) with one exclusive state machine:

  enum Overlay { None, Menu, Info, Chapters }
  enum Route   { Home, Detail, Player { overlay: Overlay } }

Overlays live inside Player (only meaningful during playback); Detail and Player
are mutually exclusive, so illegal combos are unrepresentable. All 89 sites
migrated (reads -> matches!, writes -> route assignments); deleting the bool decls
made the compiler enforce read coverage. The #16 background/foreground UAF path is
preserved: background sets Route::Home while the suspended session stays in
bg_was_playing/bg_was_paused/bg_pos, foreground does a single guarded re-Load.

Return-to-detail is preserved via a `played_from_detail` return-target (kept
outside Route, like bg_was_playing): Stop/BACK/EOS from a detail-launched play
returns to that detail page, home-launched returns home — byte-equivalent to the
old detail_open-under-playing mechanism, incl. the bg-resume window edge case.

Planned + adversarially verified by a map->design->verify workflow (13 agents, 0
refutations); the applied diff was re-reviewed (sound, no blockers, one minor
safe-direction race fixed). Verified on-device: Home->Detail->Player->Player{Menu}
route graph with live video + track-menu overlay, no crash. Completes the
View-tree migration (docs/ui-viewtree-plan.md stops after 7a).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Kcauj6zm932EtcdTTtW998
GLinnik21 added a commit that referenced this pull request Aug 15, 2026
…fix it

The reopen wedge has a mechanism now, from the device's own binary (md5-matched
against the copy in `sysroot/`), and it is NOT what the symptom suggests.

There is no latch in `WebOSShowScreenKeyboard`: the second call re-runs every
step of the first. The defect is one step earlier, in the `text_model.leave`
handler at 0x8043c —

    80452:  str  r3, [r4, #16]      ; vkb->text_model = NULL   BEFORE the call
    80458:  b.w  0x7cc20            ; SDL_StopTextInput()

— which NULLs the model before calling stop, so `WebOSHideScreenKeyboard`'s
`cbz r0` early-returns and `text_model_deactivate` is never sent. The compositor
keeps the old model active and ignores every later `activate`. Exactly what
webosbrew's 265d00ea ("ensure osk is deactivated") fixes, and what LG's own
chromium client documents as the contract SDL omits: reset, deactivate, destroy,
NULL.

Two things that would have been reached for and are dead ends: `SDL_SetTextInputRect`
is a total no-op here (`Wayland_CreateDevice` never writes +0xd4/d8/dc — only the
four keyboard hooks exist), and `SDL_IsScreenKeyboardShown` IS stale after a
dismiss (+0x1c is never cleared) but gates nothing, so it is a reporting bug and
not the cause.

What this commit adds is EVIDENCE, not a fix, because the device runs so far
cannot tell the driver's wedge apart from one of our own making — and the two
have identical symptoms. `start()` is a no-op while `STARTED` is set, so a `stop`
that never runs also makes every later `start` silent and the panel simply never
returns. `stop` now logs its transition, so the pair answers which one you have:
`start` with no matching `stop` before it is ours; `start` logged with no panel
is the driver's.

`SDL_LogSetPriority(INPUT, DEBUG)` turns on the driver's own narration
(`[WebOSShowScreenKeyboard] called`, `[TextModelLeave] called`,
`[TextModelInputPanelState] called - state: %d`). NB it did NOT reach
`/tmp/plxnative-stderr.log` on this firmware — 0 bytes across a full session — so
where LG's SDL sends its log is itself unresolved, and the app's own two lines
are the reliable half today.

Also fixed while here: `enter()` cleared `EDITING` without calling `stop()`, the
one place in this screen where the flag and the panel could disagree.

`make check` 643 green, ARM cross-build links.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
GLinnik21 added a commit that referenced this pull request Aug 26, 2026
… machine

Replace the five entangled `let mut` route bools (playing/detail_open/menu_open/
info_open/chapters_open) with one exclusive state machine:

  enum Overlay { None, Menu, Info, Chapters }
  enum Route   { Home, Detail, Player { overlay: Overlay } }

Overlays live inside Player (only meaningful during playback); Detail and Player
are mutually exclusive, so illegal combos are unrepresentable. All 89 sites
migrated (reads -> matches!, writes -> route assignments); deleting the bool decls
made the compiler enforce read coverage. The #16 background/foreground UAF path is
preserved: background sets Route::Home while the suspended session stays in
bg_was_playing/bg_was_paused/bg_pos, foreground does a single guarded re-Load.

Return-to-detail is preserved via a `played_from_detail` return-target (kept
outside Route, like bg_was_playing): Stop/BACK/EOS from a detail-launched play
returns to that detail page, home-launched returns home — byte-equivalent to the
old detail_open-under-playing mechanism, incl. the bg-resume window edge case.

Planned + adversarially verified by a map->design->verify workflow (13 agents, 0
refutations); the applied diff was re-reviewed (sound, no blockers, one minor
safe-direction race fixed). Verified on-device: Home->Detail->Player->Player{Menu}
route graph with live video + track-menu overlay, no crash. Completes the
View-tree migration (docs/ui-viewtree-plan.md stops after 7a).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Kcauj6zm932EtcdTTtW998
GLinnik21 added a commit that referenced this pull request Aug 26, 2026
…fix it

The reopen wedge has a mechanism now, from the device's own binary (md5-matched
against the copy in `sysroot/`), and it is NOT what the symptom suggests.

There is no latch in `WebOSShowScreenKeyboard`: the second call re-runs every
step of the first. The defect is one step earlier, in the `text_model.leave`
handler at 0x8043c —

    80452:  str  r3, [r4, #16]      ; vkb->text_model = NULL   BEFORE the call
    80458:  b.w  0x7cc20            ; SDL_StopTextInput()

— which NULLs the model before calling stop, so `WebOSHideScreenKeyboard`'s
`cbz r0` early-returns and `text_model_deactivate` is never sent. The compositor
keeps the old model active and ignores every later `activate`. Exactly what
webosbrew's 265d00ea ("ensure osk is deactivated") fixes, and what LG's own
chromium client documents as the contract SDL omits: reset, deactivate, destroy,
NULL.

Two things that would have been reached for and are dead ends: `SDL_SetTextInputRect`
is a total no-op here (`Wayland_CreateDevice` never writes +0xd4/d8/dc — only the
four keyboard hooks exist), and `SDL_IsScreenKeyboardShown` IS stale after a
dismiss (+0x1c is never cleared) but gates nothing, so it is a reporting bug and
not the cause.

What this commit adds is EVIDENCE, not a fix, because the device runs so far
cannot tell the driver's wedge apart from one of our own making — and the two
have identical symptoms. `start()` is a no-op while `STARTED` is set, so a `stop`
that never runs also makes every later `start` silent and the panel simply never
returns. `stop` now logs its transition, so the pair answers which one you have:
`start` with no matching `stop` before it is ours; `start` logged with no panel
is the driver's.

`SDL_LogSetPriority(INPUT, DEBUG)` turns on the driver's own narration
(`[WebOSShowScreenKeyboard] called`, `[TextModelLeave] called`,
`[TextModelInputPanelState] called - state: %d`). NB it did NOT reach
`/tmp/plxnative-stderr.log` on this firmware — 0 bytes across a full session — so
where LG's SDL sends its log is itself unresolved, and the app's own two lines
are the reliable half today.

Also fixed while here: `enter()` cleared `EDITING` without calling `stop()`, the
one place in this screen where the flag and the panel could disagree.

`make check` 643 green, ARM cross-build links.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
GLinnik21 added a commit that referenced this pull request Aug 27, 2026
…fix it

The reopen wedge has a mechanism now, from the device's own binary (md5-matched
against the copy in `sysroot/`), and it is NOT what the symptom suggests.

There is no latch in `WebOSShowScreenKeyboard`: the second call re-runs every
step of the first. The defect is one step earlier, in the `text_model.leave`
handler at 0x8043c —

    80452:  str  r3, [r4, #16]      ; vkb->text_model = NULL   BEFORE the call
    80458:  b.w  0x7cc20            ; SDL_StopTextInput()

— which NULLs the model before calling stop, so `WebOSHideScreenKeyboard`'s
`cbz r0` early-returns and `text_model_deactivate` is never sent. The compositor
keeps the old model active and ignores every later `activate`. Exactly what
webosbrew's 265d00ea ("ensure osk is deactivated") fixes, and what LG's own
chromium client documents as the contract SDL omits: reset, deactivate, destroy,
NULL.

Two things that would have been reached for and are dead ends: `SDL_SetTextInputRect`
is a total no-op here (`Wayland_CreateDevice` never writes +0xd4/d8/dc — only the
four keyboard hooks exist), and `SDL_IsScreenKeyboardShown` IS stale after a
dismiss (+0x1c is never cleared) but gates nothing, so it is a reporting bug and
not the cause.

What this commit adds is EVIDENCE, not a fix, because the device runs so far
cannot tell the driver's wedge apart from one of our own making — and the two
have identical symptoms. `start()` is a no-op while `STARTED` is set, so a `stop`
that never runs also makes every later `start` silent and the panel simply never
returns. `stop` now logs its transition, so the pair answers which one you have:
`start` with no matching `stop` before it is ours; `start` logged with no panel
is the driver's.

`SDL_LogSetPriority(INPUT, DEBUG)` turns on the driver's own narration
(`[WebOSShowScreenKeyboard] called`, `[TextModelLeave] called`,
`[TextModelInputPanelState] called - state: %d`). NB it did NOT reach
`/tmp/plxnative-stderr.log` on this firmware — 0 bytes across a full session — so
where LG's SDL sends its log is itself unresolved, and the app's own two lines
are the reliable half today.

Also fixed while here: `enter()` cleared `EDITING` without calling `stop()`, the
one place in this screen where the flag and the panel could disagree.

`make check` 643 green, ARM cross-build links.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
GLinnik21 added a commit that referenced this pull request Aug 28, 2026
…fix it

The reopen wedge has a mechanism now, from the device's own binary (md5-matched
against the copy in `sysroot/`), and it is NOT what the symptom suggests.

There is no latch in `WebOSShowScreenKeyboard`: the second call re-runs every
step of the first. The defect is one step earlier, in the `text_model.leave`
handler at 0x8043c —

    80452:  str  r3, [r4, #16]      ; vkb->text_model = NULL   BEFORE the call
    80458:  b.w  0x7cc20            ; SDL_StopTextInput()

— which NULLs the model before calling stop, so `WebOSHideScreenKeyboard`'s
`cbz r0` early-returns and `text_model_deactivate` is never sent. The compositor
keeps the old model active and ignores every later `activate`. Exactly what
webosbrew's 265d00ea ("ensure osk is deactivated") fixes, and what LG's own
chromium client documents as the contract SDL omits: reset, deactivate, destroy,
NULL.

Two things that would have been reached for and are dead ends: `SDL_SetTextInputRect`
is a total no-op here (`Wayland_CreateDevice` never writes +0xd4/d8/dc — only the
four keyboard hooks exist), and `SDL_IsScreenKeyboardShown` IS stale after a
dismiss (+0x1c is never cleared) but gates nothing, so it is a reporting bug and
not the cause.

What this commit adds is EVIDENCE, not a fix, because the device runs so far
cannot tell the driver's wedge apart from one of our own making — and the two
have identical symptoms. `start()` is a no-op while `STARTED` is set, so a `stop`
that never runs also makes every later `start` silent and the panel simply never
returns. `stop` now logs its transition, so the pair answers which one you have:
`start` with no matching `stop` before it is ours; `start` logged with no panel
is the driver's.

`SDL_LogSetPriority(INPUT, DEBUG)` turns on the driver's own narration
(`[WebOSShowScreenKeyboard] called`, `[TextModelLeave] called`,
`[TextModelInputPanelState] called - state: %d`). NB it did NOT reach
`/tmp/plxnative-stderr.log` on this firmware — 0 bytes across a full session — so
where LG's SDL sends its log is itself unresolved, and the app's own two lines
are the reliable half today.

Also fixed while here: `enter()` cleared `EDITING` without calling `stop()`, the
one place in this screen where the flag and the panel could disagree.

`make check` 643 green, ARM cross-build links.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
GLinnik21 added a commit that referenced this pull request Oct 8, 2026
…loor, no secret echo) (#557)

CodeQL py/* alerts #4-8, #10, #11, #16-20. serve_fixtures resolves and checks containment before isfile; every dev SSLContext sets minimum_version TLS 1.2; gen-release-audit parses the DSN host instead of a substring test; the census arm regex no longer backtracks; plxnative-lab start stops echoing the session secret (pkg/lab.json, 0600, carries it); remote-dpad echoes only a password it generated.

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.

2 participants