Skip to content

Library: a seat nobody chose follows the document's head when shelves land - #236

Merged
GLinnik21 merged 6 commits into
mainfrom
fix/library-seat-follows-shelf-landing
Sep 25, 2026
Merged

GLinnik21 merged 6 commits into
mainfrom
fix/library-seat-follows-shelf-landing

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Field report

On a TV debug build of a788b27a, the Movies tab was opened with a pointer click. The screen cold-opened with its A–Z grid already prepared, libhubs: section 0 landed 7 shelves arrived after that, and the first DOWN moved focus into the "All" block instead of onto the first shelf.

Root cause

rust-modules/src/screens/library/mod.rs:800 (on a788b27a) seats the page's own focus the first live frame the document has a first block, then clears initial. With the grid prepared and the shelves still in flight, that first block is the grid's heading row, so focus seated on Sort. The shelves then committed at the head. That is correct: the page was at scroll 0, so SecHubs::commit_staged let them in. They landed above the seat and pushed Sort seven shelf pitches down, off the panel. Nothing re-seated, so the first DOWN continued from the heading into the grid.

This checks the three hypotheses:

  • (a) confirmed: the seat is computed before the shelf block exists and is never re-seated.
  • (b) eliminated: the entry path does not matter. Pointer, keyboard and an unfocused boot fail the same way, and so do the Movies and TV Shows libraries.
  • (c) eliminated: seat_for_scroll returns first() at scroll 0.

Fix

The page's own head seat is now provisional. LibraryScreen::provisional names the head group the page itself seated. While focus is still in that group and the reader has not acted, a landing that changes the head re-seats onto the new head, the same seat a first paint takes when the shelves arrive first. These release it:

  • a direction or pointer move
  • any key-down, pointer motion, click, drag or wheel, claimed on the page's Input before a delayed press can commit (hovering the already-focused control produces no FocusMoved)
  • any activation
  • the dev focus commands
  • a restore
  • focus found anywhere else, because the engine moves before the page hears FocusMoved

No restored seat is ever provisional, at the head or anywhere else. A seat counts as the page's own only when no restored scroll (saved viewport or bookmark) is pending and the engine remembers no cursor in the seated group that the reader chose. The engine remembers the page's own seats too, and TOOLBAR_GROUP is shared across sections, so the page records the provenance of the cursors its own seats wrote (LibraryScreen::placed). Any other move into that group, an activation, or a pointer on the control drops that record. The new field is in the logical state, so SCREEN_SHAPES_PIN is bumped.

Consumers

  • Library, Movies and TV Shows: one screen type and one seat path, so both are migrated by this change.
  • Home: already has this shape. It seats the hero when its action row arrives, while focus is still on the strip, and its rows land below the hero.
  • Search: seats its field, which never arrives async.
  • Person and Detail: keep no self-seat for a landing to strand.

The rule is recorded in screens/CLAUDE.md under "A landing must not move ground somebody is looking at".

Tests (host, screens/library/navigation_tests.rs)

  • a_shelf_landing_after_the_head_seat_moves_that_seat_onto_the_first_shelf covers {Movies, TV Shows} × {pointer, keyboard, unfocused} entry. It was RED on the unfixed tree: Movie/Pointer: the landing must carry the page's own seat onto the first shelf's first card, with focus left on Sort (elem: 1) → test result: FAILED. 1 passed; 1 failed. It is now GREEN.
  • …never_moves_a_seat_the_user_chose, …_user_activated, …_user_began_to_press, …_the_pointer_is_on and …_a_restored_seat_at_the_head (Movies → Shows → Movies with focus left on Filter) and a_page_placed_seat_remembered_by_the_engine_is_not_a_restore (Movies → Shows, grid before shelves each time, then DOWN must reach a shelf) guard the release paths. The last five came from review, and each was watched RED before its fix.

Gates (committed tree 0ba0756b, on e66b644b; working tree clean before and after)

  • make check, complete run, exit 0:
    • default --lib suite: test result: ok. 4374 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
    • --features hostsim suite: test result: ok. 4427 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
    • the remaining stages: test result: ok. 101 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out, the C self-tests including the tsan cases, check-deps and check-statics
  • cargo +nightly check --lib --no-default-features: clean
  • make (ARM): exit 0

Replay anchors

