Repository navigation
player: OK on a focused Subtitles/Audio disc reaches the track menu again - #8
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unit 1 of the parity-gap work —
docs/parity-gaps.md§0, the one live regression rather than aparity 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 ifalone does not restore the feature.1. The shadowed arm (
app.rs, the one the audit found)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 ofwhile running, not on a transition. Its own commentdescribes 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
btnstill 0, so the next OK opened Subtitles instead oftoggling 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 setsfocus = 1) → this block (sets it straightback to 0) → the draw, so
draw_hudnever once receivedfocus == 1withDiscs. The ring couldnot 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 purepredicate beside
slot_for— the one place it is written down and the one place it is tested — withctrl_was_standintracked in the frame loop.Why nothing caught either one
The pointer path reaches
open_tabthroughicon_hitin a different arm and never consultseither bug, and the on-device suite opens the track menu through
/tmp/plxnative-menupick, whichcalls
open_tab/focus_row/on_okdirectly — bypassing the key dispatch and the focuslifetime. 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_backasserts bothhalves — 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 checknow runsmake lintfirst — three named clippy lints (ifs_same_cond,same_functions_in_if_condition,if_same_then_else). Re-introducing the deleted line makes itexit 101 pointing at both arms (verified both ways).
-A clippy::allcomes first because this crateis 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 checkfails on. ~12s cold, <1s warm.clippy::correctnessas a group is clean too, exceptff.rs:1330's deliberateloop { … 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.btnproven always in{0,1}, key and pointer proven to open the same tab,
ctrl_was_standinproven to have nowrong-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_elsefalse-positive shape, and the new nightly-clippy prerequisite are all foldedin.
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.
PASS = at least one
FPS=… route=player overlay=menuline at step 5. That single line provesboth fixes at once:
overlay=menucan only be set by the arm that was shadowed —tv-session.sharms neither/tmp/plxnative-menunor/tmp/plxnative-menupick, and no pointer click was sent; andhud_nav.focus == 1at the instant OK arrives, so focus must have survivedacross frames on the discs, which the old per-frame reset made impossible.
FAIL =
overlay=nonethroughout. 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:
It waits for
marker offer:and writesokto the FIFO — focus claimed on a Skip pill, OKactivating 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