Repository navigation
Trailer preview: stop at its end and off its page, never write watch state; follow media redirects - #239
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A detail-page trailer ran past its end for three minutes, the film's Play then
failed against its still-live engine ("live Engine belongs to another Load
attempt"), and no later page autoplayed. Every preview decision was keyed on
the preview Machine's phase, and several paths let that phase drift from the
session actually installed:
- after_pump only stopped a preview at EOS or failure while the machine was
non-Idle, and only ran while an engine was started, so a machine that lost
track of its session never stopped it, and a refused preview landing (no URL,
pump_play returns nothing) left the machine in Fetching forever, which made
occupies() true and blocked every later dwell.
- A machine left non-Idle after its session was replaced acted on the FILM's
engine: a film Load failure or EOS was read as the preview's.
- halt() stopped whatever engine was installed whenever the machine was
non-Idle, film or not, and a halt during the resolve let the landing start
an engine nothing tracked.
- A Play from a page only pre-empted a preview; a live engine nothing owns
(neither a preview nor the player page's) refused the Load, and at its EOS
nothing stopped it because the teardown is player-page gated.
after_pump now runs every playback frame and asks one pure function, settle(),
which decides from the installed session: a preview engine's end or failure is
stopped whatever the machine says; a machine whose session is gone is reset
without touching the engine; a preview landing with no engine is remembered
as refused. halt() stops only a preview's engine and keeps the machine
Abandoning while a returned-too-late Load is still installed; a landing the
machine is no longer waiting for is discarded. Every page Play (ordinary Play,
held-play drain, item menu Play Trailer) goes through clear_engine_for_play,
which also retires an off-route orphan engine, and the EOS loop stops such an
orphan when no player page exists.
Preview logging: start result and phase, the blocked reason once per change,
every machine phase change with its cause, EOS, and a discarded landing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A preview whose Original open failed was retired by clearing the session's preview flag while its deferred Load still held the engine. The next pump then read an ordinary session, rescued it onto an HLS transcode and started a timeline reporter: the trailer played off-screen and posted `timeline playing` to the viewer's account every ten seconds. - `preview::retire` is the one way every preview exit stops its engine (EOS, failed Load or open, failed seek, halt, abandoned Load). The flag is cleared only once the engine is gone; otherwise the machine stays Abandoning until after_pump finishes it. A failed open is handled once, not every frame. - The session records that it was resolved for a preview (`route::preview_request`), fixed at landing. The timeline lease, the stop scrobble and the pump's Original->HLS rescue all ask it, and a preview's Original is never ABR-watched. - A preview lives only while the page that started it owns input, checked every frame after the navigation commit, so Home, another title, Account/Settings, menus and BACK all end it. An app suspend halts it and never parks it for the foreground reload. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Plex-hosted trailer's Part URL answers 302 to a presigned CDN URL on another origin (usually https, sometimes a relative Location). The socket client made exactly one request per open, so the progressive open logged `ff: http_open FAILED status=302` and the demuxer produced no access units. stream::redirect::open_following wraps the socket open in a bounded loop (5 hops) for every plaintext media open the demux thread makes: the progressive first open, the AVIO seek reopen and the HLS source open. It resolves absolute, scheme-relative and relative Locations, forwards the X-Plex-Token query pair and any credential header block only to the original scheme+host+port, keeps a Range on every hop, and stops at the first https hop so the caller opens it on the curl source. The effective target is stored in Src::Socket, so later Range seeks start from it. The response head's Location is captured into HttpStream before the socket closes. Log lines carry origin and query-less path only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finding: a redirected playlist was parsed against the URL it was requested from, so a relative child resolved under the old directory. - `stream::redirect::Request::same_origin_only`: a caller confined to one origin refuses any hop elsewhere before dialling it. HLS sets it, which is the `hls.rs` contract that the media worker never fetches from anywhere but the PMS origin; progressive opens keep following CDN redirects. - `hls_open_source` returns the resource the open landed on (token removed again, `Resource::from_request_path`), and both master and media playlists resolve their children against it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
force-pushed
the
fix/trailer-preview-lifecycle
branch
from
September 25, 2026 03:38
9d016d9 to
ba0cf11
Compare
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
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]>
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
…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]>
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.
Fixes release-blocking trailer-preview playback bugs from the 0.7.0 device pass. Nothing here has been verified on the TV yet.
Root causes and fixes
1. A trailer ended but its preview did not stop, and the film's Play then failed with
live Engine belongs to another Load attempt.Nonefrompump_play, so its handling code could never run. The machine stayed in Fetching forever and no later detail page autoplayed.player::preview::after_pumpnow settles every frame through one pure decision,settle(PumpFacts) -> Nothing | Ended | Failed | Stale | Refused. It only ever stops a preview's own engine. A preview landing that nobody is waiting for is discarded.content::clear_engine_for_play, which retires an off-route engine that no page owns. This covers the page Play, the held-feature drain and the item menu's Play Trailer.2. An autoplayed trailer posted
timeline playingto the viewer's account.pump::finish_preview_open_failurecleared the session's preview flag while the preview's Load was still in flight and still held the engine (the Load is deferred, not joined). The next pump frame saw an ordinary session, switched it to an HLS transcode, and that reload started a timeline reporter.preview::retireis now the single path by which every preview exit stops its engine (EOS, failed Load or open, failed seek, halt, abandoned Load). The flag is cleared only once the engine is gone.route::preview_request). Nothing but the next landing clears that. The timeline lease, the stop scrobble and the pump's Original→HLS fallback all check it. A preview's Original stream is never watched for automatic fallback to HLS.3. A trailer kept playing after the viewer left the detail page.
4. Plex-hosted trailers failed with
http_open FAILED status=302.Location.stream::redirect::open_followingfollows 301/302/303/307/308 for at most 5 hops. It handles relativeLocations. The token and credential headers are sent only to the original origin. An https hop is handed to curl.same_origin_only, which keeps its contract that it only fetches from the PMS origin. It also resolves playlist children against the URL the fetch actually landed on.Consumers migrated or proven unaffected
put_selectionwere already unreachable for a preview (plan.rs).retire. The remainingclear_previewcalls run only with no live engine.clear_engine_for_play.open_following. The control plane (crate::http) keeps its own opt-in redirect policy.Tests (RED → GREEN)
a_session_resolved_for_a_preview_never_reports_a_timeline: failed before (the lease was granted), passes after.a_preview_is_halted_once_its_page_no_longer_owns_input: failed before, passes after.ff::redirect_testsfailed on the base commit. The two HLS tests added after review (redirected master rebase:/old/variant.m3u8vs/new/variant.m3u8; refusing a hop off the PMS origin) also failed first. All pass now.crate::testnet::accept.Gates (committed tree, rebased on main)
make check:test result: ok. 4396 passed; 0 failed; 2 ignored; 0 measured; 0 filtered outtest result: ok. 4452 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out(hostsim)test result: ok. 101 passed; 0 failed; 0 ignored; 0 measured; 0 filtered outcargo +nightly check --lib --no-default-features: Finished, no errors.make(ARM cross-build): succeeded.Review
FOLLOWLOCATIONon).curl_easy_getinfofor the effective URL, or turning off curl's following for HLS. Either is an FFI change.Known follow-up
FOLLOWLOCATIONon before this PR). It does not check the target's origin, and the playlist is still parsed against the requested URL, not the redirect target. The plaintext path enforces both. Closing the gap needs the effective URL from curl (a newcurl_easy_getinfobinding and its fw-compat review), or turning off curl's own redirect following for HLS. Deliberately left out of this PR.Not verified
🤖 Generated with Claude Code