The bot flagged that the shape change moves state_fp. That is not a regression from this branch. On origin/main 20518dc6, state_fp() is already 0xf0121a071f7a9365, while anchors 1-boot-home-chip-grid and 6-settings-family carry 0x155947674871ffe8. Recording::parse refuses a mismatched state_fp, so both anchors were already rejected before this branch.

Review

Adversarial review with a focus on systematic fixes, two rounds, followed by two bot findings:

  1. Activation did not release the seat. Fixed with a test.
  2. OK-down could be overtaken by the page's Tick before the delayed press committed. Fixed with a test by claiming the seat on Input.

Not proven

  • TV verification is still pending.
  • The mock-server simulator run was not attempted; the ordering is reproduced by the host test.
  • A separate, pre-existing case is not touched here: a user who presses DOWN into grid row 0 before the shelves land is still at scroll 0, so the landing commits above the focused row.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T03:36:45.980876Z 0ba0756 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c460bc40d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rust-modules/src/screens/registry.rs Outdated
/// `tools/plxnative-rec rerecord` like any other shape-pin bump before replay is trusted.
#[cfg(test)]
const SCREEN_SHAPES_PIN: u64 = 0xd48c_db30_5492_1e33;
const SCREEN_SHAPES_PIN: u64 = 0xc6c2_df0b_3187_68f6;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Re-record the live anchors after changing the state shape

Changing LibraryScreen::SHAPE changes the combined app::recorder::state_fp(), but the accepted 1-boot-home-chip-grid and 6-settings-family manifests still carry the previous fingerprint (0x155947674871ffe8). Consequently both committed regression anchors are rejected by Recording::parse at load time, so the replay/focus-fingerprint workflows can no longer run them; re-record both anchors as part of this shape-pin bump.

Useful? React with 👍 / 👎.

Comment thread rust-modules/src/screens/library/mod.rs Outdated
Comment on lines +871 to +873
// on its key, and this page's next Tick may run before that commit.
if matches!(input.kind, InputKind::Key { edge: Edge::Down, .. }
| InputKind::Click { .. } | InputKind::Drag { .. } | InputKind::Wheel { .. }) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Release the provisional seat on pointer motion

Include InputKind::Pointer in this release condition. If the pointer moves onto the already-focused provisional control (for example Sort), FocusEngine::set returns Outcome::Nothing, so no FocusMoved event clears provisional; when shelves then land, the next tick incorrectly moves focus away from the control the user is hovering and onto the new head shelf.

Useful? React with 👍 / 👎.

@GLinnik21
GLinnik21 force-pushed the fix/library-seat-follows-shelf-landing branch from 0c460bc to 669cfcd Compare September 25, 2026 02:30

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 669cfcddaa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rust-modules/src/screens/library/mod.rs Outdated
self.reseat(FocusTarget::ContainerGroup(group), fx);
// Only a HEAD seat is provisional: one derived from a restored scroll names
// the block the reader left, which a landing above it does not change.
self.provisional = (group == self.first_group() && self.scroll_target <= 0.5).then_some(group);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep restored head seats non-provisional

When a previously visited section is restored at scroll 0 (for example, switching Movies → Shows → Movies after leaving focus on Sort or Filter), sync sets restore_scroll and scroll_target to 0, but this condition still marks the restored head group provisional. If the grid is published before its shelves, the restored toolbar seat is therefore moved onto the first shelf when those shelves arrive, overriding the user's remembered position. Exclude seats with a pending restore_scroll from this assignment so only genuinely new page-owned seats follow a changing head.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 684741d43d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rust-modules/src/screens/library/mod.rs Outdated
Comment on lines +835 to +836
let restoring = self.restore_scroll.is_some() || cx.focus.remembered(group).is_some();
self.provisional = (group == self.first_group() && !restoring).then_some(group);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Distinguish automatic cursor memory from a restored seat

FocusEngine::set remembers every ContainerGroup seat, including the automatic Sort seat created on an earlier grid-before-shelves open, and TOOLBAR_GROUP is shared across library sections. After that seat follows the arriving shelves, switching Movies → Shows can open another prepared grid with the stale remembered Sort cursor; this check labels it a restore, leaves provisional unset, and the Shows shelves reproduce the original bug by landing above and stranding focus on Sort. Track whether the remembered cursor was actually user/restored rather than treating any group memory as proof of restoration.

