Repository navigation
detail: Play from Start on the hero, and Play relabels to Resume - #5
Merged
Merged
Conversation
…esume The detail page's Play pill was the literal c"Play" whatever the item's state, and both play arms ran metadata::resume_ns over the item unconditionally (the movie arm and the episode arm), so a part-watched movie or episode could only ever be RESUMED from its own page. The one restart in the app is the in-player Info card's "From Beginning", and that is a request_seek(0) on something already playing — you had to start at the resume point to reach the control that undoes it. One predicate now drives both halves. hero_resume_ns() answers what the play arm would ACTUALLY hand app.rs: a movie's own viewOffset, or, on a show page, episodes[0] of the selected season, because that is the leaf the hero plays. It puts that through metadata::resume_ns — the same Plex rule the action applies — rather than the raw `resume_ms > 0` the home hero keys on. That distinction is the point: a 4-second offset, or one past the 95% end-of-item mark, resumes from 0, and there a "Resume" label would be a lie and a restart disc a second Play. So the pill reads "Resume" exactly when the press will resume, and a counter- clockwise disc appears beside it that plays the same item from 00:00. "Resume" rather than home's "Continue": home's row belongs to the Continue Watching shelf and takes the shelf's word, while on an item page the control has a sibling, and Resume + a restart mark are a pair the eye reads together. The restart arm is deliberately the normal play arm with last_resume_ns zeroed AFTER it: app.rs reads that field only once on_ok has returned, so one override covers the movie path and the episode path at once, instead of threading a from-start flag through two call sites that would then have to be kept in step. The row's indices now move, so nothing may hard-code them: hero_action() maps an index to its action, and hero_col() resolves the focus against the live set and writes the result back. An index alone is not a stable name for a control when the set is derived from an item that arrives asynchronously, and both directions are reachable by hand. It SHRINKS: the watched toggle is the control that deletes the restart disc from under the focus, because scrobbling clears the server's viewOffset, and a focus left at index 2 of a two-button row draws nothing focused and makes every later OK inert. It GROWS: open_rk clears current() for the whole 2-5 round-trip fetch, so a RIGHT pressed in that window parks on the watched toggle of a two-button row, and when a part-watched item lands, index 1 has quietly become the restart disc — that press would start playback instead of marking the item watched. So the focus travels with its CONTROL: the disc is inserted at and removed from BTN_RESTART, and everything at or after it shifts by one when the set flips. Also here, because the change needed them: widgets::pill_w is the ONE hero-pill width formula (both hero rows relabel their pill from item state, so the frame has to be measured from the label — "Resume" cramped inside "Play"'s 168px), with home.rs switched onto it and Button's own icon ratio/gap named so the measure and the paint cannot drift; and Icon::Restart with its SVG mask, the mask verified by rasterizing it through the app's own nanosvg path at the 32px the disc actually draws. Tests: +5 host (63) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_018GuSHrq9oydnX7nhKE1Hvc
GLinnik21
force-pushed
the
unit-8-play-from-start
branch
from
July 29, 2026 17:58
9220938 to
0bc8c95
Compare
GLinnik21
added a commit
that referenced
this pull request
Aug 23, 2026
… real socket
CI was red on Linux with `thread '<unknown>' has overflowed its stack`,
at a different point in the output each run, while `make check` passed on
the dev Mac. The mechanism is not serde_json and not the session file.
`moving_a_server_to_https_re_points_its_slot` called the public
`register_origin`, where every other test in this module deliberately
goes through `register_with_client_id`. The public path fires
`serverinfo::refresh`, which spawns a `task::spawn_small` worker that
really opens a socket — and in a DEBUG build `stream::http_stream_boxed`
materialises its 64 KiB `HttpStream` as a STACK temporary before it ever
reaches the heap, despite the comment above it promising the opposite
("box it off the caller's stack"). lldb caught it on the guard page:
frame #0 stream::http_stream_boxed
frame #1 stream::http_get(host="10.0.0.1", port=32400, …)
frame #2 Client::get_json
frame #3 Client::server_root
frame #4 serverinfo::fetch_once
frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB
Measured on this branch by varying `SMALL_STACK`: debug overflows at 48,
128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is
exactly why one host passed and the other did not. **`--release` passes at
48 KiB**, so the optimizer elides the temporary and the television — which
ships `cargo build --release` (Makefile:438) — is not affected. It is a
latent debug-only hazard in `stream.rs`, pre-existing and not this
branch's to fix; the base simply had no host test that reached
`http_get` from a `spawn_small` worker. Reported on the PR.
The fix is the test, which was wrong on its own terms: `register` also
mints and PERSISTS a client-id uuid, and that seam's doc has said since it
was written that a host test must not write one. It gains an origin-taking
sibling (the pair-shaped one cannot express a scheme, which is what this
test is about) and a second documented reason nobody had paid for yet.
Verified with the same differential that found it: at `SMALL_STACK = 48 *
1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both
`--test-threads=1` and parallel. `task.rs` is untouched.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
GLinnik21
added a commit
that referenced
this pull request
Aug 23, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 26, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 27, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 28, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- 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 8 — Play from Start, and Play→Resume on the detail hero
Closes the
docs/parity-gaps.md§5c row 2 (↺ Play from start) and the appendix entry"No 'Play from Start' anywhere outside the player, and the detail Play button silently resumes".
The gap
detail.rs's hero had exactly two controls (NBTN = 2): a Play pill whose label was the hard-codedliteral
c"Play", and the watched disc. Both play arms applied Plex's resume ruleunconditionally — the movie arm (
:1191) and the episode arm (:1389) — so a part-watched itemcould only ever be resumed from its own page, never restarted. The app's one existing restart is
info_panel.rs:49"From Beginning", and that is arequest_seek(0)on something already playing:you had to start at the resume point in order to reach the control that undoes it.
What changed
One predicate drives both halves.
hero_resume_ns()answers what the play arm would actuallyhand
app.rs— a movie's ownviewOffset, or, on a show page,episodes[0]of the selected season,because that is the leaf the hero plays — and puts it through
metadata::resume_ns, the same rulethe action applies, rather than the raw
resume_ms > 0the home hero keys on. That distinction isload-bearing: a 4-second offset, or one past the 95% end-of-item mark, resumes from 0, and there a
"Resume" label would be a lie and a restart disc a second Play.
Resumeexactly when the press will resume.The watched toggle stays last and shifts to index 2.
Wording — "Resume", not home's "Continue" (deliberate, as asked). Home's row belongs to the
Continue Watching shelf and takes the shelf's word;
home.rs:425is left alone. On an item page thecontrol has a sibling, and Resume + a restart mark are a pair the eye reads together — "Continue"
next to a ↺ disc does not read as a pair. This is also how the reference clients word the item page.
The restart arm is the normal play arm with
last_resume_nszeroed after it.app.rsreadsthat field only once
on_ok()has returned, so one override covers the movie path and the episodepath at once — instead of threading a from-start flag through two call sites that would then have to
be kept in step forever.
The row's indices now move, so nothing hard-codes them.
hero_action()maps an index to itsaction;
hero_col()resolves the focus against the live set and writes the result back. An indexalone is not a stable name for a control when the set is derived from an item that arrives
asynchronously, and both directions are reachable by hand:
focus, because scrobbling clears the server's
viewOffset. A focus left at index 2 of atwo-button row draws nothing focused and makes every later OK inert.
open_rkclearscurrent()for the whole 2-5 round-trip fetch, so a RIGHT pressedin that window parks on the watched toggle of a two-button row; when a part-watched item then
lands, index 1 has quietly become the restart disc, and that press would start playback instead
of marking the item watched.
So the focus travels with its control: the disc is inserted at (and removed from)
BTN_RESTART,and everything at or after it shifts by one when the set flips. The clamp catches anything else.
Supporting pieces
widgets::pill_w— the ONE hero-pill width formula. Both hero rows relabel their pill from itemstate, so the frame has to be measured from the label ("Resume" was cramped inside "Play"'s fixed
168px).
home.rsis switched onto it — it computes the identical value, so home's recorded pointerhit rects are unchanged to the pixel — and
Button's own icon ratio/gap are now named constants sothe measure and the paint cannot drift.
PWsurvives as the pill's minimum.Icon::Restart+assets/icons/restart.svg. The mask was verified by rasterizing it through theapp's own nanosvg path at the 32px the disc actually draws (
CD * DISC_ICON_RATIO), not eyeballedas source.
metadata::set_current_for_test— a#[cfg(test)]seam, compiled out of the shipped binary. Thescreens' label/focus math reads
current(), and the only real way to populate it is a PMS roundtrip.
No new colour literal, no raw font size, no hand-placed text; the two new controls are the existing
Button/CircleButtonfamily. No new PMS endpoint.Verification
make check— 63 pass (58 baseline +5). The new tests cover the resume predicateincluding both Plex-rule edges (sub-floor offset, 95% tail) and the show path; the index→action
mapping in both control sets; the focus surviving a set that shrinks and one that grows under it;
and the resume each play path bakes in versus what restart leaves behind. All hold
crate::testlock::serial()—metadata::CURRENTand detail'sVIEWare crate-wide globals. Thetwo new behavioural assertions were mutation-checked: deleting
commit_resume's body, anddeleting the index-shift in
hero_col, each fails exactly its own test.a vacuous test (the restart override is now the extracted
commit_resume, which the test actuallycalls), the grow-under-focus misfire described above, and two documentation gaps (
focus()is nowa write on the draw path;
pill_wassumes an icon-bearing pill).make(ARM cross-build) green, no new warnings.recipe (seed/reset, the one-boot trigger sequence for each path, and the exact log lines that
decide it) is the last section of this description.
Note
docs/parity-gaps.mdstill citesdetail.rs:88 NBTN = 2in several places. Left untouched onpurpose: eight sibling units are editing that audit concurrently and it is a point-in-time snapshot.
Device verification: deferred to coordinator
Not run — the shared TV was held for the whole window and queuing for it was not a good use of
budget. Everything below is prepared and ready to paste; the host tier and the cross-build are green.
0. Prerequisites
1. The server-state trap, first
The resume point is server state that outlives the run, and the app's timeline reporter posts
progress every 10s while playing — so each boot below must be preceded by its own reset+seed, or the
next case inherits wherever the previous one stopped.
The reset must be
/:/unscrobble.PUT /:/progress?time=0returns 200 and changes nothing(verified live;
time=1too) — which is exactly what makes this look already handled.PUT /:/progressis how you seed a non-zero offset; it is only the reset it cannot do.2. One-boot proof driver
plxnative-detail=<rk>opens that page (blocking load),plxnative-detailcol=Nsteps focus RIGHT Ntimes,
plxnative-detailplayactivates the focused control — socol 1is the new disc, and thestep itself proves the LEFT/RIGHT walk reaches it.
3. Movie path — rk 4 (The Substance, dur 8469000 ms)
4. Episode path — show rk 437 (The Morning Show), whose S1E1 is rk 439 (dur 3818112 ms)
The show page's hero plays
episodes[0]of the selected season, andcur_seasonis 0 on open — sothe resume point that matters is S1E1's, not the show's. Seed 439, open 437.
5. What the log must show
col 0(pill)col 1(↺ disc)ff: seek <N>s rv=0(direct play) orresume(transcode): restart at offset <N>sff: seek 0spos=samples off the once/secFPS=heartbeatroute=playerplayerPlaying error,reload_at: fresh LoadThat table is the assertion: the restart disc must start the same item at 0 rather than at the
seeded offset, on both paths.
Two ways to be fooled, both checkable in the same output:
detail: rk=437 … eps=0. If the episode list is empty the hero row is only two controls, sodetailcol=1lands on the watched toggle anddetailplayscrobbles instead of playing.Symptom: no
route=player, ascrobbleline, and the item comes back marked watched. The movieline should read
show=false; the show line must readeps=10.index 1 is again the toggle. This is why
checkruns before every boot.6. Screenshot + the UI tier
tools/tv-session.sh up --screen detail=4 # clears triggers, injects the token, verifies the deploy tools/capture-screen.sh /tmp/unit-8.png DISPLAYWith rk 4 seeded, the hero must read
▶ Resumeon the pill, with the ↺ disc between it andthe existing ✓ watched disc — three controls, not two. Clear the seed (
reset 4) and re-capture: thepill must fall back to
▶ Playwith the ↺ disc gone (two controls)../tests/run.py --fps # UI tier; detail-transition is the scene this change can move7. Hand back
🤖 Generated with Claude Code
https://claude.ai/code/session_018GuSHrq9oydnX7nhKE1Hvc