Skip to content

player: OK on a focused Subtitles/Audio disc reaches the track menu again - #8

Merged
GLinnik21 merged 2 commits into
mainfrom
worktree-agent-a9af413486b2ef2e7
Jul 30, 2026
Merged

GLinnik21 merged 2 commits into
mainfrom
worktree-agent-a9af413486b2ef2e7

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Unit 1 of the parity-gap work — docs/parity-gaps.md §0, the one live regression rather than a
parity gap. It turned out to be two regressions, both from c1691d1, and each on its own is fatal
to the same control
: deleting the dead else if alone does not restore the feature.

1. The shadowed arm (app.rs, the one the audit found)

} else if vis && hud_nav.focus == 1 {          // EMPTY body — wins
} else if vis && hud_nav.focus == 1 {          // byte-identical — unreachable
    crate::ui::track_menu::open_tab(...);

OK on a focused Subtitles/Audio disc did nothing at all — no menu, no pause, no log line. Deleted
the empty arm. Rust does not warn on a repeated condition, which is why it survived review.

2. The focus reset was a steady state, not an edge (found while preparing device verification)

app.rs's per-frame block ran } else if ctrl.is_discs() && hud_nav.focus == 1 { hud_nav = HudNav::HOME; } on every iteration of while running, not on a transition. Its own comment
describes an edge: a Skip / Up-Next stand-in vanishing out from under the focus ring, which would
otherwise leave the ring on the row with btn still 0, so the next OK opened Subtitles instead of
toggling pause.

As a steady state it also fired on a user who walked UP to the discs deliberately. The ordering
inside one iteration is while SDL_PollEvent (UP sets focus = 1) → this block (sets it straight
back to 0) → the draw, so draw_hud never once received focus == 1 with Discs. The ring could
not render on a disc, let alone rest there long enough to press OK. Confirmed by an independent
review of the diff.

The rule now lives in player_hud::standin_left_the_ring(was_standin, now, focused), a pure
predicate beside slot_for — the one place it is written down and the one place it is tested — with
ctrl_was_standin tracked in the frame loop.

Why nothing caught either one

The pointer path reaches open_tab through icon_hit in a different arm and never consults
either bug, and the on-device suite opens the track menu through /tmp/plxnative-menupick, which
calls open_tab / focus_row / on_ok directly — bypassing the key dispatch and the focus
lifetime. Every existing signal for this feature routed around both bugs.

Can a host test lock this in?

Bug 2: yes, and there is one. only_a_vanishing_standin_takes_the_focus_ring_back asserts both
halves — the edge fires, the steady state does not.

Bug 1: no, and I did not contort the code to fake one. The dispatch is an if-chain inside the
SDL event loop over four local mutables; extracting it would mean restructuring ~28 lines of the
file four sibling agents are editing concurrently. A shadowed branch is also a bug class no unit
test can see, so the proportionate lock-in is a lint, not a test:

make check now runs make lint first — three named clippy lints (ifs_same_cond,
same_functions_in_if_condition, if_same_then_else). Re-introducing the deleted line makes it
exit 101 pointing at both arms (verified both ways). -A clippy::all comes first because this crate
is not clippy-clean and making it so is not this gate's job; the lints are named rather than a group
so a nightly bump cannot silently widen what make check fails on. ~12s cold, <1s warm.
clippy::correctness as a group is clean too, except ff.rs:1330's deliberate loop { … break; }
— which is why the group was not adopted.

Verification done

  • make check — 59 passed (58 baseline + 1), lint green.
  • make — ARM cross-build green.
  • Independent code review over the whole diff: both fixes confirmed correct, btn proven always in
    {0,1}, key and pointer proven to open the same tab, ctrl_was_standin proven to have no
    wrong-firing and no missed-edge path across overlays / route changes / a fresh session, and the
    three skip-intro / Up-Next on-device cases proven unaffected. Its findings on doc wording, an
    if_same_then_else false-positive shape, and the new nightly-clippy prerequisite are all folded
    in.

Device verification: deferred to coordinator

Not run here — I released the TV queue per the policy change. The playback suite is not needed
(no playback, pipeline or drawing code changed; this is control flow). What is needed is the one
thing no automated case can reach: OK on a focused disc, by remote.

# 0. build this branch, then boot straight into playback of a MOVIE. rk=4 (The Substance) matters:
#    a movie has no intro/credits segment under the playhead, so ControlSlot::Discs owns the
#    control row rather than a Skip / Up-Next stand-in.
make
tools/tv-session.sh up --screen player=4

# 1. frames really presenting?  expect lines.
tools/tv-session.sh log 'FPS=.*route=player.*pos='

# 2. is the row actually the DISCS?  expect NOTHING. A hit here means a stand-in owns the row and
#    the run proves nothing — re-run step 0 (rk=1926 or rk=3 are also movies).
tools/tv-session.sh log 'marker offer:'

# 3. walk to the control row BY REMOTE. `tv-session.sh key` sends each token as its own ssh round
#    trip, so they land in SEPARATE frames — which is exactly what bug 2 was about; a single-frame
#    burst would pass even against the broken build. down,down,down normalises from ANY HUD state
#    (hidden / scrubber / control row / tabs) onto the tabs row; up,up then walks
#    tabs -> scrubber -> control row.
tools/tv-session.sh key down down down up up

# 4. OK on the focused disc
tools/tv-session.sh key ok

# 5. THE ASSERTION
tools/tv-session.sh log 'route=player overlay=menu'

# optional picture — the HUD is held up for as long as an overlay is open, so there is no rush
tools/tv-session.sh shot /tmp/track-menu.png
tools/tv-session.sh down

PASS = at least one FPS=… route=player overlay=menu line at step 5. That single line proves
both fixes at once:

  • overlay=menu can only be set by the arm that was shadowed — tv-session.sh arms neither
    /tmp/plxnative-menu nor /tmp/plxnative-menupick, and no pointer click was sent; and
  • that arm requires hud_nav.focus == 1 at the instant OK arrives, so focus must have survived
    across frames
    on the discs, which the old per-frame reset made impossible.

FAIL = overlay=none throughout. Then OK on the disc still does nothing.

One flake to know: the HUD linger is 4500 ms and every key press refreshes it, so step 3 is safe as
long as consecutive ssh round trips are under ~4.5 s apart. If the link is slow the HUD can
auto-hide mid-walk and focus parks back on the scrubber — just re-run step 3, it is idempotent.

If you want belt-and-braces on the half of the control row I did touch (the stand-in edge), the
one case that exercises it through the same FIFO is:

./tests/run.py --filter morning_show_skip_intro_press

It waits for marker offer: and writes ok to the FIFO — focus claimed on a Skip pill, OK
activating it. My edge guard is false in that state (a stand-in still owns the row), so it must
still pass; reviewed as unaffected, but it is the cheapest live confirmation. Skip the FPS
suite
: nothing here changes what is drawn or how often.

🤖 Generated with Claude Code

https://claude.ai/code/session_018GuSHrq9oydnX7nhKE1Hvc

GLinnik21 and others added 2 commits July 29, 2026 20:53
…gain

Two regressions from c1691d1, both on the same control and each independently fatal to it:
the transport's Subtitles and Audio discs drew, took the focus ring, let LEFT/RIGHT walk
between them, and went nowhere.

The first is a duplicated `else if vis && hud_nav.focus == 1 {` with an EMPTY body sitting
directly above the byte-identical arm that calls `track_menu::open_tab`. The empty one wins,
so the real arm was unreachable: OK on a disc did nothing at all — no menu, no pause, no log
line. Rust does not warn on a repeated condition, which is why it survived review.

The second only becomes visible once the first is gone, and is why deleting that line alone
does not restore the feature. The focus reset in the per-frame block was written as a steady
state — `ctrl.is_discs() && hud_nav.focus == 1` — so it fired on every frame the discs owned
the row with the ring on it, not just on the edge its own comment describes. UP set focus to
1 and the same `while running` iteration set it straight back to 0 before the draw, so the
ring could never rest on a disc in the first place. Only a stand-in VANISHING out from under
the ring should take it back; that is now `player_hud::standin_left_the_ring`, a pure
predicate beside `slot_for` — the one place the rule is written down, and the one place it is
tested. Its test asserts both halves: the edge fires, and the steady state does not.

Neither was reachable by the on-device suite. The pointer path reaches `open_tab` through
`icon_hit` in a different arm and never consulted either, and the harness opens the menu
through /tmp/plxnative-menupick — so every existing signal for this feature bypassed both
bugs. A shadowed branch is also a bug class no unit test can see; `make check` now runs the
clippy lint that does (next commit).

Tests: +1 host (59)

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…an reach one

`make check` now runs `make lint` first: three named clippy lints — `ifs_same_cond`,
`same_functions_in_if_condition`, `if_same_then_else` — over the crate and its `#[cfg(test)]`
blocks.

This exists for exactly one bug class, and the previous commit is the case for it. A
duplicated `else if` with an empty body shadowed the arm that opens the player's track menu.
rustc does not warn on a repeated condition, the dispatch lives inside the SDL event loop
where no host test can observe it, and the pointer path reaches the same code through a
different arm, so the on-device suite could not see it either. Three separate auditors found
it by reading. Clippy finds it in under a second: re-introducing the line makes `make lint`
exit 101 pointing at both arms.

Scoped deliberately. `-A clippy::all` comes first because this crate is not clippy-clean and
making it so is not this gate's job — the three lints are then denied on top, and all three
are clean today. They are NAMED rather than a group so a nightly bump cannot silently widen
what `make check` fails on; `clippy::correctness` as a whole is clean too, except ff.rs:1330's
deliberate `loop { … break; }`, and adopting the group would have meant an `#[allow]` there
plus that open-ended churn. Cost is ~12s cold and under 1s warm, and clippy ships in rustup's
default profile, so a toolchain that can already build this crate has it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 18:06

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.

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