Useful? React with 👍 / 👎.

GLinnik21 and others added 6 commits September 25, 2026 06:07
… land

Field report on a788b27: opening Movies with its grid already prepared seated
focus on the grid's heading row (the document's head while the shelves were in
flight); the shelves then committed above it at the head and the first DOWN
walked on into the grid instead of the first shelf.

The page's own head seat is now provisional (`LibraryScreen::provisional`
names the head group it seated): while focus is still in that group and nobody
has moved (a direction, a pointer, a wheel, a dev focus command, or any seat
elsewhere), a landing that changes the head re-seats onto it, as a first paint
would have. Focus found anywhere else releases it, because the engine moves
before the page hears `FocusMoved`. A seat derived from a restored scroll is
not provisional. The screen shape pin is bumped for the new field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finding: OK on the head seat (Sort) opens a menu without moving focus,
so no FocusMoved released the provisional seat and a shelf landing behind the
menu moved the reader off Sort. Every activation path goes through
LibraryScreen::activate, which now releases it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… it starts

Second review finding: OK-down arms a delayed press that the dispatcher only
commits while focus is still on its key, and the page's next Tick could run
between the two and follow a fresh landing, dropping the press. The page's
Input arm now releases the provisional seat for every key-down, click, drag
and wheel (the wheel's own release folds into it).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finding: a Magic Remote hovering the already-focused provisional control
produces no FocusMoved, so a later shelf landing moved focus out from under the
pointer. Pointer motion now releases the seat on the page's Input arm, with a
regression test watched red first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finding: Movies -> Shows -> Movies after leaving focus on Filter
restores Movies' saved viewport at scroll 0 and the remembered Filter, and the
head-only condition marked that restored seat provisional, so a shelf landing
moved the reader's seat onto the first shelf. A seat is now provisional only
when nothing is being restored: no pending restored scroll (viewport or
bookmark) and no remembered cursor in the seated group. Regression test
watched red first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finding: the focus engine remembers every seat, including the page's own
automatic Sort seat, and TOOLBAR_GROUP is one group across sections. So on
Movies -> Shows (both grid-before-shelves) Movies' page-placed Sort memory read
as a restore, the Shows seat was not provisional, and the Shows shelves landed
above Sort again: the field report one section later.

The page now records the provenance of the cursors its own seats wrote
(`LibraryScreen::placed`): a seat move that IS the page's provisional seat
records (group, elem); any other move into a group, an activation, or a
pointer on the control drops it. The re-entry check only treats a remembered
cursor as a restore when it is not page-placed. Regression test watched red
first; screen shape pin bumped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 force-pushed the fix/library-seat-follows-shelf-landing branch from 684741d to 0ba0756 Compare September 25, 2026 03:32

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ba0756b83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// Remembered cursors the PAGE wrote by seating itself, which the reader has not confirmed.
/// The engine remembers every seat alike, and `TOOLBAR_GROUP` is one group across sections,
/// so its memory alone cannot tell a restore from the page's own earlier seat.
placed: Vec<(GroupId, u32)>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist automatic-seat provenance across eviction

When the Library entry is buried deeply enough for its body to be evicted (CAP = 16), its focus engine cursors survive in ReturnState, but placed is absent from LibraryMemory and is therefore empty after remount. If the retained toolbar cursor was originally page-placed, subsequently opening an unvisited section whose grid precedes its shelves makes the restoring check misclassify that cursor as user-chosen; the delayed shelves then leave focus stranded on Sort again. Persist and restore this provenance with the rest of the page memory.

AGENTS.md reference: AGENTS.md:L20-L23

Useful? React with 👍 / 👎.

@GLinnik21
GLinnik21 merged commit 569855c into main Sep 25, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the fix/library-seat-follows-shelf-landing branch September 25, 2026 03:47
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
…the pass's account writes

Review findings on #241:
- A trailer started with Play Trailer is an ordinary playback
  (request_play, preview: false) and reports a timeline; only the
  background preview, full-screen mode included, never reports.
- The library DOWN fix holds only when the reader has not moved before
  the shelves load.
- The device-pass summary counts #236 as passed only for shelves-first.
- The pass wrote to the Guest profile: the explicit PGS pick's
  PUT /library/parts selection, and the harness's unscrobble, progress
  seeds and playback timelines.
- The gate row states that every commit after b99e79f is note/audit
  only and which checks were re-run on the head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
…brary firmware gate (#241)

* docs: correct two claims #235 and #239 left stale

ci/build-ffmpeg.sh: the firmware database fwsym holds spans platform
releases 1.2.0 to 11.2.0, not webOS 3 to 10; libz.so.1 is in every image.
docs/trailer-ux-plan.md: the deferred just_finished proposal names the
preview machine's current transitions, Machine::eos and Machine::stopped,
as docs/TODOS.md already does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 release note and audit: cover #234-#240

The note gains the image-subtitle fix, the trailer stop/reporting/redirect
behaviour, the art-crop, library-seat and profiles read-out fixes, and a
line for nightly users about BACK from the player. The audit records the
seven changes as host-verified and pending the device pass, the bundled
FFmpeg's new libz.so.1 dependency with its firmware evidence, and the
https HLS cross-origin redirect gap as a known follow-up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: the audit lint refuses an unfilled placeholder in the authored half

Nothing substitutes into a release audit's authored half; gen-release-audit
only replaces the generated block, so a __PLACEHOLDER__ left there
publishes literally. Watched red on the v0.7.0 audit's __GATES__ row before
it was filled; every existing audit and the template pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: record the gates run on the release-prep tree

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: fold in the second device pass over #234-#240

#234, #235, #236, #237 and #239 passed on the television on a debug build
of 3a30a01, each with the log lines behind it; #238 stays pending (it
needs real playback), and #237's new focus-on-Sign-out finding is pending
its own fix. Records the second pass's harness results and marks the
0.6.6 -> 0.7.0 in-place upgrade as blocked, with what unblocks it and what
was observed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 release note and audit: #242 fixes the device pass's Sign-out focus finding

The audit lists #242 among the changes landed after the device pass,
host-verified and pending the device, and marks #237's focus-on-Sign-out
finding fixed by it. The note's smaller fixes gain the menu-focus line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: the gate row names the tree rebased onto #242

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* 0.7.0 note and audit: scope the trailer and library promises, record the pass's account writes

Review findings on #241:
- A trailer started with Play Trailer is an ordinary playback
  (request_play, preview: false) and reports a timeline; only the
  background preview, full-screen mode included, never reports.
- The library DOWN fix holds only when the reader has not moved before
  the shelves load.
- The device-pass summary counts #236 as passed only for shelves-first.
- The pass wrote to the Guest profile: the explicit PGS pick's
  PUT /library/parts selection, and the harness's unscrobble, progress
  seeds and playback timelines.
- The gate row states that every commit after b99e79f is note/audit
  only and which checks were re-run on the head.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fwcompat: grade the bundled FFmpeg libraries, and put their DT_NEEDED in the audit

#235 gave libavformat-plx a DT_NEEDED on libz.so.1, and nothing graded it:
the libraries are dlopen'd, webosbrew-ipk-verify grades only the app and
service executables, and fwcompat on a bundled library reported every
firmware FAIL for the sibling libav*-plx names no firmware carries.

tools/fwcompat.py --shipped DIR takes DT_NEEDED names that are files in DIR
off the firmware's list and counts what they export as resolved. Watched:
bare, libavformat-plx FAILs everywhere on its siblings; with --shipped pkg
all three pass from 4.4.2 to 11.2.0; against a copy of the 4.4.2 database
with libz removed it FAILs on libz.so.1 (4 symbols) and exits 1.

CI's firmware load matrix and the build's fwcompat gate now run it over
each bundled library; the build appends the matrix to pkg/ipk-verify.md,
which gen-release-audit.py embeds, and gen-release-audit.py lists each
bundled library's DT_NEEDED. Review finding on #241: the zlib verdict is
now read from the published package instead of typed into the audit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* v0.7.0 audit: the zlib entry defers to the generated half; the gate row names the tooling commits

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fwcompat review: row() takes its cells, and --shipped says what it trusts

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build-package: the bundled-library matrix goes into ipk-verify.md unfenced

gen-release-audit.py already wraps that whole file in one code fence; a nested
fence closed it. Only the step summary fences the aligned columns now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant