Skip to content

search: the query capsule, its solid caret, and the scope line - #43

Closed
GLinnik21 wants to merge 57 commits into
shared-servers-basefrom
search-field-capsule
Closed

GLinnik21 wants to merge 57 commits into
shared-servers-basefrom
search-field-capsule

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Fills in ui/search/field.rs, which landed as a stub with a final signature.

Read the diff for rust-modules/src/ui/search/field.rs only. This branch is stacked on the search-seams commit 1dafd764 (shared-servers-integration), which is not published, so GitHub shows that base's commits here too. git diff 1dafd764 --stat on this branch is one file. mod.rs, the sibling submodules, search.rs and app.rs are byte-identical to the base — I verified that explicitly before committing, because I used throwaway local patches to mod.rs to reach states the boot trigger cannot (see below).

What it draws

  • The capsule. Pill radius, the card system's resting shadow (the same one every widgets::Button carries — without it an ACCENT capsule barely measures against its surround and only the dark label survives, floating). Focused or editing → ACCENT + ACCENT_INK; otherwise CONTROL_IDLE_FILL + CONTROL_IDLE_INK, so a held query stays legible without claiming focus it does not have. Those two states share one fill deliberately: the keyboard being up is the strongest statement that this control has the remote, and a field that dimmed while you typed into it would say the opposite. No magnifier — the pill above it is the mark.
  • The placeholder, drawn whenever there is nothing readable in the field. ROW_VALUE_INK_ON_DIM over the accent fill, TEXT_TERTIARY when not.
  • The caret: 3 × 34, solid, only while editing, and it must stay solid. ui::idle gates the whole frame present on motion it can detect and cannot see a clock, so a blink would either freeze on screen or hold the GL loop awake forever.
  • The scope line at x=950 on the field's row, CAPTION/TEXT_TERTIARY, elided to the app's right margin.

Tokens and rungs throughout — no colour literal, no raw font size, every run placed by Label's cap band.

The two pure functions

Extracted and host-tested because each is the kind of thing that is wrong by a few pixels or one word and invisible in a screenshot.

run_layout — the field shows the tail. While the run fits it starts at the padding and the caret trails it; once it outgrows the box the whole run slides LEFT by the overflow, parking the caret's right edge exactly on the box's. A Painter::clip scissor (set and cleared inside the one draw, since it is global GL state) cuts the head at the padding instead of letting it slide out over the capsule's arc. The caret sits at the run's end with no lead, because that is the insertion point — the first cut had a 4px gap, which is visible as the bar jumping backwards on the first keystroke of every search.

scope_text — stated only when the scope is smaller than the account. All sources live it names them and attributes the share; one that did not answer names the machine and what you are looking at instead. No warning tint and no Retry: re-kicking a source is a control and it lives on that section's Library screen.

Three boot-reachable states worth reviewing

These are the judgement calls, and the first cut got all three wrong in ways no screenshot would have caught. A code review pass found them; all three are fixed and each has a test.

  1. Ownership before the roster lands. plex::describe_server is fed by plex.tv and by a server naming itself, both of which land after this screen's first frame — so server_facts is legitimately None at boot. Defaulting owned to true there labels a friend's machine "your server" (and, with two undescribed sources, reads "Searching your server and your server"). It now takes ownership from registration order, which is a documented invariant rather than a guess: app.rs registers shares after plex::install, "so slot 0 is always the session's own server".
  2. Attribution with two shares. The handle is attributed only when there are two sources and exactly one is a handled share. A first-match pick would attribute one owner and silently drop the other into the same unbindable · the three-source rule already refuses.
  3. A whitespace-only query. The screen below gates on the trimmed string, so a lone typed space must not leave this capsule blank and hintless while the rest of the screen says nothing has been asked. The query is also truncated at a NUL — enter is fed by a boot trigger that reads a file, so unlike keyboard input it is not guaranteed NUL-free, and CString::new failing would blank a field that still believes it holds text.

Not fixed here, and flagged rather than smuggled in: the scope line has no invalidation source of its own. This is the first per-frame draw to read plex::server_facts, and neither plex::describe_server nor the auth worker calls ui::idle::invalidate, so on a settled screen the roster landing is not presented until the 2 s keepalive. The right fix is one line at describe, which is a shared-module edit I did not want to make unilaterally with the rest of the shared-servers fleet in flight. It is written down at the call site. The fallback wording is what keeps the intervening frames a sentence rather than a hole.

Also left alone: two sources with the same machine name produce "nas-home unreachable · results from nas-home only". Real but narrow, and disambiguating it honestly needs more than this function has.

Verification — simulator only, NOT device-verified

The television was in use, so everything below is make sim-shot on the macOS host. Nothing here has been seen on a TV panel, which means the rasterization and cap-band judgements this screen depends on are unverified where they matter most.

make check — 551 pass, 16 of them in ui::search::field (6 on run_layout, 10 on scope_text). make cross-links clean for ARM.

Six states photographed and looked at:

  1. Empty, focused — near-white accent capsule at 90,148,820×60 on a full pill radius; Search in the dim on-accent ink at the 32px padding. No magnifier in the field.
  2. wallace, focused — the run in near-black on the accent fill, left-aligned at the padding, cap-band centred in the 60px row.
  3. wallace, editing, two sources — the solid bar immediately after the final e, and the scope line reading "Searching your server and Film Club · friend". That first phrase is the unnamed-source fallback doing its job: the simulator's own server has no roster name at boot, which is exactly the state finding (1) is about, and it produced a sentence rather than a hole.
  4. Empty, editing — | Search: the caret at the insertion point with the placeholder clearing it, not sitting under it.
  5. wallace, focus elsewhere — the dark idle capsule, query in white, no caret. Clearly unfocused, still legible.
  6. An overflowing run, editing — the run has slid left, the head is cut mid-glyph on a clean vertical scissor edge at the padding, the tail is on screen, and the caret's right edge is parked exactly on the box's. This is the state the whole run_layout/scissor design exists for and it behaves as specified.

States 3–6 needed mod.rs patched locally (the boot trigger enters with editing: false and zone: Field, so the caret, the idle fill and the scope line are otherwise unreachable headlessly). Those patches were reverted before the commit and git diff 1dafd764 -- mod.rs is empty.

Server names, the library name and the handle are placeholders in the code, the tests and this description — nas-home, Film Club, friend. No real third-party data appears anywhere on this branch.

One finding worth propagating (it cost several workers a hang today)

make sim-shot waits for PLXNATIVE_SHOT_FRAME presented frames, and ui::idle gates presents. A settled screen sits at fps=0–1, so the default SIM_FRAME=200 needs ~200 seconds and reads as a hang with no output at all. Arm the DIAG trigger plxnative-noidle in SIM_DIR before shooting any screen that comes to rest — it is DIAG-exempt, so it does not also change which screen you boot to. This belongs in the ui-sim skill's recipe.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV

GLinnik21 and others added 30 commits August 14, 2026 00:05
…dy carries the facts

Deliverable E of the Shared Sources design. On a friend's item the detail
hero's date/runtime line reads "13 Jun 2024 · 1 hr 57 min · Shared by bamx23"
— one more run on a line that is already there, rather than a chip, a band or
a line of its own.

WHERE, AND WHY NOWHERE ELSE. An item's source is stated where the item is, and
the badges row above cannot be it: those chips say what the item IS — 4K, CC —
and where a copy came from is not a media property. Its own line would be a
fifth line in the one column already fighting for height, for a fact you read
once; a kicker above the title is where an episode's show name goes. So it
joins the FACTS line, last, after the facts about the item, because it is a
fact about where the item came from. It takes that line's own rung and ink
(CAPTION, tertiary, regular) after the same .45 middot every separator there
uses: it is dim because the line is dim, and the line is the lowest rung in
the ladder — under it is the couch legibility floor.

ON YOUR OWN SERVER THERE IS NO RUN AT ALL, not an empty one and not a
dangling dot. `Detail::source` is the owner's HANDLE and is empty for our own
machine, and empty means the flow emits nothing — no separator, no run, no
draw call — so the 90% of installs with one server pay nothing for the
feature. The host suite's first assertion is exactly that: the borrowed row's
event list is the own-server row's with the credit appended, prefix-identical.

The person, never the machine. "bamx23" is the same string the shelf headings
say; "bx23-ldn" stays in the Sources list and the failure read-out, because
"whose copy is this" is answered by a person and "what could not be reached"
by a machine.

THE ROW BECAME A FLOW, which is the part worth reading. It was a
`dotted_run` + `dotted_run_w` pair — a paint expression and a width expression
that had to be kept agreeing — plus a yield ladder written in terms of the
second. `home::heading_flow`'s doc names that exact pair as the pattern to
stop repeating, so this row now has ONE expression: `facts_flow` hands each
run to a closure that paints in the product and measures in the tests, and
`facts_fit` takes a measure rather than owning one, so the row that is graded
is the row that is drawn. `dotted_run_w` is gone; `dotted_run` stays, still
the identity line's join, which is a join and not a tail-with-a-fragment-in-
the-middle.

The ladder is unchanged for an item with no source, and the tests prove it
across every budget rather than at a corner: the extent goes entirely, then a
date that cannot fit alone is elided. The credit slots in AHEAD of both — the
trailing credit yields first, as the design calls it, because the item's own
facts outrank the attribution; and monotonically, so a row that had to drop
its extent can never win the credit back.

One behaviour changed for items with no source, and it is a fix: the
fragment's leading separator is now decided by whether anything was actually
emitted before it, not by whether the item HAD a date or an extent. An item
whose extent was dropped by the ladder while its date was empty used to open
its facts line with an orphan dot.

`Detail::source` is "" at its one construction site, so nothing new is
reachable in the product until the multi-server layer can say which server a
fetch was made against (docs/shared-servers.md step 2 threads `ServerId`
through this struct; the roster field behind it is `Resource::source_title`,
already parsed). It is captured at FETCH time rather than read at paint time
because the page outlives the fetch and the current server can move under it.

Host 418 -> 422 + lint, `make` (ARM) green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
A ratingKey names an item on ONE server. So does a Part.id, a Stream.id, a
playQueueID, and the resume point. Every PMS call on the playback path used to
find its server implicitly — `plex::client_opt()`, evaluated at the instant of
the call, which means "whichever server the user happens to be browsing right
now". With one server that is always the right answer. With a friend's share
merged into Home it is right only by luck, and the resolve worker alone asked
the question four independent times, so a switch landing mid-resolve could split
one playback across two servers.

The server is now captured ONCE, on the main thread, at `request_play` — the
same instant and under the same discipline as every other `ResolveEnv` field —
and carried by value from there: ResolveEnv → Plan → CUR_SID, installed beside
CUR_RK by `apply_plan`, which is the sole writer of the route statics. The
resolve's client bind, the PlayQueue, /decision, the stream-selection PUT, the
transcode seek, the retranscode and the final scrobble all take
`client_for(sid)`. None of them asks what is current any more.

`plex::client_opt()` deserves naming as the hazard it is. It is not a static a
worker could be caught reading — it is a function call, so `Send` cannot see it,
and a worker that resolves its own server compiles clean and passes every test
we have. That is why `build_stream`'s doc now says so in as many words.

The one that had to land in THIS commit rather than a follow-up is the
`/:/timeline` reporter. It runs on a worker every ten seconds for the whole of a
playback and had no capture at all — it re-read the current server on each tick.
Split from `CUR_SID`, the app would resolve correctly, play correctly, and
quietly write the resume point of a borrowed film onto your own server every ten
seconds for as long as it played. Nothing would show it: the POST is
fire-and-forget, the host suite has no runtime, and the device harness grades
progress from the app's own heartbeat rather than from the server the report
reached. So `report_timeline` takes the id as an argument and `engine.rs`
captures it at the spawn site, beside the `rk` it already captured.

Two smaller things fall out of the same rule.

The `/identity` machine id cache is now keyed to the server that taught it. It
feeds `uri=server://{machineIdentifier}/…` on the PlayQueue POST, so one cached
globally is server A's fingerprint sent to B, naming a machine B has never heard
of — on a POST that is best-effort and therefore fails silently. The registry's
own per-server id outranks the cache entirely, so a server registered with one
skips that round trip.

And the Up Next still-warm moves out of `apply_plan` into `pump_play`, its only
caller. That function's contract is to be the sole writer of the route statics;
a texture prefetch is not one of them. Keeping them apart is also what lets the
host suite reach the install at all — `warm_tex` drags in the poster cache and,
through it, a GL call the dev Mac cannot link.

`metadata::cached_playing` / `fetch_playing_item` take the id for the same
reason. The fetch uses it now; the cache HIT still tests the rk alone, because
`Detail` does not yet carry the server it was loaded from — that gap is written
up at the call site as the one hole left in the capture, with what it will cost
and the one-line shape of the fix.

Three host tests, plus one fixture repair. `Plan`/`ResolveEnv` round-tripping
the sid is graded on the resolve that FAILS, which is the exit `build_stream`
takes before any network. The machine-id cache is graded from both sides. And
the timeline routing is graded against two real loopback servers: the item plays
from B, the user switches to A, the POST must land on B — with a closing report
to A as the control, so "A heard nothing" is a fact about routing and not about
a listener that never worked. That test needed `plex`'s registry test seams
widened to `pub(crate)`: the public `register` resolves the device id through
`session::load`, which mints and PERSISTS a uuid, and a host test must not write
one; `reset_for_test` is what hands the table back empty afterwards.

The fixture repair is `ui::detail`'s test `mount`, which reset the filmstrip's
sub-row and the season capsules as retained state but not `saved_col`, the
per-section column memory `move_focus` seeds from when it enters a strip. So a
test that walked one strip decided where the next test's first DOWN landed.
Order-dependent and therefore invisible until the set of tests changes, which is
exactly what a route case holding `testlock` across real socket I/O did.

Device: ./tests/run.py 21/21. Host: make check green, 12 consecutive runs at
--test-threads=16.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
Plex's relay is the last connection a server offers and the only one with a
ceiling: a tunnel to a Plex relay host, conventionally :8443, capped at 2 Mbps
with the server transcoding down to fit. probe.rs already ranks it last. What
was missing is what playback should DO when it wins, and the answer is a
branch rather than a parameter, because there is no parameter to reach for:
TranscodeSpec has no bitrate field, maxVideoBitrate is a literal on the
re-encode branch alone, and on direct play — this client's default and its
whole point — a cap means nothing, since no encoder is running to obey it.

So plex::link_policy denies TWO things over a relay, and the second is the one
a "force a transcode" instinct leaves behind. Direct play is obvious: the
share measured this week is 31 Mbit/s, and 31 down a 2 arrives as a stall two
minutes in with the AU queue draining and nothing on any surface saying why.
But a container REMUX is no better — it copies the codecs and deliberately
sends no cap, because a cap is exactly what would force the re-encode it is
avoiding. Same bytes, same rate, one layer down. Denying both leaves the
re-encode, which is the only flavor whose whole point is that the server picks
the rate; the server is on the other end of the tunnel and is the only party
that knows its real ceiling.

The tier itself is now a property of the SERVER, not of a request:
Client::set_link/link(), lock-free, LINK_UNKNOWN until something says
otherwise. route::build_stream reads it off the client it already holds — no
new global for the resolve worker to consult — and one derived `remux` local
keeps the payload guess, the stored flavor a seek rebuilds from, and the
/decision query from disagreeing. Nothing calls set_link yet, so link() is
None everywhere and UNRESTRICTED is what every play gets: byte-identical
behaviour, which is also why "unknown" is deliberately permissive rather than
defensive. Assuming relay would downgrade every direct play on earth to a
server-side encode to prevent a stall on a connection this codebase has never
made.

NO RELAY CONNECTION HAS EVER BEEN OBSERVED HERE. includeRelay=1 has been on
the query since the first login and every relay connection was then discarded
unconditionally. The 2 Mbps and the :8443 are Plex's documentation, not our
measurement, and this account's share advertises no relay at all — so it is
not merely untested, it is untestable from here. The policy doc says so, at
the policy.

A REGRESSION THIS WORK CAUSED, found by review. Adding includeIPv6=1 to the
roster query means plex.tv now offers v6 connections, and the live sign-in
chooser takes the FIRST `local` match and PERSISTS it. stream.rs parses a
dotted quad by hand (AF_INET, no DNS), so a v6 literal is not slower, it is
undialable: a server listing its LAN v6 first would have signed in
"successfully" to an empty Home and written that address to the session file,
so every later boot started there too. The chooser is extracted as
auth::choose_local_connection — the rule was not gradeable at all before —
guarded on both the flag and a colon in the address, since a null flag must
not be believed, and it has the two tests that would have caught it.

DOCS. plex/CLAUDE.md gains the registry section it never had: why the table is
atomic pointers (client() is called three times per key, per visible tile, per
frame), why each Client is leaked (a re-point costs a worker one request to
where that server used to be, never a dangling pointer), why token generations
are globally unique (the poster memo compares ONE number, so equal generations
would serve server B its cards from A's memoised token-bearing paths), and the
three states the whole feature rests on: granted, pinned, reachable.

The Makefile said FFmpeg is unlinked because "SONAMEs move between releases,
55->57->58->59->60" a hundred lines above the rules that build and stage a
bundled, PINNED copy. Both halves are in the same file and they contradict
each other. The real reason is different in kind: those .so files land beside
the binary, on no library search path and with no rpath, so a DT_NEEDED entry
would resolve at exec() against the system path and either find nothing (dead
before main) or find the TELEVISION's FFmpeg, which is the wrong one. Left
alone, the old wording is how "just use the TV's libavformat for https" keeps
coming back — when what we ship is --disable-network and cannot open a URL.

docs/shared-servers.md is brought level: §3 separates what was fixed from what
is still live (the 8-second trap is still exactly as live as it was), §5 marks
each step's status, §6 defers to the design canvas and names the two things
its own earlier draft got wrong, §7 retires the harness question and records
that relay is unverifiable from this account, §8 shows all four corrections
landed, and §9 covers all seven units.

Host 418 -> 424 + lint (x3), `make` (ARM) green. No device run: the docs half
cannot be observed on a television and the relay half cannot be reached.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…only observable on the TV

`/tmp/plxnative-shared=<handle>` stamps that handle onto every item the session
loads, which is what a fully-borrowed library looks like from the detail page.

It exists because there is no host runtime: nothing in the suite draws a pixel,
so the only place the hero's "Shared by bamx23" run can be JUDGED — its weight
against the runs either side of it, whether it reads as the same voice as the
date, what a long handle does to the line — is a real panel. And until the
multi-server layer lands, `Detail::source` is "" on every path, so there is no
item on this server that can put that run on screen at all. Without the trigger
the feature is unreviewable by anyone, including the owner.

It goes through `dev::read` like every other trigger, so `RELEASE=1` compiles it
out with the rest of the `/tmp` surface, and it is deliberately NOT in `DIAG`:
it changes what the app draws, so it should suppress the who's-watching picker
exactly as `plxnative-detail` does.

Host 422, `make` (ARM) green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
Measured against the real share this evening, from the dev Mac:

  GET /photo/:/transcode?width=250&height=375&minSize=1&url=/library/metadata/1/thumb/1778526065
    -> our server:    Frozen's poster            25658 B  sha a211b9ac5a
    -> the shared one: Призраки в Венеции's      11707 B  sha 59928cd5b1

One request path, two different films. That is not a corner case: rating keys
are server-local integers from 1 on every Plex server, and the thumb path's
trailing timestamp is a cache-buster the other server ignores, so the paths
COLLIDE by construction rather than by coincidence.

THE POSTER STORE. The key was the request path and nothing else, so those two
posters were one slot: whichever landed first was drawn for both, and the tile
that missed showed a film from a library it had never asked about. The fetch
made it worse in the other direction — every worker read `plex::client()`, the
CURRENT server, whatever item the slot belonged to, so with a merged Home half
the requests went to the wrong host carrying the wrong grant.

So a ServerId rides every entry point, sits in the slot as the other half of
its identity, and is what the worker dials. It is a FIELD, not a key prefix:
keys already run ~135 bytes into a fixed 256-byte array, and `slot_matches`
compares the u16 first, which is the half that can reject without touching the
array — this runs for every slot of every probe of every visible tile.

Capture-at-the-spawn-site is honoured by the store itself: `lookup` writes the
slot's server on the main thread when it claims it, and the worker resolves
`client_for(that id)`. It never asks what the current server is, which is the
question that has no correct answer on a worker.

THE KEY MEMO had neither host nor token in its key and one token generation for
the whole map. Both halves are now per entry: the server is part of the key, so
server B's card can never be built from A's memoised token-bearing path (a
request to B carrying A's grant is a 401), and each entry remembers the
generation it was built at, because with a table of servers there is no single
"the token" to compare against any more.

LAYERING. The store fetched through `crate::stream` directly, behind the back of
the layer whose module doc says it is the only code that touches the socket. It
now goes through `Client::fetch_built` — deliberately NOT `get_bytes`, which
would append a second `X-Plex-Token`: the poster path IS the store key and
already ends in one.

SERVER FACTS. `serverinfo` kept one version, one subscription and one in-flight
latch for the whole app, justified in its own doc by "host/port fix at the first
install (a later install is only a token swap)". The registry retired that
premise. All three are now per server, indexed by the registry's own slot number
(and by its ceiling, so a second constant cannot drift out of agreement with it).
The LATCH mattered as much as the values: a global one silently skips the second
server's fetch while the first is in flight, and the answer it never fetched is
then read as fact. An id that names nothing reads Unknown — never a neighbouring
server's answer, and never a panic.

`register` now does the refresh, not `install`: install only ever reached the
current server, so a shared server registered beside it would have stayed
permanently Unknown — and `player::error_shape` blames a missing Plex Pass on a
known-free server, which is exactly the sentence you do not want aimed at the
wrong owner. The log line names the slot, because the machineIdentifier that
really identifies a server is a household fingerprint.

The three UI resolvers keep their signatures and gain `_on(ServerId, …)` twins;
the bare form is exactly `_on(current_server(), …)`, so a one-server install is
byte-identical and the item-server plumbing has a door to walk through. One
behaviour change falls out for free: a poster resolve before `plex::install`
used to panic through `client()` and now degrades to no artwork.

Host suite 421 (three new: the slot identity rule, the memo's two scopes, and
one server's Plex Pass never being read as another's), `make` ARM green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
Deliverable E of the Shared Sources design. When a second pinned source also
holds the item on screen, the actions row grows an "Also available" pill with a
trailing chevron, and it opens the app's usual Popover + TableView listing the
copies: the library on each source, whose it is and how long it runs, and the
resolution class as a badge.

The reason it is a CONTROL and not a section of the page is that an item on
several servers is a rare fact — a permanent band would spend a whole row on
nothing on every other page in the library. So it is drawn only when a second
source actually holds the film, and `is_available` counts distinct SOURCES
rather than copies: two copies in two libraries of one server is not "also
available elsewhere", and the row naming the second one would lead back to the
machine you are already on.

OK NAVIGATES. It opens that server's own page for the film rather than swapping
the copy under you, which is also what settles the per-server progress problem:
watch state does not travel between servers, so a design that switched the copy
in place would have had to explain a resume position that jumped. Navigating
makes it self-evident — you are on a different page, and it says where you are
in that copy.

Ordering is the copy that PLAYS first, then what a viewer would prefer: higher
quality, and at equal quality yours before a friend's, because yours cannot go
offline mid-film. The design's own example is the case that separates the first
two clauses — a 1080p copy you are standing on outranks a friend's 4K one — and
it is what the host tests pin, along with the gate and the rule that exactly one
row is ever ticked (marked on the first copy matching the page's own (server,
ratingKey), so a duplicated input cannot say "you are here" twice).

Copies are keyed by the item's GUID and never by its ratingKey: every
item-shaped integer in Plex is server-local and starts at 1, so both servers in
this household have a ratingKey 4. `install()` is the seam the multi-server data
layer feeds; it is empty until that lands, which is what makes the whole feature
cost a one-server library nothing — no query, no control, no layout.

Three things this needed elsewhere, each smaller than it sounds:

`Button` gains a TRAILING accessory slot, because the leading `icon` is part of
the label's own statement (the Play triangle IS "play") while a chevron is a
disclosure mark about what the control does. `pill_w` grows a `pill_w_full`
twin rather than a second sizing path, since sizing the pill without the
chevron and then drawing one pushes the label off-centre.

The hero row's focus now follows its CONTROL through an index change by name
(`HeroCtl`/`hero_set`), not by a `+= 1` around one insertion point. That was
sound while the restart disc was the only conditional control; with a second
one, two controls can appear in the same frame and which of them moved the
focus depends on where it was sitting. The geometry walk is one accumulation
for the same reason — the alt pill is a variable-width control in the MIDDLE of
a row that was otherwise a pill followed by fixed-width discs.

And the source switch itself is performed by app.rs, not by the screen.
Re-pointing `plex::client()` invalidates every store keyed to the server that
was current when it was filled — the hub catalog, the browse grid, an open
person page — and none of them carries a server in its keys, so a screen doing
the switch itself would leave server A's ratingKeys being fetched from server B
with only the page in front of you correct. `install_pms`'s wipe is now
`activate_server`, shared by the profile switch and this one, and the BACK trail
is truncated to its root because `Node::Detail` carries a ratingKey and no
server (step 2 of docs/shared-servers.md).

Host 418 -> 430 + lint, `make` and `make RELEASE=1` both green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
`/tmp/plxnative-shared=<handle>` already means "pretend this item came from
<handle>" — it is how the hero's own "Shared by …" run is judged on a panel,
because with `Detail::source` empty at every construction site there is no item
in the product that can put a borrowed-item surface on screen. A second copy of
that film on <handle>'s source is the other half of the same pretence, so this
reuses that trigger rather than adding a second one for one deliverable.

What it stands in for, precisely, because a stand-in that lies is worse than
none. YOUR copy is real: the page's own ratingKey, on the current server, with
the loaded item's runtime and resolution class and the library the browse store
says you are in — which is what makes the tick meaningful. THEIR copy is that
same film on a second registry SLOT, and the slot is real: a genuinely different
server when one is registered, otherwise the current server registered again
under a synthetic machine id. From everything this feature does — counting
sources, resolving a client, switching, refetching — that is a second source,
and because it is the same machine the ratingKey it carries is honestly the same
film. So OK performs the real switch and opens a real page, which is the one
behaviour of this panel that cannot be judged from a still.

The single invention is that their copy is one resolution class better than
yours, and it earns its place: the ordering rule is otherwise unobservable. The
design's own example is a 1080p copy you are standing on sorting ABOVE a
friend's 4K one — the case that separates "the copy that plays" from "the best
copy" — and with two equal badges a capture cannot show the rule was applied at
all. `one_class_better` promotes nothing past the top of the ladder and leaves
an unrecognised class exactly as the server spelled it.

It is built by a `pump` on the detail page's frame, not by the store's `reset`,
because a mount deliberately clears `metadata::current()` for the whole 2-5
round-trip fetch: at reset time there is no runtime, no class and no title to
copy. Two string compares in the ordinary case, and `dev_stand_in` is `None` at
COMPILE time under `cfg(test)` so the host suite can never depend on what this
Mac happens to have under /tmp.

Host 430 + lint, `make` (ARM) green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
`pump` returned early only on SUCCESS, so the ordinary case — the trigger not
armed, which is every real boot — re-opened `/tmp/plxnative-shared` on every
frame of every detail page. It now marks the attempt whatever the outcome, and
takes the "has the item landed" gate BEFORE marking, so waiting out the mount's
2-5 round trips does not spend the one chance the page gets.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
The trigger swap replaced the parser but left its doc — a JSON schema for a
`/tmp/plxnative-altsources` file that no longer exists, which would have sent
the next reader to write one. What survives from it is the sentence that has to:
the trigger literal, spelled in a comment so the catalog grep in the root
CLAUDE.md still finds this surface.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
Deliverable C of the Shared Sources design ruled the conditional in its own
list: "if the hero ever becomes independent of a shelf, it needs E's dim run
and the preference comes back." In this app the hero IS independent. It is a
rotating billboard built per fetch from Continue Watching plus every recent
hub, deduped and capped at 8, turning over on its own 8-second timer — so it
is nobody's focused tile, the shelf heading beneath it is attributing
something else entirely, and with a merged pool the front door could open on a
stranger's film with nothing on the screen saying so.

So the run comes back, on the hero's own meta line, as its last run:

    Movie · 2024 · 18 · Shared by bamx23
    S1 E4 · Episode title · Shared by bamx23

IT KEEPS THAT LINE'S RUNG AND TAKES ONE STEP OF INK. BODY, not the detail
page's CAPTION — a rung is a role, and the hero line is BODY because it is
read from across the room while E's is CAPTION because it sits under a page of
copy. What travels between the two screens is the ink step, secondary →
tertiary, after a middot at the separator token's own .45. The host tests
assert the rung explicitly, because "match E literally" is the plausible wrong
answer and it is invisible in a diff.

THE LINE NOW HAS A WIDTH BUDGET, WHICH IT NEVER HAD. This is copy over a
photograph, legible only inside the hero's corner wedge — which is gone by
four fifths of the frame and leaves the last fifth, the side the composition
is usually about, completely alone. HERO_META_R ends the line at three fifths,
a whole fifth of the panel short of that edge, and every run in the flow is
handed a budget running to it. So an over-long handle ELIDES where a wrapped
block would have spilled: there is no wrap in this flow to reach, only a bound
to truncate against, and the line can never become two. The facts ahead of the
run keep the hero column exactly as they always have — the handle is the last
thing on the line and a fact about where the item came from, so it is the
right thing to lose first.

OWN-ITEMS-FIRST IS AN ORDERING, NOT A FILTER. `own_items_first` promotes the
first owned page to the front and moves nothing else, so [B,B,O,O,B] becomes
[O,B,B,O,B]: the door opens on your own library and a friend's film arrives
one flip in, attributed. Filtering instead would leave a borrowed-only account
with no billboard at all and would overrule a pin the user made — which is why
a pool with nothing of ours in it is left exactly as it is. It needs no switch
of its own either: the pool is built from included sources only, so a borrowed
hero is always the consequence of a pin.

The pool's entries stop being bare catalog indices and become HeroSlot — index
plus the handle of the shelf's server. It is carried rather than looked up
because this is the one place in the app that lifts items OUT of their shelf
order, so an entry that knew only its index would have to scan its way back to
a hub to answer "whose is this", for a fact the build already had in hand.

With one source none of this exists: `HubRow::source` is "" everywhere, so the
flow returns before its first run — no pad, no dot, no draw call — and
own_items_first returns on its first line. Absence, not an empty annotation.

Two things the flow forced, both real:

  * hero_content's off-screen cull was measured on the text column, and the
    run is the one thing that draws outside it. Left alone, a flip would take
    the whole column away while ~400px of that line was still on the panel,
    and the tail of the meta line would blink out ahead of the item it
    belongs to.
  * meta_drawn_w clamps to the column. `TextView::truncates` answers "were
    WORDS left unplaced", and a single token too wide for the column leaves
    none — it is ellipsized by a separate safety pass — so the measured string
    can be wider than anything drawn. Unclamped the run would start in mid-air
    past the ellipsis, and an absurd one could hand the flow a negative
    budget, which text::elide reads as "no bound at all".

SOURCE_PAD is now one constant for both places this screen states a source.
The heading and the hero line are one annotation in two positions, not two
spacings.

/tmp/plxnative-shared — the detail page's own trigger, reused rather than
twinned — stands in for a source where the real answer is empty. The visible
half of this work is unreachable in the product until the multi-server layer
lands, and the two things the design states about this run (that it sits
inside the wedge, and that it ends well short of the last fifth) are things
only a panel can settle. One file arms both surfaces, which is the only way to
see the hero's run and the detail page's agree. Both hero accessors go through
it, or the run would pop into existence halfway through a flip.

Host 427 (+9: 4 for the ordering, 5 for the line) + lint, `make` (ARM) green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…' into shared-servers-integration

# Conflicts:
#	rust-modules/src/route.rs
…that looks local

Sign-in kept exactly one server and threw the rest of the account away. Both of
its passes filtered on `c.local && !c.relay`, and against a real share that is
worse than useless: `Connection.local` means "this address is RFC1918", not "you
are on that LAN", so for a friend's server it selected the OWNER's 172.20.x.x —
eight seconds of timeout from here, and the worse outcome is that it SUCCEEDS,
against whatever else happens to sit at that address on our own LAN.

So discovery now works the way every Plex client with a connection story works.
Each resource that provides a server — ours and every share alike — is turned
into ranked candidates by `plex::probe` (which is what drops that address), and
they are dialled in order until one answers. `/identity` is the probe, chosen
because it is unauthenticated: it answers 200 to anybody, which makes it useless
as a token test and perfect as a reachability one. The token is deliberately not
sent, because a probe can land on a machine that is not the one we asked for, and
that machine must never be handed a live credential.

Which is the same reason the answer is VERIFIED: a candidate that answered is not
yet a server, so its machineIdentifier must equal the resource's clientIdentifier
before the connection is accepted. Anything else is discarded and the next address
tried. A 401 is its own state and not "unreachable" — every other address of that
server answers a token problem identically, and reporting "can't reach bx23-ldn"
for one sends the user to look at their friend's router. Note what that does NOT
cover, spelled out where the probe path is defined: an accessToken revoked since
the resources fetch still probes as reachable, and surfaces on the first
authenticated request instead.

Everything that answers is registered with the server registry under its real
machine id and its OWN per-(user, server) token, and persisted as a roster in the
session beside the primary ServerRef, which is written exactly as before — a
single-server account produces the session file it always did, plus a one-entry
roster. Our own server stays current: a share is browsable, never the default.

Three things fall out of the rewrite that are worth naming.

The failure copy was one line, "No local Plex server found on this network.", for
every outcome. That sentence was the policy talking — a server reached over the
internet was a failure by construction, so the message named the LAN. It is now
three, and none of them sends the user to the wrong place.

A profile switch re-keys the WHOLE roster from the /resources response it already
fetches, because accessToken is per (user, server): a share left on the previous
profile's token answers 401 to everything. It is computed before the switch is
known to have worked and applied only on success — persisting a roster re-keyed
for a profile we did not switch to would delete the user's shares from disk.

And `choose_local_connection`'s IPv6 guard is now structural rather than a filter
that can be forgotten. Nothing but a dialable candidate — plain HTTP to four
decimal octets, which is all `stream.rs` can build a sockaddr from — is ever
dialled, and only a candidate that ANSWERED becomes a stored source. An address
can therefore only be persisted after it has been connected to, which is the
property the v6 fix was protecting: `includeIPv6=1` made plex.tv offer v6
connections, and writing one to disk broke every later boot, not just that one.

`probe.rs` gains the fourth ranking axis that makes the same point about names: a
numeric address outranks a HOSTNAME inside its tier. The transport has no resolver
at all, and this account's share lists an internal name that does not resolve
ahead of the public address that answers in 115 ms. Ranked, not dropped — a name
is the only thing TLS can ever validate.

The session file's structs are hardened while they are open: every one of them
takes `#[serde(default)]` on the container, and the three list fields decode
element by element. `#[serde(default)]` covers a field that is ABSENT, not one
that is present and the wrong shape, and for this file the cost of the difference
is not an empty roster — it is a Session that will not parse, which is a silent
sign-out and a QR code to scan on every boot.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…ing from 1 is the normal case

A Plex ratingKey — and a librarySectionID, a personId, a Part.key, a Stream.id — is a
server-local integer dense from 1. With one server that is a distinction without a
difference, and the app has always leaned on it: five places identify an item by a bare
rk. With a share registered it is not a distinction the app can skip, and it is not an
edge case either. It is the measured default: docs/shared-servers.md §2 records the
friend's server answering with section key 1, exactly like our own Movies, its
ratingKeys starting at 1 alongside ours.

So a key alone now names an item on neither machine, and each of the five sites turns
into a confident answer about the wrong one:

  * `pms::index_of_rk` scanned `m.rk == rk` over one flat catalog and returned whichever
    row came first. Its callers are the item menu's Play from Start — long-press a
    friend's episode on a merged Continue Watching shelf and OUR film with that number
    plays, with the friend's title still in the HUD — and `detail::mount_rk`, which
    mounts the wrong backdrop, blur envelope and selection.
  * `metadata::cached_playing` is the worst of them, because it is silent and it feeds
    playback. It is the fast path that SKIPS the PMS fetch, so a false hit substitutes
    the loaded page's whole `PlayingItem`: its audio and subtitle `Stream.id`s (which are
    then PUT to the other server), its frame size (so the direct-play gate reasons about
    the wrong resolution), its fps, its chapters, its markers.
  * `metadata::pump_season`'s `d.rk != r.rk` ownership test. Hop from A's show page to
    B's with the same rk while a `/children` is in flight and A's episodes install onto
    B's page. Nothing else can see it — the hop bumps no generation that separates them.
  * `plex::queue_index_of`'s rating-key FALLBACK. The primary key, `playQueueItemID`, is
    minted by the queue and needs no scoping; the fallback compares a key the caller
    supplied, which can come from anywhere.
  * `trail::Node::Detail{rk}` and `Node::Person{key}`. The trail stores identity
    precisely because indices go stale, and then stored an identity that had gone
    ambiguous: browse the share, open an item, go deeper, press BACK, land on a page the
    user has never seen.

The rule lives in one place, `plex::same_item((sid, key), (sid, key))`, so the five sites
cannot drift and one host test grades the rule itself. UNSET matches only UNSET — that is
the pre-registry state (and every row a host test builds by literal), not a wildcard, so
the single-server app is unchanged and a "server unknown" row never answers for a named
machine. Every miss degrades safely where it lands: a catalog miss opens the page
off-catalog, a playing-item miss costs one round trip, a season miss leaves the page it
found alone.

`PmsMovie`, `Detail`, `PlayingItem`, `QueueRow` and `person::Person` gain the server they
came from, stamped where they are parsed — and the server is PASSED IN, never looked up.
`parse_item` runs on the hub, page and person workers, `fetch_full` on the detail worker,
and the house rule (browse.rs's spawn site states it outright) is that a worker reads no
statics. It is also the only correct answer: the current server can move while a fetch is
in flight, and the rows in hand belong to the machine that was asked. So the fetches now
take a `ServerId` and dial `client_for(sid)` rather than `client()`, which is what makes a
row's stamp provable rather than incidental.

`Node::Person` prefers the plex.tv `tagKey` whenever both sides have one, because that id
is GLOBAL — one guid is one person however each machine numbers them — and falls back to
the server-scoped local pair only when a credit row carried none. Comparing a present guid
against a missing one would make every guid-less row the same person as every other.

`Trail::reset`'s doc calls a truncation the profile-switch guard, and a server switch has
the same shape. It does not get the same remedy: a source change does not revoke access to
what is behind you, and the trail's other rule is that a cycle is a HISTORY. A per-node
sid keeps that history walkable and still lands every pop on the page it names.

Two dropped-write paths in the item menu now say so. `client_for(sid)` can return None
where `client()` used to panic, and the repaint below ran either way — so a scrobble or a
deck removal that never reached a server is a log line rather than the one PMS write with
no trace at all.

Not in this change, deliberately: `route.rs` still resolves the STREAM against the current
server (`ResolveEnv::snapshot`). That is the sibling unit's seam, and its comment says so
rather than implying the play path is finished.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
… its Source chip

Deliverable A of the Shared Sources design. The Library's section table described
one server — a bare `key` with no server on it, a flat `SECTIONS`, and an
`ensure_sections` that fetched from whatever `client()` happened to be. Measured
against the real share on 2026-08-11, both servers have a section `1` and they are
different libraries, so a bare key names two things. The table is now addressed by
(SOURCE, section), and every fetch is issued through `client_for(sid)` CAPTURED AT
THE SPAWN SITE — the rule this file already stated for its page worker and did not
keep.

IT GROWS BY APPEND AND NEVER BY REBUILD, and that is the soundness argument, not a
detail. A page landing is blamed on a section INDEX, so a table that reshuffled
under an in-flight fetch would splice one library's items into another's store.
`ensure_sections`'s early-return was the only thing preventing that; appending
replaces it and holds for every source, not only for the second call. Two
generations now, each with one job: SECTIONS_GEN (shape — moves on an append, what
the label caches key on) and EPOCH (identity — moves on `reset` alone, what
index-blamed landings gate on), because one source's append must not discard
another source's answer.

ONLY THE CURRENT SERVER IS DISCOVERED ON THE MAIN THREAD. `ensure_sections` runs at
boot and on every Library entry, so fanning out there would park the SDL loop for
one connect(2) per unreachable share — seconds of frozen boot because a friend
switched their server off. Every other source is discovered by a worker off `pump`:
sections, then the server's own friendlyName (`GET /`, so a roster that never
reached plex.tv can still head its group with a machine name), then a size=0 count
probe per library. Ten-second per-source backoff. A dead share arrives as
`reachable: false` and costs the main thread nothing.

THE SOURCE CHIP, first in the toolbar: `Library · LDN Films  bamx23 ▾`, the handle a
MICRO run at 62% of the label's own ink and ABSENT ENTIRELY on your own libraries —
absence, not an empty run. With one source the chip is not drawn at all and the list
does not exist. Its panel is 640 wide because the rows are two-line, with two levels
swapped by pills at the panel top: Browse, a picker with one tick and no words, and
On Home, switches whose word is the only mark. The levels never mirror each other's
marks — a mark says where you are, a word says what is set. A server is a group whose
header is the MACHINE and whose accessory is the PERSON; the last pinned library dims
its VALUE and states the rule on its sub-line while its label keeps live ink; an
unreachable server's group dims whole at one alpha and still reads On, because
nothing was unpinned.

The toolbar is a TYPED chip list now, and that is a fix rather than a tidy-up: `on_ok`
matched on the chip's INDEX with a `_` catch-all, so inserting Source at 0 would have
made it open the Sort menu while Sort and Filter both opened Filter — silently, since
every index still resolved to something. `open_chip_menu` is the one chip → action
map, exhaustive so a new chip is a compile error, and the pointer path calls it
directly instead of deferring to `on_ok` (which reads the FOCUSED chip, so the two
agreed by side effect rather than by construction). The test asserts chip → menu by
IDENTITY and the row's contents by order, and pins position nowhere.

THE TAB STRIP DELIBERATELY DOES NOT CHANGE (deliverable B, "answered by subtraction").
`browse::tab_*` projects the table to one pill per TYPE — your own sections, plus any
type only a friend has — so the strip is the same width at one friend or at ten, and
a borrowed library's selection capsule rests on its type's pill. With one source it is
the identity map, so a single-server install draws exactly the strip it always did.
`/tmp/plxnative-library=N` therefore names a PILL now; the comment says so.

PICKING A LIBRARY ON ANOTHER SERVER MOVES THE APP'S CURRENT SERVER, which is
`docs/shared-servers.md` §5's named cheap variant and is here because without it this
panel is a trap. `PmsMovie` carries no ServerId, so a borrowed card's poster is
fetched from `client()` and its ratingKey resolved through `client()` — and ratingKeys
are server-local, so OK on a friend's card would quietly open, and play, a different
title of yours with the same number. Moving `current` makes them agree. The cost is
stated rather than hidden: Home's catalog belongs to the server it came from, so it is
dropped and re-armed asynchronously, and `route`'s cached machineIdentifier is
forgotten so the next PlayQueue names the right machine. Threading ServerId through
the stored structs retires the seam.

Two things `TableView` was missing for the panel, both now in the shared component
rather than drawn in the screen: `Section::accessory` was declared and NEVER PAINTED,
and `Section::dim` is one alpha over header, accessory, rows and the selection pill —
not `Row::dim` per row, because the state is a fact about the GROUP and a dimmed row's
own "On" must stay legible as itself.

Four latching bugs the review caught, all the same shape as the single-flight one this
module already had: an empty count landing no longer latches the probe off; `reachable`
is now written by every page fetch, in both directions, so a server that goes offline
after discovery can still dim; "Check for new shares" re-asks EVERY source rather than
only the ones already known to be down, and a library created since is appended; and
the Source chip reads the QUEUED section's owner, so the handle does not pop in 70 ms
after the name it belongs to.

Host 419 -> 431 (`make check` green three times), `make` and `make RELEASE=1` both
link. NOT VERIFIED ON DEVICE — the television was unavailable for the whole of this
work; the PR carries the recipe.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…it down

Home was one `?` chain over one server: `home_hubs()?` then `continue_watching()?`,
and a single failure anywhere in it committed nothing at all. That is defensible with
one server — there is nothing else to show — and it becomes a lie with two. Extended
naively over N sources, a friend's machine being asleep aborted the whole build, so on
a cold boot the user got the whole-screen "Can't reach your Plex server" read-out about
their own library, which was answering perfectly well the entire time.

So a verdict now belongs to a SOURCE, not to Home. Each one has its own single-flight
latch, its own place on the retry ladder, and its own last good projection; the merge
runs over whatever has answered so far. Every piece of that used to be process-global,
and each of the three was its own failure with a second server: one latch meant a share
that takes eight seconds to time out held the owned server's retry behind it; one
backoff meant the 30 s rung a dead share had climbed to was the rung everybody then
waited on; one `?` chain meant it blanked their shelves as well. `hub_state` folds the
per-source verdicts for the read-out, and the fold reserves the total-failure caption
for a total failure — any source answering makes Home answered.

What the merge draws, per the design canvas (deliverable C):

  * Continue Watching is ONE shelf across every source, ordered by `lastViewedAt`, so a
    borrowed item legitimately holds first position. It therefore carries no annotation
    at all — a shelf drawn from three servers cannot be named by one of them.
  * Every other shelf keeps its source: the owner's handle for a borrowed server, empty
    for our own. Ours come first, then each share whole, because adjacency is the
    grouping device and interleaving would destroy it.
  * A source that has never answered contributes NOTHING — no heading, no empty shelf,
    no spinner row. A spinner would also hold the panel presenting for something that
    is not coming, which is the 39.6% → 1.67% idle saving spent on an apology. One that
    HAS answered and has since failed keeps what it last had: a transient failure must
    not reflow the shelves under the focus ring, and what removes a source for good is
    it leaving the ROSTER, which is a fact about the grant rather than about one fetch.

Two caps had to move here from `ui::home`, because a cap the data layer has never heard
of is a cap that truncates a whole source away. Shelves and rows are now divided by
water-filling (`allot`): the smallest demand is served first and what it does not use
is re-divided, so a modest source costs nobody anything and two greedy ones split the
rest evenly. Handing the budget out first-come — which is what a single running total
does, and what this module did while there was only ever one server — means the first
source spends it: `/hubs` promotes several rows per library, so one four-library server
already overruns the sixteen shelves the grid can address. The per-shelf cap is the
other half: three sources' decks merge to 36 cards, and past 24 the focus ring and the
OK dispatch clamp differently, so the ring sits on one card while the press opens
another.

Boot stays synchronous for the owned server alone. A share that has gone away costs a
full connect timeout, and serialising those on the SDL thread would freeze the app for
as long as the friend's router stays quiet.

The open seam is named at the line that will close it: `PmsMovie` still carries no
`ServerId`, so a merged row's server is forgotten the moment it leaves `merge`, and
posters, the detail page and the scrobble paths all resolve a server-local ratingKey
against whichever server is current. That is steps 2 and 3 of `docs/shared-servers.md`,
and until they land a second source can only ever arrive through `/tmp/plxnative-servers`
— dev-only, and compiled out of a release build.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
`candidates()` sorted on (location, scheme, ipv6) and stopped. Two candidates
tying on those three fell through to plex.tv's listing order — so whether the
app reached a server depended on the order a remote service happened to return
its connections in, which is reproducible for one account and not another.

`stream.rs` takes a numeric address and speaks cleartext: it has no resolver at
all. A hostname is therefore not merely slower here, it is undialable, exactly
as an https origin is — and the existing `shared_server()` fixture already
carried the bug. Its custom hostname is listed BEFORE the public IPv4, so the
top-ranked candidate was an address the media transport cannot open, while the
one connection measured as reachable from the TV sat second. The old test
asserted that address was *present*, which it was.

Ranked, not filtered: the curl control plane does resolve names, so a
hostname-only server stays reachable once TLS lands — it just must never
outrank an address the byte path can open.

Found by unit 12's code review, in code from the shared-servers foundation.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…' into shared-servers-integration

# Conflicts:
#	rust-modules/src/auth.rs
#	rust-modules/src/plex/probe.rs
…' into shared-servers-integration

# Conflicts:
#	rust-modules/src/route.rs
Deliverable D of the Shared Sources design. The base branch stopped the grid
spinning on a failed page; what it left was the read-out itself, and the layer
above it.

THE COMPONENT. `StatusOverlay` grows a reason line and an action, so it can say
three things instead of one: the verdict (what happened), the reason (why, and
what is NOT broken), the action (the one thing to press). Its caption is a
borrowed `&CStr` rather than a `&'static` one, because a section read-out
interpolates a machine name and no `c"…"` literal can carry that; every existing
caller passes a `&'static` and is unchanged.

The action pill is the COMPONENT's now. Home hand-built its Retry — a
`Button::pill_w` and a y measured off the panel centre — under a caption that
came from the shared read-out, so one block was laid out by two pieces of code
and agreed only by inspection. The Library's read-out would have been a third
copy. `action_frame` is the one geometry the draw and the screen's hit test both
read, and Home's pill moves 7px up onto the shared `space::LG` rung as a result.
Everything hangs off ONE anchor — the caption band, exactly where it was — so a
read-out carrying neither optional block is laid out as before.

THE READ-OUT. The verdict names the MACHINE, the reason names the PERSON and
rules out the worry that everything is down, and there is one action. Focus
starts on it, because a server that did not answer often answers a second later.
It is anchored in the CONTENT REGION rather than at the read-out's canonical
full-screen position: the chrome above it is still live, and that is the whole
difference between a section failing and the app failing. Nothing else is drawn
beside it — no Sort, no Filter, no count, no A–Z rail (all four act on a grid
with no items), no alert glyph (that mark is the player's) and no BACK hint
(BACK is universal, and the chip and tabs above are the visible way out).
`toolbar_n` and `rail_drawn` are the ONE predicate each behind a control's draw,
its pointer hit test and the focus walk, so neither can be invisible-and-clickable
nor drawn-and-unreachable — and when the Source chip lands, UP from the read-out
reaches it with no change here.

Two identifying strings, and the list is CLOSED: the machine's own name and the
owner's handle. No address, no path, no URL, no machineIdentifier. That is
`ui::stats`' redaction rule and it applies for its reason — a read-out is what a
user PHOTOGRAPHS for a bug report, and on a borrowed source the machine is not
even theirs to publish. The session name is the only source for it; the address
that sits right there in the client is deliberately NOT a fallback, and "this
server" is the answer when there is no name.

The owner is `None` at its one seam today and the reason line is therefore
ABSENT, not empty — the same shape `HubRow::source` took for the shelf heading.
Nothing maps a section to the source it came from yet; when that lands, one line
of `dead_strs` learns about it.

AND THE LAYER ABOVE. `ensure_sections` swallowed every failure into
`unwrap_or_default`, so a server that could not be reached at all was
indistinguishable from a table nobody had asked for yet: no section, no state,
`fetch_state()` answering `Loading` out of its `unwrap_or`, and the grid spinning
for the rest of the session — the same bug the base branch fixed one layer down.
`SECTIONS_FETCH` is that state and `fetch_table` is the one place "the server
answered" and "the request failed" are told apart.

`readout_of` is where the whole decision lives now, as one pure function over
both fetch states and the store — four answers that were four `else if`s in the
middle of `draw`, none of which a host could reach. Catching only the FAILED
table was not enough: a server that answers with nothing we browse (a music-only
account) is Ready with no sections and falls into the same two `unwrap_or`
defaults, which is the eternal spinner one case over. That one is Empty, because
it answered. Its read-out was then drawn at alpha 0 — the grid's `Xfade` asks
"did a section answer" to decide it has content, and with no section that is
false forever — so `ready` now asks `readout()`, which is the question with the
right shape.

`browse::failed_initial` is gone: it was exactly one arm of `readout_of`, and one
rule in two places is what this file keeps being wrong about.

`/tmp/plxnative-libfail` forces one read-out state (`dead` / `own` / `table` /
`empty`). This screen's failure is the one state in the app that cannot be
reached on purpose — it needs a server that refuses — and the honest way there is
three moving parts, each of which fails looking exactly like "the app is fine".
It forces the PROJECTION only; `browse` keeps whatever state it really has, and
it is compiled out of a `RELEASE=1` build with every other trigger (verified: the
string is absent from the release binary). Deliberately not the player's
`failtest`, which already owns that name and a different vocabulary.

Host 418 -> 430, `make check` green three times; `make` and `make RELEASE=1` both
link. NOT VERIFIED ON DEVICE — the television was held for the whole of this work
and the coordinator has taken the fleet's device pass; the PR body carries the
recipe.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…' into shared-servers-integration

# Conflicts:
#	rust-modules/src/metadata.rs
#	rust-modules/src/plex/mod.rs
#	rust-modules/src/pms.rs
#	rust-modules/src/route.rs
…is public

139 sites across 12 files carried a real third party's plex.tv handle, machine
name, library name, port and LAN address: test fixtures, doc comments, the
shared-servers note, and the harness README. They came in through the
foundation commits and then spread, because each unit copied the shape of the
fixture next to it.

None of it is ours to publish. github.com/GLinnik21/plx-native is PUBLIC — a
fact this codebase had recorded as "private" for about a month — and the person
who shared their server is not a party to this project.

Replaced throughout with stand-ins, several chosen at the SAME character length
because ui/home.rs asserts text widths against them:

  handle       bamx23     -> friend
  machine      bx23-ldn   -> nas-home
  library      LDN Films  -> Film Club
  port         (real)     -> 31234
  LAN address  172.20.x   -> 10.9.9.x   (still RFC1918, as the real one is)
  machine id   (real 40h) -> aaaabbbb... run

docs/shared-servers.md already carried a paragraph promising exactly this
redaction while violating it, so that paragraph now states the convention as a
table, and says plainly that it was not followed. Stating a rule is not
applying it.

479 tests green; the length-matched stand-ins keep every width assertion.

Not fixed here, and both need a decision rather than an edit: the same values
are in the history of origin/shared-servers-base (commits 4b8a103, 9c7d676),
and one orphaned pre-force-push commit remains reachable by SHA on GitHub.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
…no pill

Builds on #31's projection rather than replacing it: the strip stays "your own
libraries, plus a type only a friend has", and this makes that second half work.

`is_show: bool` has two values, so "does an owned library have this KIND" — the
test that decides whether a borrowed library gets its own pill — answers YES for
a friend's MUSIC library on the strength of your films. It would fold onto your
Movies pill, and everything in it would be unreachable from the strip. The other
half of the same gap was one layer up: `project_sections` dropped `artist` and
`photo` at discovery, so those types could never reach the projection to be
missing from it. A type dropped at the door cannot be the growth case.

So `SecKind` (Movie/Show/Music/Photo) replaces the boolean, discovery keeps every
type this product has a level for, and the projection compares by type. A music
library browses like any other section — the listing, its server-driven sorts and
the A-Z rail are all type-agnostic, and this account's own /hubs already put a
Recently Added Music shelf on Home, so the content was at the top level before it
had a tab. What is still missing is the level BELOW the grid: an artist opens the
movie detail page, which has nothing to play. That belongs to whoever builds the
music level; the strip's job is to say the type exists.

Two more things the multi-source table made true and one bug of my own:

- The label + width cache moves off the section table's generation onto the
  STRIP's (`browse::tabs_gen`), bumped only when the projected pill list actually
  changes. The table's generation now moves once per source as libraries land,
  and most of those fold onto pills already drawn — so the row was re-measuring
  every pill, several times a boot, on Home's hot path, for a strip that had not
  moved.
- `Nav::Library` carries a TAB and `pill = section + 1` is not true any more.
  Three comments still said "the first section" where they meant "the first tab"
  (the navosc scene, `select_pill`, the FPS manifest) and `nav.rs`'s TAB doc said
  the pill was a section index plus one. Wording only — #31 wired the arithmetic
  correctly; a doc that lies about an index space is how the next edit gets it
  wrong.
- `tabs()` compared the old and new projection with `addr_of!(TABS).read()`,
  which copies the Vec BITWISE and then drops the copy — freeing the buffer the
  static still points at. A double free that aborts the process, found by the new
  invariance test rather than by review. It borrows now.

The deliverable is host-provable, which matters because there is no host runtime:
`the_strip_is_the_same_row_at_one_friend_and_at_three` grows the roster to eleven
libraries across four sources and asserts the pill list never moves — the width
follows, since every pill's width is a pure function of its label.

Fixture names use the canonical stand-ins (`friend`, `nas-home`, `Film Club`),
which are also character-length-preserving for the width assertions in home.rs.
…sure

Two bugs of mine, both found by review with probe tests rather than by reading.

**A profile switch kept the previous account's pills.** Moving the label/width
cache onto the strip's own generation made `reset()` stop invalidating it:
`reset` CLEARED the projection's memo, so the next derivation compared `[]`
against `[]`, saw no change, and never bumped. `draw_tab_row` iterates the cache
rather than the live table, so after a re-login the strip went on drawing — and
hit-testing — libraries the new user cannot open, until some later landing
happened to change the row. The memo is now invalidated rather than emptied, so
the comparison that decides everything is made against what was actually on
screen. That is also the shape of the rule: a memo nobody clears early cannot
lie about what changed.

**The row grew by PEOPLE for an un-owned type.** `owned || !owned_kinds.contains`
admits one pill per borrowed LIBRARY of a missing type, so two friends who both
share Music are two identically-titled Music pills with nothing to tell them
apart — the exact property the projection exists to prevent, and the one the
invariance test claimed to hold, which it could not see because its fixtures were
all types we own. A missing type earns one pill now; the rest of that type are
reachable through the toolbar's Source chip, exactly as a borrowed library of a
type you DO own already is. Newly reachable because this branch admits
`artist`/`photo` at all.

Both are now regression tests, and the invariance test grew the half that would
have caught the second: three friends sharing music are one Music pill.

Also from the same review, smaller:

- The unwatched filter is a movie/show question and only those two types answer
  it, so the query no longer sends `unwatched=1` to a music or photo listing —
  and the Filter menu no longer offers the switch there, because a control that
  visibly changes nothing is a worse answer than one that is not offered. The
  menu's row indices go through `filter_rows` rather than literals, since the
  switch's absence shifts Genre up.
- `Nav::Library`'s own doc still said "section" where the arithmetic already
  meant "tab", and `docs/pms-api.md` still told the next reader to filter
  sections down to movie/show — the filter this branch removed on purpose.
…' into shared-servers-integration

# Conflicts:
#	docs/shared-servers.md
#	rust-modules/src/app.rs
#	rust-modules/src/browse.rs
#	rust-modules/src/plex/mod.rs
#	rust-modules/src/plex/servers.rs
Units 7 and 8 branched before the scrub landed, so merging them reintroduced
the handle, machine name and library name into dev.rs (the DevServer.handle
doc), plex/models.rs and ui/library.rs's Source-panel fixtures.

This is the shape to expect for every remaining merge: a scrub is a property of
a TREE, and any branch cut before it carries the old values forward. Re-scan
after each one — `grep -rlE` over rust-modules/src, docs and tests with the six
values, which is what caught these.

Stand-ins per the table at the top of docs/shared-servers.md. 497 tests green.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01TxZ585ehWMnuScciTQ9WgV
@GLinnik21 GLinnik21 closed this Aug 15, 2026
GLinnik21 added a commit that referenced this pull request Aug 22, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble
is the reason this file exists: every item must be Pass or N/A, and marking one
Pass when it should be N/A — or vice versa — is a stated rejection ground. So
"we never tested it" is not a markable state, which makes the UNTESTED column
matter as much as the failing one. Eleven items sit there today.

Four fail outright, and three of those are one root cause: `stream.rs::http_open`
builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only —
which takes out #20, #43 and #47 together the moment a QA bench is not on the same
LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is
undefined for a sideloaded app.

§4 records the four items that moved on 2026-08-22 and why they are worth reading
together: every one was found by LOOKING AT THE PANEL, and not one was visible in
a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the
television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes
instead of the native scancodes the app actually receives; a splash 63% black
against LG's "should not be black"; and `requiredMemory` asking for less headroom
than declaring nothing would have.

§5 records the two items that are DECISIONS rather than defects — no on-screen
transport button row, and English-only — because a future reader of the checklist
will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX
scenario for movement details") is what makes the UX scenario document, not code,
the place that answer belongs.

§7 names the defect class rather than the bug: the music note was the visible tip
of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai
titles and subtitles, hits the same two items, and nothing in the host suite can
see.

Co-Authored-By: Claude Opus 5 <[email protected]>
@GLinnik21
GLinnik21 deleted the search-field-capsule branch August 22, 2026 23:25
GLinnik21 added a commit that referenced this pull request Aug 23, 2026
…ntradicted

Ran `doc-claim-auditor` over the diff. Eight contradictions across 71 tracked
markdown files and 110 Rust files; three I had already fixed while it ran. The
five that were left, plus its one nit:

**Two were MY OWN prose, wrong about my own code.**
  - `plex/CLAUDE.md` said a `Ceiling` reaches `transcode_query` only once both
    fast flavours are denied. It reaches it on EVERY spec, remux included —
    what reaches the WIRE only after a refusal is a rate. `params.rs` says the
    opposite two files away, and `transcoder`'s test builds exactly the spec
    the sentence claimed cannot exist. Corrected, and the remux branch's
    silence is now named as an invariant a test pins rather than a `None`
    anyone may rely on.
  - `app.rs`'s new call-site comment still said a rung "lands on the next
    resolve", which the second commit inverted. It was the only line left
    saying so, and it sat at the call site.

**Two were prose the change falsified elsewhere.**
  - `route::Preview`'s doc enumerates the gates `build_stream` applies and said
    THREE. There are four; the ceiling is the one a reader debugging "why does
    this ordinary h264/AC-3 MKV say Converts" would never think of.
  - `metadata.rs`'s technical-record block said it was "read by nothing else"
    than `ui::tracks_panel`. `route::source_kbps` reads `video.bitrate` from it
    now, so dropping the backfill would move every rung's threshold with a
    green suite.

**And two status records that decide what someone does next.**
  - `ui/CLAUDE.md`'s module table: "a menu with one row", and it named
    `Row::checked` for the row that draws `Row::toggle` — already inverted
    before this change, and now actively misleading, because `Row::checked` is
    what the Quality rungs in that same menu use. The table now carries the
    rule instead of one side of it.
  - `docs/lg-self-checklist.md` #43 CASE1: "one direct-play-vs-transcode
    decision at start, held for the session". A user can change it mid-film
    now; a measurement still cannot, which is why the item still FAILS — the
    verdict is unchanged and the reason is narrower.

Plus the six remaining `parity-gaps.md` quality rows the earlier pass missed
(the file repeats this gap once per reference-client audit), each struck to
"the gap it WAS" with the half that is still open kept: no badge, no PERSISTED
preference store, no force-direct-play, no disable-remux.

`params.rs`'s "asserted in `transcoder`'s tests" was half right — that suite
pins the ceiling is inert on a remux; `route`'s gates 2 and 4 pin the other
half. Both are named now.

Prose only; 984 tests unchanged.

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
…ther family (#51)

`http_open` built a `sockaddr_in` by hand from four decimal octets. That is not a
degraded transport for a hostname or an IPv6 server — it is no transport at all, which
is why `plex::probe` ranks a `plex.direct` name BELOW the dotted quad behind it and why
`auth::dial_target` refuses every candidate that is not an IPv4 literal. LG App Self
Checklist #43 CASE2 (IPv6) fails on this line.

`resolve()` now calls `getaddrinfo` with AF_UNSPEC + SOCK_STREAM, so the family and the
ORDER are the system's own destination-address policy (RFC 6724) rather than something
this file picks. The flag split is a correctness fix, not an optimisation: a LITERAL
takes AI_NUMERICHOST, because AI_ADDRCONFIG suppresses AF_INET6 results on a host whose
only IPv6 address is loopback — so `getaddrinfo("::1", …, AI_ADDRCONFIG)` legitimately
resolves to NOTHING on a healthy machine. It also keeps the existing dotted-quad path
free: no NSS module loaded, no packet sent, so the per-seek AVIO reopen costs what the
hand parse did. A NAME takes AI_ADDRCONFIG, which is what that flag is for.

The node handed to the resolver is UNBRACKETED and the `Host:` header is BRACKETED —
`getaddrinfo("[::1]", …)` is EAI_NONAME, while brackets are URI-authority grammar
(RFC 3986 §3.2.2 → RFC 9110 §7.2). `resolver_node` strips and `host_header` re-adds, one
function apart so the asymmetry is visible rather than remembered.

`Host:` is built from the ORIGIN, never the address dialled. That was correct only while
the input WAS an address; sending the numeric one now would break name-based virtual
hosting, invisibly, since the TCP session is identical either way.

`connect_any` walks the WHOLE chain. Trying only the first address is the old
single-address limit wearing a resolver. Both of this file's invariants are
re-established per attempt, not just the first: the fd is published into its atomic
BEFORE connect, and every failed attempt is retired through `close_owned`, never a bare
close.

CONNECT_TIMEOUT_MS 2000 → 8000, as the budget for the whole chain rather than per
address, so the worst-case main-loop block is one number however many addresses came
back. Deliberately NOT derived from the address: RFC1918 is not "local" in Plex's sense,
and probe order is `plex::probe`'s policy. The constant's doc says plainly who pays for
the raise today — no caller hands this module a name yet — so the trade-off is on the
record rather than aspirational.

`HttpStream` gains an `interrupted` latch. Resolving gave the open something it never
had: a NEXT thing to try after a failed connect. A handshake aborted by `shutdown(2)`
and an address that is simply dead are the same value at connect's return, so without
the latch a teardown fired during attempt 1 of 2 is answered by OPENING attempt 2 — the
interrupt consumed, a fresh connection handed to a caller being torn down. Set by
`http_shutdown` unconditionally (including with the fd already -1, which is the
between-attempts window), cleared by `reset_fields`, read on both sides of the walk.

Chunked detection was `find_ci(hdr, b"\r\ntransfer-encoding: chunked")` — one exact
spelling. `Transfer-Encoding:chunked` (OWS after the colon is optional), `Chunked`,
`gzip, chunked` and a list split across two lines all missed, and a miss is not a
failure: the body is then read as close-delimited with the chunk-size lines left INLINE
in it. Now a real list parse.

Two bugs review caught that the host suite could not, both green on Darwin first:

  - The port range check was left to AI_NUMERICSERV, and glibc does not do one — it
    parses with strtoul, checks nothing, and returns htons(70000) = port 4464. The
    assertion passed here and would have gone RED on CI's ubuntu-latest, with the
    truncation still live on the television. Now range-checked in `resolve` itself, in
    Rust, which is the only version true on both platforms.
  - The fd-leak test was sending `999.1.2.3` to the real resolver as a NAME. On a network
    with NXDOMAIN hijacking that resolves to a real web server and the open SUCCEEDS; on
    one with a dead resolver it burns glibc's whole timeout budget inside a suite
    documented as offline and ~0.3 s. Replaced with an out-of-range port — the same early
    exit, and it cannot leave the machine.

989 host tests (976 before), clippy gate clean, `--no-default-features` clean, and the
simulator still reaches Home against a real PMS over plain IPv4.

Host-proven; what still needs a television — chiefly whether glibc's NSS machinery works
inside the app's jail, which LG's c-ares-linked libcurl is NOT evidence for — is in the
PR body.


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 23, 2026
…second (#43 CASE1, partial) (#57)

* quality: a ceiling is a ROUTING policy first, a transcoder parameter second

LG App Self Checklist #43 CASE1 asks that the picture follow the link. The
obvious implementation — a bitrate field on `TranscodeSpec` — does nothing for
exactly the file it exists for, and this deliberately is not that.

`build_stream` picks direct play → remux → re-encode BEFORE a spec exists, and
only the re-encode branch's query has ever carried `maxVideoBitrate`. Direct
play streams the file's own bytes with no encoder anywhere to read a cap; a
remux copies the codecs and sends no cap by design, because a cap is what would
force the re-encode it exists to avoid. So a 30 Mbit/s source on a 4 Mbit/s
link direct-plays straight past any number on the spec.

So a rung is spent the way `link_policy` spends the relay tier: deny the two
flavors that ship the file at its own rate, leaving the one whose whole point is
that the server picks the rate. Only then does the number reach the wire.

  route::Quality        Auto + 5 rungs, each pairing a rate with the frame it
                        makes sense at; each sits under one of the checklist's
                        own legs (512 Kbps / 1 Mbps / 7 Mbps / 17.5 Mbps).
  route::quality_policy returns the same two flags `link_policy` does.
  route::flavors_allowed composes the two — the stricter always wins, per
                        flavor. A relay cannot be loosened by a high rung.
  plex::Ceiling         the parameter half; `None` (Auto) resolves to the
                        native-4K literals this query has always sent.

An unmeasured source fails CLOSED, which is the opposite of
`video_direct_plays`'s unknown-passes rule and deliberately so: a device bound
is a capability, a user ceiling is an instruction. The ceiling is captured per
PLAYBACK (`Session::cur_ceiling`), like `cur_remux` beside it, so a seek or a
track switch rebuilds the identical query rather than reshaping the encode
mid-film.

The picker is a second section of the player's existing `…` popover — leading
checkmarks for the ladder, the trailing On/Off word for the switch above it, no
full-screen sheet (docs/parity-gaps.md's standing decision). Its panel could
hold 320px while this menu had one row; the ladder needs the room that is
actually there.

Six host tests are the gate, and they grade the expression `build_stream`
evaluates rather than a re-derivation of it: Auto changes nothing on any source
or link; under-ceiling content stays direct-play eligible; over-ceiling loses
direct play; over-ceiling loses the remux too; the re-encode query carries the
cap (and Auto's stays byte-identical); relay and rung compose to the stricter.

`plex/CLAUDE.md` said `TranscodeSpec` "must not grow" a bitrate field, which
was right about a LINK ceiling and wrong as a general rule — corrected there,
with the ORDER (flavour first, number second) kept as the rule that survives.

Mid-session adaptive switching is NOT here and #43 CASE1 is NOT closed by this.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: the review's two routing holes, and a picker that did nothing where it lives

`/code-review` found eight, and the two that mattered were both about the
ceiling being remembered in the wrong places.

**A direct play forgot the rung.** `plan.ceiling` was set only on the transcode
branch, after the direct-play `return`, so `cur_ceiling` stayed `None` for every
direct play — and `retranscode` reaches a direct-play session (an audio-track
switch, a subtitle burn; `player/pump.rs` says so in as many words) and spends
`cur_ceiling` on the encode it then starts. Picking "480p · 720 kbps", playing a
small file that direct-plays, then switching audio re-encoded at 4K/60 Mbps: the
rung silently discarded on the one path where an encoder was actually running.
It is now set on every plan, inert where it means nothing.

**Every TV episode measured as unmeasured.** `src_kbps` matched
`metadata::current()` on ratingKey alone, but pressing Play on a show page
resolves the EPISODE's rk against a Detail holding the SHOW's — so the match
never landed, `Ceiling::admits` failed closed, and with any rung selected every
episode in the library lost direct play while `playback_preview`, reading that
same Detail's numbers directly, still promised Direct Play for it. Two answers
to one question, which is the mismatch that preview exists to prevent.
`detail_describes` now accepts the on-deck episode's key too — the leaf whose
technicals `fetch_item_streams` backfilled into the show, and the leaf
`playback_preview` already answers for.

**And the picker did nothing in the only place it can be reached.** The ladder
lives in the player's `…` menu; a rung that bound only future plays meant
pressing BACK and replaying to see any effect, with nothing on screen saying so.
`set_quality` now re-asks the routing question for the item on screen, against
the numbers that resolve measured (`Session::cur_src`), and reloads only when
the answer changed — a higher rung than the picture already satisfies does
nothing. It goes through `request_transcode_refresh`, the identical path a
subtitle-burn change takes, gated in the pump on a session that is actually
Playing. User-initiated, not adaptive: nothing measures a link.

Five smaller ones, all real:
  - `ptr::write` into the now-owned `static mut ROWS: Vec<Action>` leaked the
    previous row list on every `…` press. It is an assignment now.
  - the new panel-height cap was 4px UNDER the content — derived from 560 of
    content, forgetting 40 of padding — so the last rung was clipped until you
    scrolled. Same symptom as the 320 it replaced, one row deep instead of five.
  - every rung's comment claimed to sit "under" a checklist leg it is
    numerically ABOVE. A rung is a CONTENT rate and a leg is a LINK rate; there
    is a table now, and it says out loud that the 512 Kbit/s leg is below this
    ladder's floor.
  - `admits` judged a whole-file bitrate against a cap that ships as
    `maxVideoBitrate`, so each rung bit one AC-3 track early. It reads the video
    stream's own rate where PMS gave one, whole-file as the fallback.
  - `link_policy`'s doc still asserted the rule this work repealed — the third
    copy of that claim, and the one the first commit missed.

Two new host tests pin the two MEDIUM findings; the six routing gates are
unchanged. 984 pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: one assignment of plan.ceiling, not two

The review fix set it for every flavour at the decision site, which left the
transcode branch's original assignment as a duplicate of a value that could not
have changed between the two lines. The comment stays, pointed at where the
assignment actually is.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the three parity-gaps rows this quality work made false

`docs/parity-gaps.md` is a gap CATALOG, so a landed gap left standing reads as
work still to do — and two of these three rows describe exactly what PR #57
built, which is the sort of claim that stays false for months here (the `ar`
claim and the `stream.rs` chunked claim both did).

  - "There is no Quality picker anywhere in the app" — there is. Annotated with
    what landed DIFFERENTLY from the row's own prescription (a section of the
    existing `…` popover, not a new `ui/quality_menu.rs` + a fifth
    `Overlay::Quality`) and with the half it did not anticipate at all: a rung
    is a ROUTING policy before it is a parameter.
  - "TranscodeSpec cannot express any other [target]" — it carries `ceiling`,
    and Auto resolves to those two literals byte for byte. Its *Where* said the
    remux branch should be "only taken at Original", which got sharper rather
    than simpler: a remux is refused for a source the rung cannot carry, and a
    small file under a low rung still remuxes.
  - "The source bitrate, width/height and videoResolution are not in the data
    model" — HALF true now. `Detail` has all three; `PlayingItem` has none, and
    that is the live residual, not a cosmetic one: an episode reached from a
    season list or Up Next measures 0 and fails closed.

Each keeps its *Where* and *Device* notes intact — they are still the map for
the half that is open.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the FOUR remaining copies of "TranscodeSpec has no bitrate field"

The first commit corrected three (`plex/CLAUDE.md`, `link_policy`'s doc,
`TranscodeSpec`'s own). A grep for the claim found four more, in three files —
which is the shape this repo keeps losing to: one sentence, copied into every
place that had to reason about it, then falsified in one edit.

  - parity-gaps.md's TOP-LEVEL summary ("G. Quality is one hard-coded rung"),
    which is the copy most likely to be read. It now also says out loud that
    every duplicate of the row further down the file is historical, so the four
    per-client audit sections do not each need their own annotation.
  - shared-servers.md's step-9 row and its relay-policy bullet. Both are ABOUT
    the relay, where nothing changed — the relay still names no rate — so they
    are corrected in place rather than rewritten: the branch-not-a-parameter
    argument survives, minus the premise that has stopped being true.
  - pms-api.md's Dolby Vision measurement, which quotes the re-encode query
    verbatim. Those two values are still exactly what Auto sends, so the
    measurement stands; the clause now says which configuration produced it.

Prose only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the doc-claim-auditor's eight, including two the code itself contradicted

Ran `doc-claim-auditor` over the diff. Eight contradictions across 71 tracked
markdown files and 110 Rust files; three I had already fixed while it ran. The
five that were left, plus its one nit:

**Two were MY OWN prose, wrong about my own code.**
  - `plex/CLAUDE.md` said a `Ceiling` reaches `transcode_query` only once both
    fast flavours are denied. It reaches it on EVERY spec, remux included —
    what reaches the WIRE only after a refusal is a rate. `params.rs` says the
    opposite two files away, and `transcoder`'s test builds exactly the spec
    the sentence claimed cannot exist. Corrected, and the remux branch's
    silence is now named as an invariant a test pins rather than a `None`
    anyone may rely on.
  - `app.rs`'s new call-site comment still said a rung "lands on the next
    resolve", which the second commit inverted. It was the only line left
    saying so, and it sat at the call site.

**Two were prose the change falsified elsewhere.**
  - `route::Preview`'s doc enumerates the gates `build_stream` applies and said
    THREE. There are four; the ceiling is the one a reader debugging "why does
    this ordinary h264/AC-3 MKV say Converts" would never think of.
  - `metadata.rs`'s technical-record block said it was "read by nothing else"
    than `ui::tracks_panel`. `route::source_kbps` reads `video.bitrate` from it
    now, so dropping the backfill would move every rung's threshold with a
    green suite.

**And two status records that decide what someone does next.**
  - `ui/CLAUDE.md`'s module table: "a menu with one row", and it named
    `Row::checked` for the row that draws `Row::toggle` — already inverted
    before this change, and now actively misleading, because `Row::checked` is
    what the Quality rungs in that same menu use. The table now carries the
    rule instead of one side of it.
  - `docs/lg-self-checklist.md` #43 CASE1: "one direct-play-vs-transcode
    decision at start, held for the session". A user can change it mid-film
    now; a measurement still cannot, which is why the item still FAILS — the
    verdict is unchanged and the reason is narrower.

Plus the six remaining `parity-gaps.md` quality rows the earlier pass missed
(the file repeats this gap once per reference-client audit), each struck to
"the gap it WAS" with the half that is still open kept: no badge, no PERSISTED
preference store, no force-direct-play, no disable-remux.

`params.rs`'s "asserted in `transcoder`'s tests" was half right — that suite
pins the ceiling is inert on a remux; `route`'s gates 2 and 4 pin the other
half. Both are named now.

Prose only; 984 tests unchanged.

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 23, 2026
…, and a proxy that can be slow

Three checklist items were unanswerable for three different reasons, and none of
them was a defect in the app.

**#50/#51 — resolution x codec.** The item is graded as a MATRIX and this repo
could only answer it as "pieces are covered": every pipeline fixture was 1080p
except one 4K HEVC, so SD and HD had never been played AT ALL, and 4K H.264
existed in neither pack — which is a fact about the maintainer's library (every
4K item there is HEVC or AV1) rather than about the player. Six new generated
clips complete the grid: SD 720x480 / HD 1280x720 / FHD 1920x1080 / UHD 3840x2160
x {h264, hevc}, with ONE audio codec per column so a row-to-row difference is the
raster and nothing else. Each of the eight cells now grades `expect.video_size`,
an EXACT WxH out of the `ff:` line, because `min_video_width` cannot tell 720x480
from 720x576 and a matrix answered with "at least 1900 wide" is the answer the
item is asking us to stop giving.

Four decisions in the matrix look arbitrary and are argued where they live
(`PIPE_SHAPES`' block comment): square pixels at 720x480 (an anamorphic fixture
would grade PAR handling, an axis with no assertion behind it anywhere here);
CRF held constant is constant QUALITY, not bitrate, so 4K H.264 is crf 26 and not
its 1080p sibling's 20 — the same CRF measures ~30 Mbit/s up there, a
quarter-gigabyte clip in service of no assertion; SDR 8-bit throughout, which
makes the UHD/HEVC cell the odd one out because it is the existing HDR10 fixture,
already device-verified; and E-AC-3 down the HEVC column, which is also the
better false-PASS defence, since `engine`'s `_ =>` arm can only ever produce
"AC3".

**#46 — replay after completion.** Its FIRST half now runs: `pipe_finish_eos`
plays a deliberately short 20 s clip to its end and asserts `EOS reached ...
-> ended` followed by `stop_bufferfeed: torn down`, in that order. Ordered
because every stop tears the engine down — the harness's own close included — and
searched forward from the EOS rather than compared against the first teardown in
the log, because `teardown` writes the same line for a `for_reload` stop, which
would fail the case for its whole cap with the evidence reading "the player froze
on the last frame". This is the only case in either tier that is SUPPOSED to run
out, so it gets its own fixture that nothing else may name (everything else is
sized so it cannot hit EOF mid-window, trap 9's second half), and
`_resolve_fixtures` grew the opposite duration bound: it SKIPS when the clip is
longer than 0.6x the cap, so a `--secs`-regenerated pack skips rather than failing
as a frozen player.

The SECOND half — starting the same content again — is NOT closed, and it is an
app gap rather than a test gap. `plxnative-playurl` is read behind `app.rs`'s
one-shot `auto_tried` latch, so a boot gets exactly one playback; on EOS
`finish_playback` -> `exit_player` leaves the player, and with no Plex session
there is no detail page, no Play control and no key path back in. The manifest
case carries a `_replay_note` naming the small app-side change that would close
it (`engine::start_bufferfeed` already re-reads `dev::playurl()` whenever
`route::url()` is empty), and `docs/lg-self-checklist.md` still marks the replay
half untested.

**#43 CASE1 and #14 — `tools/netcond.py` gains `rate:<kbps>`.** The proxy could
make the server dead in four ways and slow in none, so CASE1's own legs (512 Kbps
-> 1 Mbps -> 7 Mbps -> 17.5 Mbps) could not be PRODUCED and #14's degrading link
was anecdote. One token bucket for the whole proxy, because `rate:` names a link
and a link is shared; decimal kilobits, because that is the unit the item states
its legs in; empty at the start, because a full bucket hands the first
quarter-second a free burst and that is most of a short transfer; live under an
open connection, so one scripted run covers all four legs instead of four
launches. Measured through the real proxy: 512 -> 496 kbps, 2000 -> 2000,
17500 -> 17518.

Two pre-existing bugs surfaced in the code it touches, both fixed:

* **The mode SCOPE was honoured only at accept.** `serve_conn` consulted the
  scope-aware `applies()` and then handed `relay` a bare `Mode.split`, which
  discards it — so `stall@/:/timeline` really froze every open connection
  including the media stream, i.e. the exact opposite of what the scope exists
  for. Both docs claimed the working behaviour. `relay` now takes the
  connection's own first bytes.
* **The read poll's socket timeout was also the other direction's WRITE
  timeout.** Both relay threads share one pair of sockets, so `src.settimeout(0.5)`
  set the timeout on the other thread's `dst`; `sendall` on a timed-out socket
  raises having written an unspecified number of bytes, the `except OSError`
  swallowed it, and the stream truncated silently — reachable in exactly the
  situation the proxy exists to measure. The poll moved to `select` and both
  sockets are put back to blocking before relaying.

`--selftest` proves the shaper against a loopback transfer with no television in
the room, in its own temp control file so it cannot release the mode under a live
experiment.

**What this costs and what it does not prove.** The pipeline pack goes from ~0.4
to ~0.7 GB (the 4K H.264 clip is 93 MB of that) and from 8 clips to 15; resolution
is a property of the media, so a matrix cell cannot be a second case on an
existing file. Everything here is generated, so what none of it reaches is a PMS
DECISION on any of these shapes — `library_gaps` says so per entry. While
correcting those entries: `8-bit-hevc` was ALREADY covered by
`pipe_hevc_aac_mp4` (no `hdr` key, so Main / yuv420p) and the gap list had not
caught up; only `4k-h264` is newly closed.

Host-verified only — this lane has no television. `make check` is green (976 Rust
+ 47 harness tests, the harness suite now including the netcond shaper against
real loopback sockets), every fixture verifies under `make_fixtures.py`'s own
ffprobe checks, and `serve_fixtures.py` answers 206/416 with a byte-exact tail
for each new clip. The device run is the integrator's; the recipe is in the PR.

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 a proxy that can be slow (#59)

* tests: the resolution matrix LG asks for, a clip that is meant to end, and a proxy that can be slow

Three checklist items were unanswerable for three different reasons, and none of
them was a defect in the app.

**#50/#51 — resolution x codec.** The item is graded as a MATRIX and this repo
could only answer it as "pieces are covered": every pipeline fixture was 1080p
except one 4K HEVC, so SD and HD had never been played AT ALL, and 4K H.264
existed in neither pack — which is a fact about the maintainer's library (every
4K item there is HEVC or AV1) rather than about the player. Six new generated
clips complete the grid: SD 720x480 / HD 1280x720 / FHD 1920x1080 / UHD 3840x2160
x {h264, hevc}, with ONE audio codec per column so a row-to-row difference is the
raster and nothing else. Each of the eight cells now grades `expect.video_size`,
an EXACT WxH out of the `ff:` line, because `min_video_width` cannot tell 720x480
from 720x576 and a matrix answered with "at least 1900 wide" is the answer the
item is asking us to stop giving.

Four decisions in the matrix look arbitrary and are argued where they live
(`PIPE_SHAPES`' block comment): square pixels at 720x480 (an anamorphic fixture
would grade PAR handling, an axis with no assertion behind it anywhere here);
CRF held constant is constant QUALITY, not bitrate, so 4K H.264 is crf 26 and not
its 1080p sibling's 20 — the same CRF measures ~30 Mbit/s up there, a
quarter-gigabyte clip in service of no assertion; SDR 8-bit throughout, which
makes the UHD/HEVC cell the odd one out because it is the existing HDR10 fixture,
already device-verified; and E-AC-3 down the HEVC column, which is also the
better false-PASS defence, since `engine`'s `_ =>` arm can only ever produce
"AC3".

**#46 — replay after completion.** Its FIRST half now runs: `pipe_finish_eos`
plays a deliberately short 20 s clip to its end and asserts `EOS reached ...
-> ended` followed by `stop_bufferfeed: torn down`, in that order. Ordered
because every stop tears the engine down — the harness's own close included — and
searched forward from the EOS rather than compared against the first teardown in
the log, because `teardown` writes the same line for a `for_reload` stop, which
would fail the case for its whole cap with the evidence reading "the player froze
on the last frame". This is the only case in either tier that is SUPPOSED to run
out, so it gets its own fixture that nothing else may name (everything else is
sized so it cannot hit EOF mid-window, trap 9's second half), and
`_resolve_fixtures` grew the opposite duration bound: it SKIPS when the clip is
longer than 0.6x the cap, so a `--secs`-regenerated pack skips rather than failing
as a frozen player.

The SECOND half — starting the same content again — is NOT closed, and it is an
app gap rather than a test gap. `plxnative-playurl` is read behind `app.rs`'s
one-shot `auto_tried` latch, so a boot gets exactly one playback; on EOS
`finish_playback` -> `exit_player` leaves the player, and with no Plex session
there is no detail page, no Play control and no key path back in. The manifest
case carries a `_replay_note` naming the small app-side change that would close
it (`engine::start_bufferfeed` already re-reads `dev::playurl()` whenever
`route::url()` is empty), and `docs/lg-self-checklist.md` still marks the replay
half untested.

**#43 CASE1 and #14 — `tools/netcond.py` gains `rate:<kbps>`.** The proxy could
make the server dead in four ways and slow in none, so CASE1's own legs (512 Kbps
-> 1 Mbps -> 7 Mbps -> 17.5 Mbps) could not be PRODUCED and #14's degrading link
was anecdote. One token bucket for the whole proxy, because `rate:` names a link
and a link is shared; decimal kilobits, because that is the unit the item states
its legs in; empty at the start, because a full bucket hands the first
quarter-second a free burst and that is most of a short transfer; live under an
open connection, so one scripted run covers all four legs instead of four
launches. Measured through the real proxy: 512 -> 496 kbps, 2000 -> 2000,
17500 -> 17518.

Two pre-existing bugs surfaced in the code it touches, both fixed:

* **The mode SCOPE was honoured only at accept.** `serve_conn` consulted the
  scope-aware `applies()` and then handed `relay` a bare `Mode.split`, which
  discards it — so `stall@/:/timeline` really froze every open connection
  including the media stream, i.e. the exact opposite of what the scope exists
  for. Both docs claimed the working behaviour. `relay` now takes the
  connection's own first bytes.
* **The read poll's socket timeout was also the other direction's WRITE
  timeout.** Both relay threads share one pair of sockets, so `src.settimeout(0.5)`
  set the timeout on the other thread's `dst`; `sendall` on a timed-out socket
  raises having written an unspecified number of bytes, the `except OSError`
  swallowed it, and the stream truncated silently — reachable in exactly the
  situation the proxy exists to measure. The poll moved to `select` and both
  sockets are put back to blocking before relaying.

`--selftest` proves the shaper against a loopback transfer with no television in
the room, in its own temp control file so it cannot release the mode under a live
experiment.

**What this costs and what it does not prove.** The pipeline pack goes from ~0.4
to ~0.7 GB (the 4K H.264 clip is 93 MB of that) and from 8 clips to 15; resolution
is a property of the media, so a matrix cell cannot be a second case on an
existing file. Everything here is generated, so what none of it reaches is a PMS
DECISION on any of these shapes — `library_gaps` says so per entry. While
correcting those entries: `8-bit-hevc` was ALREADY covered by
`pipe_hevc_aac_mp4` (no `hdr` key, so Main / yuv420p) and the gap list had not
caught up; only `4k-h264` is newly closed.

Host-verified only — this lane has no television. `make check` is green (976 Rust
+ 47 harness tests, the harness suite now including the netcond shaper against
real loopback sockets), every fixture verifies under `make_fixtures.py`'s own
ffprobe checks, and `serve_fixtures.py` answers 206/416 with a byte-exact tail
for each new clip. The device run is the integrator's; the recipe is in the PR.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the which-tier skill still said the synthetic tier was twelve cases

It is 19 as of this branch, and the number in that sentence was going to rot
again — the same way the host test count in CLAUDE.md rotted three times — so it
now points at `./tests/run.py --list` instead of restating a census.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: five sentences this branch made false, one of them mine twice over

`doc-claim-auditor` over the branch. All five are contradictions, not omissions.

**The one that matters, because it is the skill whose whole subject is this
error.** `which-tier` opens by warning against "reading a bare `./tests/run.py`
as the suite it used to be" — and its pasteable `sh` block still said **12
synthetic cases**. Worse, 8ede10e fixed the identical number in that file's
PROSE two paragraphs above and left the two copies in the code block, i.e. the
half a reader copies. The file contradicted itself inside one commit. Both counts
are gone; the block now points at `--list`, which it already named two lines down,
and says why a second copy of the number does not survive here.

**`tests/fixtures/README.md` listed two gaps as unbuilt that this script builds.**
Its `library_gaps` summary still named `8-bit HEVC` and `4K H.264` — while
`manifest.json`, rewritten in the same commit, says 4K H.264 is closed by
`pipe_res_h264_uhd` and 8-bit HEVC has been covered since `pipe_hevc_aac_mp4`
landed (no `hdr` key, so `-profile:v main` / yuv420p). A reader of that page goes
off to author media that already exists. Both cut, with what a generated clip
still cannot close said plainly: a PMS DECISION on such an item.

Same sentence, pre-existing and one word: it named **`plxnative-url`** as the
trigger these are fed through. `tests/README.md` says the opposite and is right —
`plxnative-playurl` is the one carrying the DECLARATION, and several remaining
gaps (HLG, HDR10+) are *about* what the payload declares.

**Trap 9 was falsified by this branch's own fixture, 260 lines below it.** "Nothing
is ever shorter than 60 s" is now false: `pipe_h264_ac3_short` is 20 s because
ENDING is what it grades, and `_resolve_fixtures` enforces the opposite bound for
it. The new shape's comment cited "trap 9's second half" as the rule it breaks;
trap 9 itself was never told, and neither was `PIPE_SHAPES`' header, which still
said the only length constraint left was "do not hit EOF". Both now carry both
bounds, and say that adding a second short clip means picking a side.

**`_probe_fixture`'s "three of the twelve" was never right.** It is four fixtures
carrying two cases each, and it was four of twelve on `main` too — a count that
was wrong before the denominator moved. Replaced with the property (a seek case
beside its play case; an audio-lane pair), which is true at any number.

**`docs/lg-self-checklist.md` was dated the day before its own newest content** —
"Status taken 2026-08-22" above four entries that name 2026-08-23. Bumped, and the
line now says to bump it in the same edit as any row, since it is the only sentence
in that file nothing else restates.

Rejected and recorded so the next run does not re-derive them: the Makefile's
"~0.5s" harness-suite note (measured 1.22 s, hedged with a tilde AND an explicit
"measure before budgeting", subprocess count unchanged); `README.md:176`'s "two
gitignored files", false since 072a60e and not this branch's; and four notes
recording the 6974 ms reporter-join measurement taken while netcond's scope was
broken — they assert the park and the mechanism, not that the media stream kept
flowing, so none is contradicted. Two more (`async-model-decision.md:399`,
`ui/library.rs:171`) described scoping as working per-request and were FALSE until
this branch fixed `relay`; they are true again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* player: a finished stream can be started again, and #46 gets both halves

The replay half of LG App Self Checklist #46 was the one thing my last PR could
not reach from `tests/`, and the reason was six lines in `app.rs`: the synthetic
tier's only entry into the player is `plxnative-playurl`, read behind a one-shot
`auto_tried` latch, so a boot got exactly one playback. On EOS `finish_playback`
→ `exit_player` leaves the player, and with no Plex session there is no detail
page, no Play control and no key path back in.

Everything else was already in place, which is why the change is small:
`teardown` clears the URL and the `ended` flag on a real stop, and
`engine::start_bufferfeed` re-reads `dev::playurl()` whenever `route::url()` is
empty. So a replay is a second trip through the entry the boot already used.

**A COUNTER re-arming the latch, not a lifted latch.** `auto_tried` also guards
the `autoplay`+`playidx` arm, which does a `request_play_movie` +
`load_detail_now` — an unconditionally re-armable latch would re-fetch a catalog
item on every player exit and loop a REAL playback forever.
`/tmp/plxnative-replay[=N]` is bounded, opt-in, read once at boot (so no file
appearing mid-run can turn it into a loop), gated on `playurl` being armed, and
declines when `finish_playback` handed off to Up Next instead — an auto-advance
chain returns to the player, and that is exactly what the route check tells
apart. An absent file is 0, so every existing boot is byte-identical.
`dev::flag`/`dev::read` are `false`/`None` at COMPILE time without `devtriggers`,
so a release build has no replay arm at all; both feature sets type-check.

`replay_budget` is split out and host-tested for `note_global_press`'s reason one
step removed: the call site is inside the SDL event loop where no host test can
reach, and this half touches no SDL. It matters more than it looks, because every
value it can return is plausible and a misparse is invisible on the panel — 0
reads as "the replay arm is missing from this binary" and 2 reads as a loop.

**The two hazards in the lanes that landed in this file since I last read it are
both safe by construction, and I checked rather than assumed.** b6's
unconsumed-press invariant lives in `note_global_press`, and this change is
nowhere near key dispatch — it adds no press path and no global side effect. b7's
recorder cannot write a bogus record for a synthetic playback either:
`coldstart_place` answers `Route::Player` from `metadata::playing()`, which is
installed ONLY by `route::apply_plan` (the PMS decision path), so a URL-fed
session has no playing item and records nothing — before this change or after it.
A replay also re-enters on the next frame, so the 800 ms post-exit hub refresh
never fires between the two viewings.

**The case.** `pipe_replay_after_eos` plays the same 20 s clip, lets it end, and
starts it again. `expect.replays` is one statement, not two: the harness writes it
into the trigger AND `a_replayed` counts it, so the number the app is told cannot
drift from the number that is graded. Three signals, each worthless alone — the
`replay:` line exactly N times (counted, because more often than asked is a loop
and a loop satisfies everything else); at least N+1 `load:` lines, since
`start_bufferfeed` writes one per SESSION and `teardown` cleared the URL, so a
second line is what says the declaration was really re-read; and a media position
that FALLS and then climbs, which is the only thing separating a restart from a
session that carried on. `server_opens_min: 2` is the wire-side half no log line
can give: the second viewing has to fetch the clip again.

`_resolve_fixtures`' EOS bound becomes per VIEWING (`dur * (1 + replays)`), so a
`--secs`-regenerated pack skips this case instead of failing it as a missing
feature. `pipe_finish_eos` stays separate and grades the finish alone: "never
ends" and "ends and cannot be restarted" are different failures, and one case
would report either as the other.

**Two prose corrections this branch's netcond findings force, both about the same
sentence.** The root `CLAUDE.md` describes scoping — "`stall@/:/timeline` freezes
the progress reporter while video keeps streaming, which is what makes a clean
experiment possible" — as a working feature. It was FALSE for as long as it
existed, because `relay` took a scope-less `Mode.split`; it became true on
2026-08-23. Said so at the sentence rather than three sentences later.

And the **6974 ms** measurement cited beside it was taken under that broken
instrument, so the proxy was stalling every connection and not only the
reporter's. **The number and the conclusion both survive, and the mechanism is
worth recording rather than re-deriving:** it was logged as `THREADJOIN timeline
6974ms` — `task::join` emits one NAMED line per join, so the attribution came
from the instrument and not from inferring a total — and `timeline` is the only
join that COULD have parked whatever else was stalled, because `engine::teardown`
step 1 deliberately wakes the other two before joining them (`http_shutdown` on
the demux socket, `aq_abort` on both AU lanes) while the reporter's POST had no
such wake. Before and after were taken the same way, so the 14x is
apples-to-apples. What CANNOT be claimed from that session is that video kept
streaming while the reporter was frozen — a property of the tool today, not of
that run. Recorded in `CLAUDE.md`, `threads.rs` and `engine.rs`, all three of
which carried the number.

Host-verified: `make check` green — 1069 Rust tests (1066 on main + 3 new) and 51
harness tests — and `--no-default-features` type-checks. No television: the device
run is the integrator's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay count is a third exception to the early-exit rule, and says so

`stream_case`'s soundness note names exactly two ABSENCE checks that early exit
cannot see, and asks that a third be REASONED ABOUT rather than added. `a_replayed`
is a third of the same shape: it grades an EQUALITY (exactly N `replay:` lines,
because more than N is a loop), and an equality can pass at N and fail at N+1.

What it cannot see, stated rather than left to be discovered: an app replaying
forever fires its next `replay:` line only after another full viewing — ~20 s on
the short clip — while the case satisfies everything else at ~28 s, so an early
exit two seconds later stops before the evidence arrives.

Not closed by making this one case burn its whole 100 s cap. That is ~1.5 min on
every suite run to guard three lines whose bound is ALREADY gradeable by `make
check`: `replay_left` is decremented before each re-arm, and `replay_budget`'s
parsing has host tests. `--no-early` is how to go looking for a loop deliberately,
and the trade is worth re-taking only if that app-side bound moves.

Also: `docs/ux-scenario.md`'s #46 row pointed at the checklist "where it is listed
as untested", which stopped being true one commit ago. It now points at the case.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay assertion passed on a replay that never played, and three notes it made false

`/code-review` on the replay work, five findings, all mine, all fixed.

**The one that mattered: `a_replayed` was a false PASS in the ordering the field
will actually produce.** It measured the post-drop climb from the GLOBAL floor —
and a floor is a VALUE, so it only lands in viewing 2 when viewing 2 happens to
reach viewing 1's minimum. The `pos=` heartbeat is 1 Hz and free-running, so
viewing 1 logging `pos=0s` while viewing 2's first sample lands at `pos=1s` puts
the anchor back in viewing 1 and measures VIEWING 1'S OWN CLIMB. Reproduced
against the real function: `[0,5,10,19,1]` read as "fell 18s then climbed 19s" and
PASSED with the second viewing having produced one sample and zero seconds of
playback — defeating near-miss (e) in its own docstring, "restarted and then
stalled at the join".

Worse than a corner: the harness exits the moment every assertion passes, so that
is the state it would NORMALLY have graded. My own near-miss test passed only
because its series starts at 2 rather than 0 — exactly the accident a regression
test is for, and there is now one carrying the counterexample verbatim.

The climb is anchored at the index of the deepest DROP, which the loop computing
`drop` already had in hand.

Four more, each a sentence this branch itself made false:

* `a_finished`'s docstring still said the replay half "is unreachable from this
  tier today and it is an app gap, not a test gap … exactly one playback per boot
  and no key path back into the player" — contradicted by the `a_replayed` fifty
  lines below it, by `/tmp/plxnative-replay`, and by `pipe_replay_after_eos`, all
  added in the same change. It now points at them and says why the two cases stay
  apart.
* `_eof_note`, `make_fixtures.py` trap 9, the `pipe_h264_ac3_short` shape comment
  and `tests/README.md` all said `pipe_finish_eos` was the ONLY case allowed to
  reach EOF and the only one allowed to name that fixture. Two cases do both now.
  The rule was never "one case" anyway — it is "a case graded through a teardown
  has to have declared `reaches_eos`", which is what the unit test was deliberately
  loosened to, so the prose was the last thing still asserting the old form.
* `CLAUDE.md` and the `which-tier` skill both said "19 cases as of 2026-08-23".
  The manifest holds 20. **That count rotted inside the branch that wrote it, one
  commit after that same branch corrected the previous stale copy of it.** Both are
  now the pointer to `--list` rather than a fourth number waiting to go stale.
* `NetcondRate.setUp` leaked a `mkdtemp` per test — six `/tmp` directories per
  `make check`, on the command run most often. `addCleanup(shutil.rmtree)`, like
  every other temp use in that file. Verified: no new directories after a run.

`make check` green — 1069 Rust, 52 harness.

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 23, 2026
**This commit contradicts a recorded OWNER RULING and is separated from the one before it for that
reason.** `docs/shared-servers.md` §12, dated 2026-08-21, quotes the owner — *"Servers are
configured on a PC or phone. On the television we only CHOOSE from the available servers"* — and
states the consequence: "There is no add-a-server-by-address on the television, and there will not
be." The ruling is left STANDING and annotated rather than rewritten; an agent may not overturn it.
Dropping this commit leaves the one before it building and green, which is the point of the split.

The case that argued for reopening it is `docs/lg-self-checklist.md` #20/#43/#47: a QA bench not on
the same IPv4 LAN as a plaintext-HTTP PMS dead-ends at "no server found", and the app had no surface
anywhere that could be typed an address. That is a question about a REVIEWER being unable to
evaluate the app at all, which is not the question the ruling answered — it may or may not move it.

**No new `Route` and no screen.** It is two rows in the tail of the popover that already exists,
beside "Check for new shares", which is the other answer to "my server is missing" — putting them
side by side is the point. Closed it is one row; open it is the field plus its action row, and the
COUNT holds still because a popover's height is measured from its rows and a sub-line appearing as
you type would resize the panel under the cursor. `Tail::Recheck` becomes `Tail::Panel(&Add)`,
carrying the field's state, so `ui/onboard.rs`'s `Tail::None` call site — which has no field and
never will — did not have to learn about a state it cannot reach.

The row model, the parse and every read-out are pure and tested that way. `ui/library.rs` is the
wiring; `app.rs` gains a `Route::Library` key guard mirroring the `Route::Search` one already there,
because the television's keyboard has no caret and delegates its delete and Clear-all to the app as
ordinary key syms.

**The seam.** The panel's job ends at a validated `Endpoint`. Dialling it, checking `/identity`,
merging by `machineIdentifier` and registering is worker-thread work with a socket in it and is not
here: the two halves meet at `take_request()` and `report(id, ok)` and nothing else. Nothing takes
the request today, so the field ages out after 20s saying nothing answered — literally true of a
request nobody picked up, and the right read-out once somebody does and the address is wrong.

**A one-source failure now KEEPS the Source chip.** That toolbar row used to empty completely, which
was defensible only while the panel had nothing to offer a user with one server. It was the single
state in the app where somebody whose only server cannot be dialled had nowhere to type one — the
exact dead end this exists to remove. The design's rule is untouched where it argued about a WORKING
library: one source, nothing wrong, still no chip.

Five findings from `/code-review high`, all fixed and each with a test:

- **A panic that killed the app.** `has_prefix_ci` byte-sliced the typed text, and the field
  re-parses on EVERY keystroke to state the port — so a hostname in Cyrillic or Japanese whose 7th
  or 8th byte falls mid-codepoint panicked out of the SDL event loop. `str::get(..n)` now, and the
  simulator survives "привет" with the app still running.
- **The keyboard wedge Search is explicitly defended against.** An app-switch left
  `textinput::STARTED` true and `start()` early-returns on it, so the panel never rose again.
  `app.rs`'s background arm now calls `library::leave_keyboard()` beside `search::leave()` — keeping
  what was typed, because an app switch is the OS moving the screen, not the user abandoning it.
- **The tail vanished on an empty list.** It hung off the last GROUP, so a roster where nothing has
  libraries yet drew neither way out, in precisely the state both rows exist for. It is its own
  headerless section now, with no separator drawn over nothing.
- **The mailboxes had no request identity**, so a late answer for an attempt the user had already
  replaced would land on the new address. They carry a `ReqId` and a mismatched verdict is dropped.
- **`::32400` parsed as a machine NAME** and lit Connect, because the host whitelist allowed `:`
  unconditionally. A multi-colon host is shape-checked as an IPv6 literal instead.

1088 host tests (1075 on the commit before it). Prose corrected where this makes it false:
`ui/consts.rs`'s two "only the Search screen reads these" claims and `docs/distribution.md` §7.
`docs/lg-self-checklist.md` carries the same false sentence and is the integrator's file — the
replacement wording is in the PR body rather than in this diff.

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 24, 2026
* sources: four states where there were two, and the chip stops calling a signed-in owner signed out

Two things the Sources panel and the shared top bar were saying wrongly. Neither depends on the
other; both are the words a surface uses about a fact it already had.

**The Sources panel renders all four `SourceState` variants, and the winning tier.** It drew a
two-state "Not reachable" off `SrcGroup::reachable()`, which is the only question a `bool` could
answer. The group header's accessory is now `[state] · [tier] · handle`, state FIRST — the accessory
is the last run on that line and elides from the right, so leading with the state means a
34-character plex.tv handle is what gives way rather than the fact that a server is not answering.

`Not authorized` is the point of the change. A 401 is a sharing-grant problem whose remedy is one
row down in the same panel — "Check for new shares" IS the `/api/v2/resources` refetch that reissues
the per-(user, server) token. Calling it "not reachable" sends the user to look at a router for
something no router was ever part of. `NotProbed` says nothing, and that is not an omission: a group
only reaches this list once its libraries have landed, so "nobody has dialled" there is a fact about
our own instrumentation, and stating it would put a warning on a working server.

Relay and Remote are spoken; Local is not. Relay is a ~2 Mbit/s tunnel the server transcodes down to
fit, which reads as a broken server unless something says why; Remote explains a slower first frame
and a transcode on a file that direct-plays at home; Local is what a server is expected to be, and
annotating every group with it is noise. A tier is only spoken for a group that WORKS — "Not
reachable · Relay · friend" reads as three problems where there is one.

The dim is a new question. `SrcGroup::reachable()` answers the old two-state one, in which
`Unauthorized` comes back `true` — not because it is browsable but because a `bool` had no way to
say otherwise. `usable()` is an exhaustive match, so a fifth state has to be given an answer rather
than inheriting one, and it still defers to `reachable()` for the three states that method gets
right. `browse.rs` needed no edit.

**And the profile chip.** It decided signed-in-ness from `current().title.is_empty()`, but an
account without Plex Home never gets a profile written at all — so that title is empty for a
signed-in owner, and the chip offered them "Sign in" while the menu behind it already headed itself
with their name and offered "Sign out". On a fresh single-user test account that is the first thing
a reviewer sees. `ui/account_menu.rs`'s module doc has recorded it since the menu was converted, and
named `ui/widgets.rs` as the fix site.

Fixed by moving the words rather than writing the same match a second time: `chip_label` is the one
resolver, it lives beside the rows it has to agree with, and the chip calls it. The avatar's initial
comes off the same name, so a chip reading "Gleb" can never carry somebody else's letter. `peek`,
not `load` — drawing a chip must never be able to WRITE the session file — and the read is inside
the generation-keyed cache, which is the shape `session::peek`'s own "no per-frame reader" note asks
for.

1075 host tests (1069 on the base). Prose corrected where this makes it false: `plex/session.rs`'s
`Account` doc, and `docs/parity-gaps.md`'s now-closed chip entry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* sources: an address you can type, and a seam for whoever dials it

**This commit contradicts a recorded OWNER RULING and is separated from the one before it for that
reason.** `docs/shared-servers.md` §12, dated 2026-08-21, quotes the owner — *"Servers are
configured on a PC or phone. On the television we only CHOOSE from the available servers"* — and
states the consequence: "There is no add-a-server-by-address on the television, and there will not
be." The ruling is left STANDING and annotated rather than rewritten; an agent may not overturn it.
Dropping this commit leaves the one before it building and green, which is the point of the split.

The case that argued for reopening it is `docs/lg-self-checklist.md` #20/#43/#47: a QA bench not on
the same IPv4 LAN as a plaintext-HTTP PMS dead-ends at "no server found", and the app had no surface
anywhere that could be typed an address. That is a question about a REVIEWER being unable to
evaluate the app at all, which is not the question the ruling answered — it may or may not move it.

**No new `Route` and no screen.** It is two rows in the tail of the popover that already exists,
beside "Check for new shares", which is the other answer to "my server is missing" — putting them
side by side is the point. Closed it is one row; open it is the field plus its action row, and the
COUNT holds still because a popover's height is measured from its rows and a sub-line appearing as
you type would resize the panel under the cursor. `Tail::Recheck` becomes `Tail::Panel(&Add)`,
carrying the field's state, so `ui/onboard.rs`'s `Tail::None` call site — which has no field and
never will — did not have to learn about a state it cannot reach.

The row model, the parse and every read-out are pure and tested that way. `ui/library.rs` is the
wiring; `app.rs` gains a `Route::Library` key guard mirroring the `Route::Search` one already there,
because the television's keyboard has no caret and delegates its delete and Clear-all to the app as
ordinary key syms.

**The seam.** The panel's job ends at a validated `Endpoint`. Dialling it, checking `/identity`,
merging by `machineIdentifier` and registering is worker-thread work with a socket in it and is not
here: the two halves meet at `take_request()` and `report(id, ok)` and nothing else. Nothing takes
the request today, so the field ages out after 20s saying nothing answered — literally true of a
request nobody picked up, and the right read-out once somebody does and the address is wrong.

**A one-source failure now KEEPS the Source chip.** That toolbar row used to empty completely, which
was defensible only while the panel had nothing to offer a user with one server. It was the single
state in the app where somebody whose only server cannot be dialled had nowhere to type one — the
exact dead end this exists to remove. The design's rule is untouched where it argued about a WORKING
library: one source, nothing wrong, still no chip.

Five findings from `/code-review high`, all fixed and each with a test:

- **A panic that killed the app.** `has_prefix_ci` byte-sliced the typed text, and the field
  re-parses on EVERY keystroke to state the port — so a hostname in Cyrillic or Japanese whose 7th
  or 8th byte falls mid-codepoint panicked out of the SDL event loop. `str::get(..n)` now, and the
  simulator survives "привет" with the app still running.
- **The keyboard wedge Search is explicitly defended against.** An app-switch left
  `textinput::STARTED` true and `start()` early-returns on it, so the panel never rose again.
  `app.rs`'s background arm now calls `library::leave_keyboard()` beside `search::leave()` — keeping
  what was typed, because an app switch is the OS moving the screen, not the user abandoning it.
- **The tail vanished on an empty list.** It hung off the last GROUP, so a roster where nothing has
  libraries yet drew neither way out, in precisely the state both rows exist for. It is its own
  headerless section now, with no separator drawn over nothing.
- **The mailboxes had no request identity**, so a late answer for an attempt the user had already
  replaced would land on the new address. They carry a `ReqId` and a mismatched verdict is dropped.
- **`::32400` parsed as a machine NAME** and lit Connect, because the host whitelist allowed `:`
  unconditionally. A multi-colon host is shape-checked as an IPv6 literal instead.

1088 host tests (1075 on the commit before it). Prose corrected where this makes it false:
`ui/consts.rs`'s two "only the Search screen reads these" claims and `docs/distribution.md` §7.
`docs/lg-self-checklist.md` carries the same false sentence and is the integrator's file — the
replacement wording is in the PR body rather than in this diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* Revert "sources: an address you can type, and a seam for whoever dials it"

This reverts commit b61ce64.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 26, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble
is the reason this file exists: every item must be Pass or N/A, and marking one
Pass when it should be N/A — or vice versa — is a stated rejection ground. So
"we never tested it" is not a markable state, which makes the UNTESTED column
matter as much as the failing one. Eleven items sit there today.

Four fail outright, and three of those are one root cause: `stream.rs::http_open`
builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only —
which takes out #20, #43 and #47 together the moment a QA bench is not on the same
LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is
undefined for a sideloaded app.

§4 records the four items that moved on 2026-08-22 and why they are worth reading
together: every one was found by LOOKING AT THE PANEL, and not one was visible in
a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the
television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes
instead of the native scancodes the app actually receives; a splash 63% black
against LG's "should not be black"; and `requiredMemory` asking for less headroom
than declaring nothing would have.

§5 records the two items that are DECISIONS rather than defects — no on-screen
transport button row, and English-only — because a future reader of the checklist
will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX
scenario for movement details") is what makes the UX scenario document, not code,
the place that answer belongs.

§7 names the defect class rather than the bug: the music note was the visible tip
of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai
titles and subtitles, hits the same two items, and nothing in the host suite can
see.

Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 26, 2026
…ther family (#51)

`http_open` built a `sockaddr_in` by hand from four decimal octets. That is not a
degraded transport for a hostname or an IPv6 server — it is no transport at all, which
is why `plex::probe` ranks a `plex.direct` name BELOW the dotted quad behind it and why
`auth::dial_target` refuses every candidate that is not an IPv4 literal. LG App Self
Checklist #43 CASE2 (IPv6) fails on this line.

`resolve()` now calls `getaddrinfo` with AF_UNSPEC + SOCK_STREAM, so the family and the
ORDER are the system's own destination-address policy (RFC 6724) rather than something
this file picks. The flag split is a correctness fix, not an optimisation: a LITERAL
takes AI_NUMERICHOST, because AI_ADDRCONFIG suppresses AF_INET6 results on a host whose
only IPv6 address is loopback — so `getaddrinfo("::1", …, AI_ADDRCONFIG)` legitimately
resolves to NOTHING on a healthy machine. It also keeps the existing dotted-quad path
free: no NSS module loaded, no packet sent, so the per-seek AVIO reopen costs what the
hand parse did. A NAME takes AI_ADDRCONFIG, which is what that flag is for.

The node handed to the resolver is UNBRACKETED and the `Host:` header is BRACKETED —
`getaddrinfo("[::1]", …)` is EAI_NONAME, while brackets are URI-authority grammar
(RFC 3986 §3.2.2 → RFC 9110 §7.2). `resolver_node` strips and `host_header` re-adds, one
function apart so the asymmetry is visible rather than remembered.

`Host:` is built from the ORIGIN, never the address dialled. That was correct only while
the input WAS an address; sending the numeric one now would break name-based virtual
hosting, invisibly, since the TCP session is identical either way.

`connect_any` walks the WHOLE chain. Trying only the first address is the old
single-address limit wearing a resolver. Both of this file's invariants are
re-established per attempt, not just the first: the fd is published into its atomic
BEFORE connect, and every failed attempt is retired through `close_owned`, never a bare
close.

CONNECT_TIMEOUT_MS 2000 → 8000, as the budget for the whole chain rather than per
address, so the worst-case main-loop block is one number however many addresses came
back. Deliberately NOT derived from the address: RFC1918 is not "local" in Plex's sense,
and probe order is `plex::probe`'s policy. The constant's doc says plainly who pays for
the raise today — no caller hands this module a name yet — so the trade-off is on the
record rather than aspirational.

`HttpStream` gains an `interrupted` latch. Resolving gave the open something it never
had: a NEXT thing to try after a failed connect. A handshake aborted by `shutdown(2)`
and an address that is simply dead are the same value at connect's return, so without
the latch a teardown fired during attempt 1 of 2 is answered by OPENING attempt 2 — the
interrupt consumed, a fresh connection handed to a caller being torn down. Set by
`http_shutdown` unconditionally (including with the fd already -1, which is the
between-attempts window), cleared by `reset_fields`, read on both sides of the walk.

Chunked detection was `find_ci(hdr, b"\r\ntransfer-encoding: chunked")` — one exact
spelling. `Transfer-Encoding:chunked` (OWS after the colon is optional), `Chunked`,
`gzip, chunked` and a list split across two lines all missed, and a miss is not a
failure: the body is then read as close-delimited with the chunk-size lines left INLINE
in it. Now a real list parse.

Two bugs review caught that the host suite could not, both green on Darwin first:

  - The port range check was left to AI_NUMERICSERV, and glibc does not do one — it
    parses with strtoul, checks nothing, and returns htons(70000) = port 4464. The
    assertion passed here and would have gone RED on CI's ubuntu-latest, with the
    truncation still live on the television. Now range-checked in `resolve` itself, in
    Rust, which is the only version true on both platforms.
  - The fd-leak test was sending `999.1.2.3` to the real resolver as a NAME. On a network
    with NXDOMAIN hijacking that resolves to a real web server and the open SUCCEEDS; on
    one with a dead resolver it burns glibc's whole timeout budget inside a suite
    documented as offline and ~0.3 s. Replaced with an out-of-range port — the same early
    exit, and it cannot leave the machine.

989 host tests (976 before), clippy gate clean, `--no-default-features` clean, and the
simulator still reaches Home against a real PMS over plain IPv4.

Host-proven; what still needs a television — chiefly whether glibc's NSS machinery works
inside the app's jail, which LG's c-ares-linked libcurl is NOT evidence for — is in the
PR body.


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
…second (#43 CASE1, partial) (#57)

* quality: a ceiling is a ROUTING policy first, a transcoder parameter second

LG App Self Checklist #43 CASE1 asks that the picture follow the link. The
obvious implementation — a bitrate field on `TranscodeSpec` — does nothing for
exactly the file it exists for, and this deliberately is not that.

`build_stream` picks direct play → remux → re-encode BEFORE a spec exists, and
only the re-encode branch's query has ever carried `maxVideoBitrate`. Direct
play streams the file's own bytes with no encoder anywhere to read a cap; a
remux copies the codecs and sends no cap by design, because a cap is what would
force the re-encode it exists to avoid. So a 30 Mbit/s source on a 4 Mbit/s
link direct-plays straight past any number on the spec.

So a rung is spent the way `link_policy` spends the relay tier: deny the two
flavors that ship the file at its own rate, leaving the one whose whole point is
that the server picks the rate. Only then does the number reach the wire.

  route::Quality        Auto + 5 rungs, each pairing a rate with the frame it
                        makes sense at; each sits under one of the checklist's
                        own legs (512 Kbps / 1 Mbps / 7 Mbps / 17.5 Mbps).
  route::quality_policy returns the same two flags `link_policy` does.
  route::flavors_allowed composes the two — the stricter always wins, per
                        flavor. A relay cannot be loosened by a high rung.
  plex::Ceiling         the parameter half; `None` (Auto) resolves to the
                        native-4K literals this query has always sent.

An unmeasured source fails CLOSED, which is the opposite of
`video_direct_plays`'s unknown-passes rule and deliberately so: a device bound
is a capability, a user ceiling is an instruction. The ceiling is captured per
PLAYBACK (`Session::cur_ceiling`), like `cur_remux` beside it, so a seek or a
track switch rebuilds the identical query rather than reshaping the encode
mid-film.

The picker is a second section of the player's existing `…` popover — leading
checkmarks for the ladder, the trailing On/Off word for the switch above it, no
full-screen sheet (docs/parity-gaps.md's standing decision). Its panel could
hold 320px while this menu had one row; the ladder needs the room that is
actually there.

Six host tests are the gate, and they grade the expression `build_stream`
evaluates rather than a re-derivation of it: Auto changes nothing on any source
or link; under-ceiling content stays direct-play eligible; over-ceiling loses
direct play; over-ceiling loses the remux too; the re-encode query carries the
cap (and Auto's stays byte-identical); relay and rung compose to the stricter.

`plex/CLAUDE.md` said `TranscodeSpec` "must not grow" a bitrate field, which
was right about a LINK ceiling and wrong as a general rule — corrected there,
with the ORDER (flavour first, number second) kept as the rule that survives.

Mid-session adaptive switching is NOT here and #43 CASE1 is NOT closed by this.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: the review's two routing holes, and a picker that did nothing where it lives

`/code-review` found eight, and the two that mattered were both about the
ceiling being remembered in the wrong places.

**A direct play forgot the rung.** `plan.ceiling` was set only on the transcode
branch, after the direct-play `return`, so `cur_ceiling` stayed `None` for every
direct play — and `retranscode` reaches a direct-play session (an audio-track
switch, a subtitle burn; `player/pump.rs` says so in as many words) and spends
`cur_ceiling` on the encode it then starts. Picking "480p · 720 kbps", playing a
small file that direct-plays, then switching audio re-encoded at 4K/60 Mbps: the
rung silently discarded on the one path where an encoder was actually running.
It is now set on every plan, inert where it means nothing.

**Every TV episode measured as unmeasured.** `src_kbps` matched
`metadata::current()` on ratingKey alone, but pressing Play on a show page
resolves the EPISODE's rk against a Detail holding the SHOW's — so the match
never landed, `Ceiling::admits` failed closed, and with any rung selected every
episode in the library lost direct play while `playback_preview`, reading that
same Detail's numbers directly, still promised Direct Play for it. Two answers
to one question, which is the mismatch that preview exists to prevent.
`detail_describes` now accepts the on-deck episode's key too — the leaf whose
technicals `fetch_item_streams` backfilled into the show, and the leaf
`playback_preview` already answers for.

**And the picker did nothing in the only place it can be reached.** The ladder
lives in the player's `…` menu; a rung that bound only future plays meant
pressing BACK and replaying to see any effect, with nothing on screen saying so.
`set_quality` now re-asks the routing question for the item on screen, against
the numbers that resolve measured (`Session::cur_src`), and reloads only when
the answer changed — a higher rung than the picture already satisfies does
nothing. It goes through `request_transcode_refresh`, the identical path a
subtitle-burn change takes, gated in the pump on a session that is actually
Playing. User-initiated, not adaptive: nothing measures a link.

Five smaller ones, all real:
  - `ptr::write` into the now-owned `static mut ROWS: Vec<Action>` leaked the
    previous row list on every `…` press. It is an assignment now.
  - the new panel-height cap was 4px UNDER the content — derived from 560 of
    content, forgetting 40 of padding — so the last rung was clipped until you
    scrolled. Same symptom as the 320 it replaced, one row deep instead of five.
  - every rung's comment claimed to sit "under" a checklist leg it is
    numerically ABOVE. A rung is a CONTENT rate and a leg is a LINK rate; there
    is a table now, and it says out loud that the 512 Kbit/s leg is below this
    ladder's floor.
  - `admits` judged a whole-file bitrate against a cap that ships as
    `maxVideoBitrate`, so each rung bit one AC-3 track early. It reads the video
    stream's own rate where PMS gave one, whole-file as the fallback.
  - `link_policy`'s doc still asserted the rule this work repealed — the third
    copy of that claim, and the one the first commit missed.

Two new host tests pin the two MEDIUM findings; the six routing gates are
unchanged. 984 pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: one assignment of plan.ceiling, not two

The review fix set it for every flavour at the decision site, which left the
transcode branch's original assignment as a duplicate of a value that could not
have changed between the two lines. The comment stays, pointed at where the
assignment actually is.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the three parity-gaps rows this quality work made false

`docs/parity-gaps.md` is a gap CATALOG, so a landed gap left standing reads as
work still to do — and two of these three rows describe exactly what PR #57
built, which is the sort of claim that stays false for months here (the `ar`
claim and the `stream.rs` chunked claim both did).

  - "There is no Quality picker anywhere in the app" — there is. Annotated with
    what landed DIFFERENTLY from the row's own prescription (a section of the
    existing `…` popover, not a new `ui/quality_menu.rs` + a fifth
    `Overlay::Quality`) and with the half it did not anticipate at all: a rung
    is a ROUTING policy before it is a parameter.
  - "TranscodeSpec cannot express any other [target]" — it carries `ceiling`,
    and Auto resolves to those two literals byte for byte. Its *Where* said the
    remux branch should be "only taken at Original", which got sharper rather
    than simpler: a remux is refused for a source the rung cannot carry, and a
    small file under a low rung still remuxes.
  - "The source bitrate, width/height and videoResolution are not in the data
    model" — HALF true now. `Detail` has all three; `PlayingItem` has none, and
    that is the live residual, not a cosmetic one: an episode reached from a
    season list or Up Next measures 0 and fails closed.

Each keeps its *Where* and *Device* notes intact — they are still the map for
the half that is open.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the FOUR remaining copies of "TranscodeSpec has no bitrate field"

The first commit corrected three (`plex/CLAUDE.md`, `link_policy`'s doc,
`TranscodeSpec`'s own). A grep for the claim found four more, in three files —
which is the shape this repo keeps losing to: one sentence, copied into every
place that had to reason about it, then falsified in one edit.

  - parity-gaps.md's TOP-LEVEL summary ("G. Quality is one hard-coded rung"),
    which is the copy most likely to be read. It now also says out loud that
    every duplicate of the row further down the file is historical, so the four
    per-client audit sections do not each need their own annotation.
  - shared-servers.md's step-9 row and its relay-policy bullet. Both are ABOUT
    the relay, where nothing changed — the relay still names no rate — so they
    are corrected in place rather than rewritten: the branch-not-a-parameter
    argument survives, minus the premise that has stopped being true.
  - pms-api.md's Dolby Vision measurement, which quotes the re-encode query
    verbatim. Those two values are still exactly what Auto sends, so the
    measurement stands; the clause now says which configuration produced it.

Prose only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the doc-claim-auditor's eight, including two the code itself contradicted

Ran `doc-claim-auditor` over the diff. Eight contradictions across 71 tracked
markdown files and 110 Rust files; three I had already fixed while it ran. The
five that were left, plus its one nit:

**Two were MY OWN prose, wrong about my own code.**
  - `plex/CLAUDE.md` said a `Ceiling` reaches `transcode_query` only once both
    fast flavours are denied. It reaches it on EVERY spec, remux included —
    what reaches the WIRE only after a refusal is a rate. `params.rs` says the
    opposite two files away, and `transcoder`'s test builds exactly the spec
    the sentence claimed cannot exist. Corrected, and the remux branch's
    silence is now named as an invariant a test pins rather than a `None`
    anyone may rely on.
  - `app.rs`'s new call-site comment still said a rung "lands on the next
    resolve", which the second commit inverted. It was the only line left
    saying so, and it sat at the call site.

**Two were prose the change falsified elsewhere.**
  - `route::Preview`'s doc enumerates the gates `build_stream` applies and said
    THREE. There are four; the ceiling is the one a reader debugging "why does
    this ordinary h264/AC-3 MKV say Converts" would never think of.
  - `metadata.rs`'s technical-record block said it was "read by nothing else"
    than `ui::tracks_panel`. `route::source_kbps` reads `video.bitrate` from it
    now, so dropping the backfill would move every rung's threshold with a
    green suite.

**And two status records that decide what someone does next.**
  - `ui/CLAUDE.md`'s module table: "a menu with one row", and it named
    `Row::checked` for the row that draws `Row::toggle` — already inverted
    before this change, and now actively misleading, because `Row::checked` is
    what the Quality rungs in that same menu use. The table now carries the
    rule instead of one side of it.
  - `docs/lg-self-checklist.md` #43 CASE1: "one direct-play-vs-transcode
    decision at start, held for the session". A user can change it mid-film
    now; a measurement still cannot, which is why the item still FAILS — the
    verdict is unchanged and the reason is narrower.

Plus the six remaining `parity-gaps.md` quality rows the earlier pass missed
(the file repeats this gap once per reference-client audit), each struck to
"the gap it WAS" with the half that is still open kept: no badge, no PERSISTED
preference store, no force-direct-play, no disable-remux.

`params.rs`'s "asserted in `transcoder`'s tests" was half right — that suite
pins the ceiling is inert on a remux; `route`'s gates 2 and 4 pin the other
half. Both are named now.

Prose only; 984 tests unchanged.

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 a proxy that can be slow (#59)

* tests: the resolution matrix LG asks for, a clip that is meant to end, and a proxy that can be slow

Three checklist items were unanswerable for three different reasons, and none of
them was a defect in the app.

**#50/#51 — resolution x codec.** The item is graded as a MATRIX and this repo
could only answer it as "pieces are covered": every pipeline fixture was 1080p
except one 4K HEVC, so SD and HD had never been played AT ALL, and 4K H.264
existed in neither pack — which is a fact about the maintainer's library (every
4K item there is HEVC or AV1) rather than about the player. Six new generated
clips complete the grid: SD 720x480 / HD 1280x720 / FHD 1920x1080 / UHD 3840x2160
x {h264, hevc}, with ONE audio codec per column so a row-to-row difference is the
raster and nothing else. Each of the eight cells now grades `expect.video_size`,
an EXACT WxH out of the `ff:` line, because `min_video_width` cannot tell 720x480
from 720x576 and a matrix answered with "at least 1900 wide" is the answer the
item is asking us to stop giving.

Four decisions in the matrix look arbitrary and are argued where they live
(`PIPE_SHAPES`' block comment): square pixels at 720x480 (an anamorphic fixture
would grade PAR handling, an axis with no assertion behind it anywhere here);
CRF held constant is constant QUALITY, not bitrate, so 4K H.264 is crf 26 and not
its 1080p sibling's 20 — the same CRF measures ~30 Mbit/s up there, a
quarter-gigabyte clip in service of no assertion; SDR 8-bit throughout, which
makes the UHD/HEVC cell the odd one out because it is the existing HDR10 fixture,
already device-verified; and E-AC-3 down the HEVC column, which is also the
better false-PASS defence, since `engine`'s `_ =>` arm can only ever produce
"AC3".

**#46 — replay after completion.** Its FIRST half now runs: `pipe_finish_eos`
plays a deliberately short 20 s clip to its end and asserts `EOS reached ...
-> ended` followed by `stop_bufferfeed: torn down`, in that order. Ordered
because every stop tears the engine down — the harness's own close included — and
searched forward from the EOS rather than compared against the first teardown in
the log, because `teardown` writes the same line for a `for_reload` stop, which
would fail the case for its whole cap with the evidence reading "the player froze
on the last frame". This is the only case in either tier that is SUPPOSED to run
out, so it gets its own fixture that nothing else may name (everything else is
sized so it cannot hit EOF mid-window, trap 9's second half), and
`_resolve_fixtures` grew the opposite duration bound: it SKIPS when the clip is
longer than 0.6x the cap, so a `--secs`-regenerated pack skips rather than failing
as a frozen player.

The SECOND half — starting the same content again — is NOT closed, and it is an
app gap rather than a test gap. `plxnative-playurl` is read behind `app.rs`'s
one-shot `auto_tried` latch, so a boot gets exactly one playback; on EOS
`finish_playback` -> `exit_player` leaves the player, and with no Plex session
there is no detail page, no Play control and no key path back in. The manifest
case carries a `_replay_note` naming the small app-side change that would close
it (`engine::start_bufferfeed` already re-reads `dev::playurl()` whenever
`route::url()` is empty), and `docs/lg-self-checklist.md` still marks the replay
half untested.

**#43 CASE1 and #14 — `tools/netcond.py` gains `rate:<kbps>`.** The proxy could
make the server dead in four ways and slow in none, so CASE1's own legs (512 Kbps
-> 1 Mbps -> 7 Mbps -> 17.5 Mbps) could not be PRODUCED and #14's degrading link
was anecdote. One token bucket for the whole proxy, because `rate:` names a link
and a link is shared; decimal kilobits, because that is the unit the item states
its legs in; empty at the start, because a full bucket hands the first
quarter-second a free burst and that is most of a short transfer; live under an
open connection, so one scripted run covers all four legs instead of four
launches. Measured through the real proxy: 512 -> 496 kbps, 2000 -> 2000,
17500 -> 17518.

Two pre-existing bugs surfaced in the code it touches, both fixed:

* **The mode SCOPE was honoured only at accept.** `serve_conn` consulted the
  scope-aware `applies()` and then handed `relay` a bare `Mode.split`, which
  discards it — so `stall@/:/timeline` really froze every open connection
  including the media stream, i.e. the exact opposite of what the scope exists
  for. Both docs claimed the working behaviour. `relay` now takes the
  connection's own first bytes.
* **The read poll's socket timeout was also the other direction's WRITE
  timeout.** Both relay threads share one pair of sockets, so `src.settimeout(0.5)`
  set the timeout on the other thread's `dst`; `sendall` on a timed-out socket
  raises having written an unspecified number of bytes, the `except OSError`
  swallowed it, and the stream truncated silently — reachable in exactly the
  situation the proxy exists to measure. The poll moved to `select` and both
  sockets are put back to blocking before relaying.

`--selftest` proves the shaper against a loopback transfer with no television in
the room, in its own temp control file so it cannot release the mode under a live
experiment.

**What this costs and what it does not prove.** The pipeline pack goes from ~0.4
to ~0.7 GB (the 4K H.264 clip is 93 MB of that) and from 8 clips to 15; resolution
is a property of the media, so a matrix cell cannot be a second case on an
existing file. Everything here is generated, so what none of it reaches is a PMS
DECISION on any of these shapes — `library_gaps` says so per entry. While
correcting those entries: `8-bit-hevc` was ALREADY covered by
`pipe_hevc_aac_mp4` (no `hdr` key, so Main / yuv420p) and the gap list had not
caught up; only `4k-h264` is newly closed.

Host-verified only — this lane has no television. `make check` is green (976 Rust
+ 47 harness tests, the harness suite now including the netcond shaper against
real loopback sockets), every fixture verifies under `make_fixtures.py`'s own
ffprobe checks, and `serve_fixtures.py` answers 206/416 with a byte-exact tail
for each new clip. The device run is the integrator's; the recipe is in the PR.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the which-tier skill still said the synthetic tier was twelve cases

It is 19 as of this branch, and the number in that sentence was going to rot
again — the same way the host test count in CLAUDE.md rotted three times — so it
now points at `./tests/run.py --list` instead of restating a census.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: five sentences this branch made false, one of them mine twice over

`doc-claim-auditor` over the branch. All five are contradictions, not omissions.

**The one that matters, because it is the skill whose whole subject is this
error.** `which-tier` opens by warning against "reading a bare `./tests/run.py`
as the suite it used to be" — and its pasteable `sh` block still said **12
synthetic cases**. Worse, 8ede10e fixed the identical number in that file's
PROSE two paragraphs above and left the two copies in the code block, i.e. the
half a reader copies. The file contradicted itself inside one commit. Both counts
are gone; the block now points at `--list`, which it already named two lines down,
and says why a second copy of the number does not survive here.

**`tests/fixtures/README.md` listed two gaps as unbuilt that this script builds.**
Its `library_gaps` summary still named `8-bit HEVC` and `4K H.264` — while
`manifest.json`, rewritten in the same commit, says 4K H.264 is closed by
`pipe_res_h264_uhd` and 8-bit HEVC has been covered since `pipe_hevc_aac_mp4`
landed (no `hdr` key, so `-profile:v main` / yuv420p). A reader of that page goes
off to author media that already exists. Both cut, with what a generated clip
still cannot close said plainly: a PMS DECISION on such an item.

Same sentence, pre-existing and one word: it named **`plxnative-url`** as the
trigger these are fed through. `tests/README.md` says the opposite and is right —
`plxnative-playurl` is the one carrying the DECLARATION, and several remaining
gaps (HLG, HDR10+) are *about* what the payload declares.

**Trap 9 was falsified by this branch's own fixture, 260 lines below it.** "Nothing
is ever shorter than 60 s" is now false: `pipe_h264_ac3_short` is 20 s because
ENDING is what it grades, and `_resolve_fixtures` enforces the opposite bound for
it. The new shape's comment cited "trap 9's second half" as the rule it breaks;
trap 9 itself was never told, and neither was `PIPE_SHAPES`' header, which still
said the only length constraint left was "do not hit EOF". Both now carry both
bounds, and say that adding a second short clip means picking a side.

**`_probe_fixture`'s "three of the twelve" was never right.** It is four fixtures
carrying two cases each, and it was four of twelve on `main` too — a count that
was wrong before the denominator moved. Replaced with the property (a seek case
beside its play case; an audio-lane pair), which is true at any number.

**`docs/lg-self-checklist.md` was dated the day before its own newest content** —
"Status taken 2026-08-22" above four entries that name 2026-08-23. Bumped, and the
line now says to bump it in the same edit as any row, since it is the only sentence
in that file nothing else restates.

Rejected and recorded so the next run does not re-derive them: the Makefile's
"~0.5s" harness-suite note (measured 1.22 s, hedged with a tilde AND an explicit
"measure before budgeting", subprocess count unchanged); `README.md:176`'s "two
gitignored files", false since b6b9bdb and not this branch's; and four notes
recording the 6974 ms reporter-join measurement taken while netcond's scope was
broken — they assert the park and the mechanism, not that the media stream kept
flowing, so none is contradicted. Two more (`async-model-decision.md:399`,
`ui/library.rs:171`) described scoping as working per-request and were FALSE until
this branch fixed `relay`; they are true again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* player: a finished stream can be started again, and #46 gets both halves

The replay half of LG App Self Checklist #46 was the one thing my last PR could
not reach from `tests/`, and the reason was six lines in `app.rs`: the synthetic
tier's only entry into the player is `plxnative-playurl`, read behind a one-shot
`auto_tried` latch, so a boot got exactly one playback. On EOS `finish_playback`
→ `exit_player` leaves the player, and with no Plex session there is no detail
page, no Play control and no key path back in.

Everything else was already in place, which is why the change is small:
`teardown` clears the URL and the `ended` flag on a real stop, and
`engine::start_bufferfeed` re-reads `dev::playurl()` whenever `route::url()` is
empty. So a replay is a second trip through the entry the boot already used.

**A COUNTER re-arming the latch, not a lifted latch.** `auto_tried` also guards
the `autoplay`+`playidx` arm, which does a `request_play_movie` +
`load_detail_now` — an unconditionally re-armable latch would re-fetch a catalog
item on every player exit and loop a REAL playback forever.
`/tmp/plxnative-replay[=N]` is bounded, opt-in, read once at boot (so no file
appearing mid-run can turn it into a loop), gated on `playurl` being armed, and
declines when `finish_playback` handed off to Up Next instead — an auto-advance
chain returns to the player, and that is exactly what the route check tells
apart. An absent file is 0, so every existing boot is byte-identical.
`dev::flag`/`dev::read` are `false`/`None` at COMPILE time without `devtriggers`,
so a release build has no replay arm at all; both feature sets type-check.

`replay_budget` is split out and host-tested for `note_global_press`'s reason one
step removed: the call site is inside the SDL event loop where no host test can
reach, and this half touches no SDL. It matters more than it looks, because every
value it can return is plausible and a misparse is invisible on the panel — 0
reads as "the replay arm is missing from this binary" and 2 reads as a loop.

**The two hazards in the lanes that landed in this file since I last read it are
both safe by construction, and I checked rather than assumed.** b6's
unconsumed-press invariant lives in `note_global_press`, and this change is
nowhere near key dispatch — it adds no press path and no global side effect. b7's
recorder cannot write a bogus record for a synthetic playback either:
`coldstart_place` answers `Route::Player` from `metadata::playing()`, which is
installed ONLY by `route::apply_plan` (the PMS decision path), so a URL-fed
session has no playing item and records nothing — before this change or after it.
A replay also re-enters on the next frame, so the 800 ms post-exit hub refresh
never fires between the two viewings.

**The case.** `pipe_replay_after_eos` plays the same 20 s clip, lets it end, and
starts it again. `expect.replays` is one statement, not two: the harness writes it
into the trigger AND `a_replayed` counts it, so the number the app is told cannot
drift from the number that is graded. Three signals, each worthless alone — the
`replay:` line exactly N times (counted, because more often than asked is a loop
and a loop satisfies everything else); at least N+1 `load:` lines, since
`start_bufferfeed` writes one per SESSION and `teardown` cleared the URL, so a
second line is what says the declaration was really re-read; and a media position
that FALLS and then climbs, which is the only thing separating a restart from a
session that carried on. `server_opens_min: 2` is the wire-side half no log line
can give: the second viewing has to fetch the clip again.

`_resolve_fixtures`' EOS bound becomes per VIEWING (`dur * (1 + replays)`), so a
`--secs`-regenerated pack skips this case instead of failing it as a missing
feature. `pipe_finish_eos` stays separate and grades the finish alone: "never
ends" and "ends and cannot be restarted" are different failures, and one case
would report either as the other.

**Two prose corrections this branch's netcond findings force, both about the same
sentence.** The root `CLAUDE.md` describes scoping — "`stall@/:/timeline` freezes
the progress reporter while video keeps streaming, which is what makes a clean
experiment possible" — as a working feature. It was FALSE for as long as it
existed, because `relay` took a scope-less `Mode.split`; it became true on
2026-08-23. Said so at the sentence rather than three sentences later.

And the **6974 ms** measurement cited beside it was taken under that broken
instrument, so the proxy was stalling every connection and not only the
reporter's. **The number and the conclusion both survive, and the mechanism is
worth recording rather than re-deriving:** it was logged as `THREADJOIN timeline
6974ms` — `task::join` emits one NAMED line per join, so the attribution came
from the instrument and not from inferring a total — and `timeline` is the only
join that COULD have parked whatever else was stalled, because `engine::teardown`
step 1 deliberately wakes the other two before joining them (`http_shutdown` on
the demux socket, `aq_abort` on both AU lanes) while the reporter's POST had no
such wake. Before and after were taken the same way, so the 14x is
apples-to-apples. What CANNOT be claimed from that session is that video kept
streaming while the reporter was frozen — a property of the tool today, not of
that run. Recorded in `CLAUDE.md`, `threads.rs` and `engine.rs`, all three of
which carried the number.

Host-verified: `make check` green — 1069 Rust tests (1066 on main + 3 new) and 51
harness tests — and `--no-default-features` type-checks. No television: the device
run is the integrator's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay count is a third exception to the early-exit rule, and says so

`stream_case`'s soundness note names exactly two ABSENCE checks that early exit
cannot see, and asks that a third be REASONED ABOUT rather than added. `a_replayed`
is a third of the same shape: it grades an EQUALITY (exactly N `replay:` lines,
because more than N is a loop), and an equality can pass at N and fail at N+1.

What it cannot see, stated rather than left to be discovered: an app replaying
forever fires its next `replay:` line only after another full viewing — ~20 s on
the short clip — while the case satisfies everything else at ~28 s, so an early
exit two seconds later stops before the evidence arrives.

Not closed by making this one case burn its whole 100 s cap. That is ~1.5 min on
every suite run to guard three lines whose bound is ALREADY gradeable by `make
check`: `replay_left` is decremented before each re-arm, and `replay_budget`'s
parsing has host tests. `--no-early` is how to go looking for a loop deliberately,
and the trade is worth re-taking only if that app-side bound moves.

Also: `docs/ux-scenario.md`'s #46 row pointed at the checklist "where it is listed
as untested", which stopped being true one commit ago. It now points at the case.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay assertion passed on a replay that never played, and three notes it made false

`/code-review` on the replay work, five findings, all mine, all fixed.

**The one that mattered: `a_replayed` was a false PASS in the ordering the field
will actually produce.** It measured the post-drop climb from the GLOBAL floor —
and a floor is a VALUE, so it only lands in viewing 2 when viewing 2 happens to
reach viewing 1's minimum. The `pos=` heartbeat is 1 Hz and free-running, so
viewing 1 logging `pos=0s` while viewing 2's first sample lands at `pos=1s` puts
the anchor back in viewing 1 and measures VIEWING 1'S OWN CLIMB. Reproduced
against the real function: `[0,5,10,19,1]` read as "fell 18s then climbed 19s" and
PASSED with the second viewing having produced one sample and zero seconds of
playback — defeating near-miss (e) in its own docstring, "restarted and then
stalled at the join".

Worse than a corner: the harness exits the moment every assertion passes, so that
is the state it would NORMALLY have graded. My own near-miss test passed only
because its series starts at 2 rather than 0 — exactly the accident a regression
test is for, and there is now one carrying the counterexample verbatim.

The climb is anchored at the index of the deepest DROP, which the loop computing
`drop` already had in hand.

Four more, each a sentence this branch itself made false:

* `a_finished`'s docstring still said the replay half "is unreachable from this
  tier today and it is an app gap, not a test gap … exactly one playback per boot
  and no key path back into the player" — contradicted by the `a_replayed` fifty
  lines below it, by `/tmp/plxnative-replay`, and by `pipe_replay_after_eos`, all
  added in the same change. It now points at them and says why the two cases stay
  apart.
* `_eof_note`, `make_fixtures.py` trap 9, the `pipe_h264_ac3_short` shape comment
  and `tests/README.md` all said `pipe_finish_eos` was the ONLY case allowed to
  reach EOF and the only one allowed to name that fixture. Two cases do both now.
  The rule was never "one case" anyway — it is "a case graded through a teardown
  has to have declared `reaches_eos`", which is what the unit test was deliberately
  loosened to, so the prose was the last thing still asserting the old form.
* `CLAUDE.md` and the `which-tier` skill both said "19 cases as of 2026-08-23".
  The manifest holds 20. **That count rotted inside the branch that wrote it, one
  commit after that same branch corrected the previous stale copy of it.** Both are
  now the pointer to `--list` rather than a fourth number waiting to go stale.
* `NetcondRate.setUp` leaked a `mkdtemp` per test — six `/tmp` directories per
  `make check`, on the command run most often. `addCleanup(shutil.rmtree)`, like
  every other temp use in that file. Verified: no new directories after a run.

`make check` green — 1069 Rust, 52 harness.

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
* sources: four states where there were two, and the chip stops calling a signed-in owner signed out

Two things the Sources panel and the shared top bar were saying wrongly. Neither depends on the
other; both are the words a surface uses about a fact it already had.

**The Sources panel renders all four `SourceState` variants, and the winning tier.** It drew a
two-state "Not reachable" off `SrcGroup::reachable()`, which is the only question a `bool` could
answer. The group header's accessory is now `[state] · [tier] · handle`, state FIRST — the accessory
is the last run on that line and elides from the right, so leading with the state means a
34-character plex.tv handle is what gives way rather than the fact that a server is not answering.

`Not authorized` is the point of the change. A 401 is a sharing-grant problem whose remedy is one
row down in the same panel — "Check for new shares" IS the `/api/v2/resources` refetch that reissues
the per-(user, server) token. Calling it "not reachable" sends the user to look at a router for
something no router was ever part of. `NotProbed` says nothing, and that is not an omission: a group
only reaches this list once its libraries have landed, so "nobody has dialled" there is a fact about
our own instrumentation, and stating it would put a warning on a working server.

Relay and Remote are spoken; Local is not. Relay is a ~2 Mbit/s tunnel the server transcodes down to
fit, which reads as a broken server unless something says why; Remote explains a slower first frame
and a transcode on a file that direct-plays at home; Local is what a server is expected to be, and
annotating every group with it is noise. A tier is only spoken for a group that WORKS — "Not
reachable · Relay · friend" reads as three problems where there is one.

The dim is a new question. `SrcGroup::reachable()` answers the old two-state one, in which
`Unauthorized` comes back `true` — not because it is browsable but because a `bool` had no way to
say otherwise. `usable()` is an exhaustive match, so a fifth state has to be given an answer rather
than inheriting one, and it still defers to `reachable()` for the three states that method gets
right. `browse.rs` needed no edit.

**And the profile chip.** It decided signed-in-ness from `current().title.is_empty()`, but an
account without Plex Home never gets a profile written at all — so that title is empty for a
signed-in owner, and the chip offered them "Sign in" while the menu behind it already headed itself
with their name and offered "Sign out". On a fresh single-user test account that is the first thing
a reviewer sees. `ui/account_menu.rs`'s module doc has recorded it since the menu was converted, and
named `ui/widgets.rs` as the fix site.

Fixed by moving the words rather than writing the same match a second time: `chip_label` is the one
resolver, it lives beside the rows it has to agree with, and the chip calls it. The avatar's initial
comes off the same name, so a chip reading "Gleb" can never carry somebody else's letter. `peek`,
not `load` — drawing a chip must never be able to WRITE the session file — and the read is inside
the generation-keyed cache, which is the shape `session::peek`'s own "no per-frame reader" note asks
for.

1075 host tests (1069 on the base). Prose corrected where this makes it false: `plex/session.rs`'s
`Account` doc, and `docs/parity-gaps.md`'s now-closed chip entry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* sources: an address you can type, and a seam for whoever dials it

**This commit contradicts a recorded OWNER RULING and is separated from the one before it for that
reason.** `docs/shared-servers.md` §12, dated 2026-08-21, quotes the owner — *"Servers are
configured on a PC or phone. On the television we only CHOOSE from the available servers"* — and
states the consequence: "There is no add-a-server-by-address on the television, and there will not
be." The ruling is left STANDING and annotated rather than rewritten; an agent may not overturn it.
Dropping this commit leaves the one before it building and green, which is the point of the split.

The case that argued for reopening it is `docs/lg-self-checklist.md` #20/#43/#47: a QA bench not on
the same IPv4 LAN as a plaintext-HTTP PMS dead-ends at "no server found", and the app had no surface
anywhere that could be typed an address. That is a question about a REVIEWER being unable to
evaluate the app at all, which is not the question the ruling answered — it may or may not move it.

**No new `Route` and no screen.** It is two rows in the tail of the popover that already exists,
beside "Check for new shares", which is the other answer to "my server is missing" — putting them
side by side is the point. Closed it is one row; open it is the field plus its action row, and the
COUNT holds still because a popover's height is measured from its rows and a sub-line appearing as
you type would resize the panel under the cursor. `Tail::Recheck` becomes `Tail::Panel(&Add)`,
carrying the field's state, so `ui/onboard.rs`'s `Tail::None` call site — which has no field and
never will — did not have to learn about a state it cannot reach.

The row model, the parse and every read-out are pure and tested that way. `ui/library.rs` is the
wiring; `app.rs` gains a `Route::Library` key guard mirroring the `Route::Search` one already there,
because the television's keyboard has no caret and delegates its delete and Clear-all to the app as
ordinary key syms.

**The seam.** The panel's job ends at a validated `Endpoint`. Dialling it, checking `/identity`,
merging by `machineIdentifier` and registering is worker-thread work with a socket in it and is not
here: the two halves meet at `take_request()` and `report(id, ok)` and nothing else. Nothing takes
the request today, so the field ages out after 20s saying nothing answered — literally true of a
request nobody picked up, and the right read-out once somebody does and the address is wrong.

**A one-source failure now KEEPS the Source chip.** That toolbar row used to empty completely, which
was defensible only while the panel had nothing to offer a user with one server. It was the single
state in the app where somebody whose only server cannot be dialled had nowhere to type one — the
exact dead end this exists to remove. The design's rule is untouched where it argued about a WORKING
library: one source, nothing wrong, still no chip.

Five findings from `/code-review high`, all fixed and each with a test:

- **A panic that killed the app.** `has_prefix_ci` byte-sliced the typed text, and the field
  re-parses on EVERY keystroke to state the port — so a hostname in Cyrillic or Japanese whose 7th
  or 8th byte falls mid-codepoint panicked out of the SDL event loop. `str::get(..n)` now, and the
  simulator survives "привет" with the app still running.
- **The keyboard wedge Search is explicitly defended against.** An app-switch left
  `textinput::STARTED` true and `start()` early-returns on it, so the panel never rose again.
  `app.rs`'s background arm now calls `library::leave_keyboard()` beside `search::leave()` — keeping
  what was typed, because an app switch is the OS moving the screen, not the user abandoning it.
- **The tail vanished on an empty list.** It hung off the last GROUP, so a roster where nothing has
  libraries yet drew neither way out, in precisely the state both rows exist for. It is its own
  headerless section now, with no separator drawn over nothing.
- **The mailboxes had no request identity**, so a late answer for an attempt the user had already
  replaced would land on the new address. They carry a `ReqId` and a mismatched verdict is dropped.
- **`::32400` parsed as a machine NAME** and lit Connect, because the host whitelist allowed `:`
  unconditionally. A multi-colon host is shape-checked as an IPv6 literal instead.

1088 host tests (1075 on the commit before it). Prose corrected where this makes it false:
`ui/consts.rs`'s two "only the Search screen reads these" claims and `docs/distribution.md` §7.
`docs/lg-self-checklist.md` carries the same false sentence and is the integrator's file — the
replacement wording is in the PR body rather than in this diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* Revert "sources: an address you can type, and a seam for whoever dials it"

This reverts commit b61ce64.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 27, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble
is the reason this file exists: every item must be Pass or N/A, and marking one
Pass when it should be N/A — or vice versa — is a stated rejection ground. So
"we never tested it" is not a markable state, which makes the UNTESTED column
matter as much as the failing one. Eleven items sit there today.

Four fail outright, and three of those are one root cause: `stream.rs::http_open`
builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only —
which takes out #20, #43 and #47 together the moment a QA bench is not on the same
LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is
undefined for a sideloaded app.

§4 records the four items that moved on 2026-08-22 and why they are worth reading
together: every one was found by LOOKING AT THE PANEL, and not one was visible in
a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the
television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes
instead of the native scancodes the app actually receives; a splash 63% black
against LG's "should not be black"; and `requiredMemory` asking for less headroom
than declaring nothing would have.

§5 records the two items that are DECISIONS rather than defects — no on-screen
transport button row, and English-only — because a future reader of the checklist
will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX
scenario for movement details") is what makes the UX scenario document, not code,
the place that answer belongs.

§7 names the defect class rather than the bug: the music note was the visible tip
of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai
titles and subtitles, hits the same two items, and nothing in the host suite can
see.

Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 27, 2026
…ther family (#51)

`http_open` built a `sockaddr_in` by hand from four decimal octets. That is not a
degraded transport for a hostname or an IPv6 server — it is no transport at all, which
is why `plex::probe` ranks a `plex.direct` name BELOW the dotted quad behind it and why
`auth::dial_target` refuses every candidate that is not an IPv4 literal. LG App Self
Checklist #43 CASE2 (IPv6) fails on this line.

`resolve()` now calls `getaddrinfo` with AF_UNSPEC + SOCK_STREAM, so the family and the
ORDER are the system's own destination-address policy (RFC 6724) rather than something
this file picks. The flag split is a correctness fix, not an optimisation: a LITERAL
takes AI_NUMERICHOST, because AI_ADDRCONFIG suppresses AF_INET6 results on a host whose
only IPv6 address is loopback — so `getaddrinfo("::1", …, AI_ADDRCONFIG)` legitimately
resolves to NOTHING on a healthy machine. It also keeps the existing dotted-quad path
free: no NSS module loaded, no packet sent, so the per-seek AVIO reopen costs what the
hand parse did. A NAME takes AI_ADDRCONFIG, which is what that flag is for.

The node handed to the resolver is UNBRACKETED and the `Host:` header is BRACKETED —
`getaddrinfo("[::1]", …)` is EAI_NONAME, while brackets are URI-authority grammar
(RFC 3986 §3.2.2 → RFC 9110 §7.2). `resolver_node` strips and `host_header` re-adds, one
function apart so the asymmetry is visible rather than remembered.

`Host:` is built from the ORIGIN, never the address dialled. That was correct only while
the input WAS an address; sending the numeric one now would break name-based virtual
hosting, invisibly, since the TCP session is identical either way.

`connect_any` walks the WHOLE chain. Trying only the first address is the old
single-address limit wearing a resolver. Both of this file's invariants are
re-established per attempt, not just the first: the fd is published into its atomic
BEFORE connect, and every failed attempt is retired through `close_owned`, never a bare
close.

CONNECT_TIMEOUT_MS 2000 → 8000, as the budget for the whole chain rather than per
address, so the worst-case main-loop block is one number however many addresses came
back. Deliberately NOT derived from the address: RFC1918 is not "local" in Plex's sense,
and probe order is `plex::probe`'s policy. The constant's doc says plainly who pays for
the raise today — no caller hands this module a name yet — so the trade-off is on the
record rather than aspirational.

`HttpStream` gains an `interrupted` latch. Resolving gave the open something it never
had: a NEXT thing to try after a failed connect. A handshake aborted by `shutdown(2)`
and an address that is simply dead are the same value at connect's return, so without
the latch a teardown fired during attempt 1 of 2 is answered by OPENING attempt 2 — the
interrupt consumed, a fresh connection handed to a caller being torn down. Set by
`http_shutdown` unconditionally (including with the fd already -1, which is the
between-attempts window), cleared by `reset_fields`, read on both sides of the walk.

Chunked detection was `find_ci(hdr, b"\r\ntransfer-encoding: chunked")` — one exact
spelling. `Transfer-Encoding:chunked` (OWS after the colon is optional), `Chunked`,
`gzip, chunked` and a list split across two lines all missed, and a miss is not a
failure: the body is then read as close-delimited with the chunk-size lines left INLINE
in it. Now a real list parse.

Two bugs review caught that the host suite could not, both green on Darwin first:

  - The port range check was left to AI_NUMERICSERV, and glibc does not do one — it
    parses with strtoul, checks nothing, and returns htons(70000) = port 4464. The
    assertion passed here and would have gone RED on CI's ubuntu-latest, with the
    truncation still live on the television. Now range-checked in `resolve` itself, in
    Rust, which is the only version true on both platforms.
  - The fd-leak test was sending `999.1.2.3` to the real resolver as a NAME. On a network
    with NXDOMAIN hijacking that resolves to a real web server and the open SUCCEEDS; on
    one with a dead resolver it burns glibc's whole timeout budget inside a suite
    documented as offline and ~0.3 s. Replaced with an out-of-range port — the same early
    exit, and it cannot leave the machine.

989 host tests (976 before), clippy gate clean, `--no-default-features` clean, and the
simulator still reaches Home against a real PMS over plain IPv4.

Host-proven; what still needs a television — chiefly whether glibc's NSS machinery works
inside the app's jail, which LG's c-ares-linked libcurl is NOT evidence for — is in the
PR body.


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
…second (#43 CASE1, partial) (#57)

* quality: a ceiling is a ROUTING policy first, a transcoder parameter second

LG App Self Checklist #43 CASE1 asks that the picture follow the link. The
obvious implementation — a bitrate field on `TranscodeSpec` — does nothing for
exactly the file it exists for, and this deliberately is not that.

`build_stream` picks direct play → remux → re-encode BEFORE a spec exists, and
only the re-encode branch's query has ever carried `maxVideoBitrate`. Direct
play streams the file's own bytes with no encoder anywhere to read a cap; a
remux copies the codecs and sends no cap by design, because a cap is what would
force the re-encode it exists to avoid. So a 30 Mbit/s source on a 4 Mbit/s
link direct-plays straight past any number on the spec.

So a rung is spent the way `link_policy` spends the relay tier: deny the two
flavors that ship the file at its own rate, leaving the one whose whole point is
that the server picks the rate. Only then does the number reach the wire.

  route::Quality        Auto + 5 rungs, each pairing a rate with the frame it
                        makes sense at; each sits under one of the checklist's
                        own legs (512 Kbps / 1 Mbps / 7 Mbps / 17.5 Mbps).
  route::quality_policy returns the same two flags `link_policy` does.
  route::flavors_allowed composes the two — the stricter always wins, per
                        flavor. A relay cannot be loosened by a high rung.
  plex::Ceiling         the parameter half; `None` (Auto) resolves to the
                        native-4K literals this query has always sent.

An unmeasured source fails CLOSED, which is the opposite of
`video_direct_plays`'s unknown-passes rule and deliberately so: a device bound
is a capability, a user ceiling is an instruction. The ceiling is captured per
PLAYBACK (`Session::cur_ceiling`), like `cur_remux` beside it, so a seek or a
track switch rebuilds the identical query rather than reshaping the encode
mid-film.

The picker is a second section of the player's existing `…` popover — leading
checkmarks for the ladder, the trailing On/Off word for the switch above it, no
full-screen sheet (docs/parity-gaps.md's standing decision). Its panel could
hold 320px while this menu had one row; the ladder needs the room that is
actually there.

Six host tests are the gate, and they grade the expression `build_stream`
evaluates rather than a re-derivation of it: Auto changes nothing on any source
or link; under-ceiling content stays direct-play eligible; over-ceiling loses
direct play; over-ceiling loses the remux too; the re-encode query carries the
cap (and Auto's stays byte-identical); relay and rung compose to the stricter.

`plex/CLAUDE.md` said `TranscodeSpec` "must not grow" a bitrate field, which
was right about a LINK ceiling and wrong as a general rule — corrected there,
with the ORDER (flavour first, number second) kept as the rule that survives.

Mid-session adaptive switching is NOT here and #43 CASE1 is NOT closed by this.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: the review's two routing holes, and a picker that did nothing where it lives

`/code-review` found eight, and the two that mattered were both about the
ceiling being remembered in the wrong places.

**A direct play forgot the rung.** `plan.ceiling` was set only on the transcode
branch, after the direct-play `return`, so `cur_ceiling` stayed `None` for every
direct play — and `retranscode` reaches a direct-play session (an audio-track
switch, a subtitle burn; `player/pump.rs` says so in as many words) and spends
`cur_ceiling` on the encode it then starts. Picking "480p · 720 kbps", playing a
small file that direct-plays, then switching audio re-encoded at 4K/60 Mbps: the
rung silently discarded on the one path where an encoder was actually running.
It is now set on every plan, inert where it means nothing.

**Every TV episode measured as unmeasured.** `src_kbps` matched
`metadata::current()` on ratingKey alone, but pressing Play on a show page
resolves the EPISODE's rk against a Detail holding the SHOW's — so the match
never landed, `Ceiling::admits` failed closed, and with any rung selected every
episode in the library lost direct play while `playback_preview`, reading that
same Detail's numbers directly, still promised Direct Play for it. Two answers
to one question, which is the mismatch that preview exists to prevent.
`detail_describes` now accepts the on-deck episode's key too — the leaf whose
technicals `fetch_item_streams` backfilled into the show, and the leaf
`playback_preview` already answers for.

**And the picker did nothing in the only place it can be reached.** The ladder
lives in the player's `…` menu; a rung that bound only future plays meant
pressing BACK and replaying to see any effect, with nothing on screen saying so.
`set_quality` now re-asks the routing question for the item on screen, against
the numbers that resolve measured (`Session::cur_src`), and reloads only when
the answer changed — a higher rung than the picture already satisfies does
nothing. It goes through `request_transcode_refresh`, the identical path a
subtitle-burn change takes, gated in the pump on a session that is actually
Playing. User-initiated, not adaptive: nothing measures a link.

Five smaller ones, all real:
  - `ptr::write` into the now-owned `static mut ROWS: Vec<Action>` leaked the
    previous row list on every `…` press. It is an assignment now.
  - the new panel-height cap was 4px UNDER the content — derived from 560 of
    content, forgetting 40 of padding — so the last rung was clipped until you
    scrolled. Same symptom as the 320 it replaced, one row deep instead of five.
  - every rung's comment claimed to sit "under" a checklist leg it is
    numerically ABOVE. A rung is a CONTENT rate and a leg is a LINK rate; there
    is a table now, and it says out loud that the 512 Kbit/s leg is below this
    ladder's floor.
  - `admits` judged a whole-file bitrate against a cap that ships as
    `maxVideoBitrate`, so each rung bit one AC-3 track early. It reads the video
    stream's own rate where PMS gave one, whole-file as the fallback.
  - `link_policy`'s doc still asserted the rule this work repealed — the third
    copy of that claim, and the one the first commit missed.

Two new host tests pin the two MEDIUM findings; the six routing gates are
unchanged. 984 pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: one assignment of plan.ceiling, not two

The review fix set it for every flavour at the decision site, which left the
transcode branch's original assignment as a duplicate of a value that could not
have changed between the two lines. The comment stays, pointed at where the
assignment actually is.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the three parity-gaps rows this quality work made false

`docs/parity-gaps.md` is a gap CATALOG, so a landed gap left standing reads as
work still to do — and two of these three rows describe exactly what PR #57
built, which is the sort of claim that stays false for months here (the `ar`
claim and the `stream.rs` chunked claim both did).

  - "There is no Quality picker anywhere in the app" — there is. Annotated with
    what landed DIFFERENTLY from the row's own prescription (a section of the
    existing `…` popover, not a new `ui/quality_menu.rs` + a fifth
    `Overlay::Quality`) and with the half it did not anticipate at all: a rung
    is a ROUTING policy before it is a parameter.
  - "TranscodeSpec cannot express any other [target]" — it carries `ceiling`,
    and Auto resolves to those two literals byte for byte. Its *Where* said the
    remux branch should be "only taken at Original", which got sharper rather
    than simpler: a remux is refused for a source the rung cannot carry, and a
    small file under a low rung still remuxes.
  - "The source bitrate, width/height and videoResolution are not in the data
    model" — HALF true now. `Detail` has all three; `PlayingItem` has none, and
    that is the live residual, not a cosmetic one: an episode reached from a
    season list or Up Next measures 0 and fails closed.

Each keeps its *Where* and *Device* notes intact — they are still the map for
the half that is open.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the FOUR remaining copies of "TranscodeSpec has no bitrate field"

The first commit corrected three (`plex/CLAUDE.md`, `link_policy`'s doc,
`TranscodeSpec`'s own). A grep for the claim found four more, in three files —
which is the shape this repo keeps losing to: one sentence, copied into every
place that had to reason about it, then falsified in one edit.

  - parity-gaps.md's TOP-LEVEL summary ("G. Quality is one hard-coded rung"),
    which is the copy most likely to be read. It now also says out loud that
    every duplicate of the row further down the file is historical, so the four
    per-client audit sections do not each need their own annotation.
  - shared-servers.md's step-9 row and its relay-policy bullet. Both are ABOUT
    the relay, where nothing changed — the relay still names no rate — so they
    are corrected in place rather than rewritten: the branch-not-a-parameter
    argument survives, minus the premise that has stopped being true.
  - pms-api.md's Dolby Vision measurement, which quotes the re-encode query
    verbatim. Those two values are still exactly what Auto sends, so the
    measurement stands; the clause now says which configuration produced it.

Prose only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the doc-claim-auditor's eight, including two the code itself contradicted

Ran `doc-claim-auditor` over the diff. Eight contradictions across 71 tracked
markdown files and 110 Rust files; three I had already fixed while it ran. The
five that were left, plus its one nit:

**Two were MY OWN prose, wrong about my own code.**
  - `plex/CLAUDE.md` said a `Ceiling` reaches `transcode_query` only once both
    fast flavours are denied. It reaches it on EVERY spec, remux included —
    what reaches the WIRE only after a refusal is a rate. `params.rs` says the
    opposite two files away, and `transcoder`'s test builds exactly the spec
    the sentence claimed cannot exist. Corrected, and the remux branch's
    silence is now named as an invariant a test pins rather than a `None`
    anyone may rely on.
  - `app.rs`'s new call-site comment still said a rung "lands on the next
    resolve", which the second commit inverted. It was the only line left
    saying so, and it sat at the call site.

**Two were prose the change falsified elsewhere.**
  - `route::Preview`'s doc enumerates the gates `build_stream` applies and said
    THREE. There are four; the ceiling is the one a reader debugging "why does
    this ordinary h264/AC-3 MKV say Converts" would never think of.
  - `metadata.rs`'s technical-record block said it was "read by nothing else"
    than `ui::tracks_panel`. `route::source_kbps` reads `video.bitrate` from it
    now, so dropping the backfill would move every rung's threshold with a
    green suite.

**And two status records that decide what someone does next.**
  - `ui/CLAUDE.md`'s module table: "a menu with one row", and it named
    `Row::checked` for the row that draws `Row::toggle` — already inverted
    before this change, and now actively misleading, because `Row::checked` is
    what the Quality rungs in that same menu use. The table now carries the
    rule instead of one side of it.
  - `docs/lg-self-checklist.md` #43 CASE1: "one direct-play-vs-transcode
    decision at start, held for the session". A user can change it mid-film
    now; a measurement still cannot, which is why the item still FAILS — the
    verdict is unchanged and the reason is narrower.

Plus the six remaining `parity-gaps.md` quality rows the earlier pass missed
(the file repeats this gap once per reference-client audit), each struck to
"the gap it WAS" with the half that is still open kept: no badge, no PERSISTED
preference store, no force-direct-play, no disable-remux.

`params.rs`'s "asserted in `transcoder`'s tests" was half right — that suite
pins the ceiling is inert on a remux; `route`'s gates 2 and 4 pin the other
half. Both are named now.

Prose only; 984 tests unchanged.

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 a proxy that can be slow (#59)

* tests: the resolution matrix LG asks for, a clip that is meant to end, and a proxy that can be slow

Three checklist items were unanswerable for three different reasons, and none of
them was a defect in the app.

**#50/#51 — resolution x codec.** The item is graded as a MATRIX and this repo
could only answer it as "pieces are covered": every pipeline fixture was 1080p
except one 4K HEVC, so SD and HD had never been played AT ALL, and 4K H.264
existed in neither pack — which is a fact about the maintainer's library (every
4K item there is HEVC or AV1) rather than about the player. Six new generated
clips complete the grid: SD 720x480 / HD 1280x720 / FHD 1920x1080 / UHD 3840x2160
x {h264, hevc}, with ONE audio codec per column so a row-to-row difference is the
raster and nothing else. Each of the eight cells now grades `expect.video_size`,
an EXACT WxH out of the `ff:` line, because `min_video_width` cannot tell 720x480
from 720x576 and a matrix answered with "at least 1900 wide" is the answer the
item is asking us to stop giving.

Four decisions in the matrix look arbitrary and are argued where they live
(`PIPE_SHAPES`' block comment): square pixels at 720x480 (an anamorphic fixture
would grade PAR handling, an axis with no assertion behind it anywhere here);
CRF held constant is constant QUALITY, not bitrate, so 4K H.264 is crf 26 and not
its 1080p sibling's 20 — the same CRF measures ~30 Mbit/s up there, a
quarter-gigabyte clip in service of no assertion; SDR 8-bit throughout, which
makes the UHD/HEVC cell the odd one out because it is the existing HDR10 fixture,
already device-verified; and E-AC-3 down the HEVC column, which is also the
better false-PASS defence, since `engine`'s `_ =>` arm can only ever produce
"AC3".

**#46 — replay after completion.** Its FIRST half now runs: `pipe_finish_eos`
plays a deliberately short 20 s clip to its end and asserts `EOS reached ...
-> ended` followed by `stop_bufferfeed: torn down`, in that order. Ordered
because every stop tears the engine down — the harness's own close included — and
searched forward from the EOS rather than compared against the first teardown in
the log, because `teardown` writes the same line for a `for_reload` stop, which
would fail the case for its whole cap with the evidence reading "the player froze
on the last frame". This is the only case in either tier that is SUPPOSED to run
out, so it gets its own fixture that nothing else may name (everything else is
sized so it cannot hit EOF mid-window, trap 9's second half), and
`_resolve_fixtures` grew the opposite duration bound: it SKIPS when the clip is
longer than 0.6x the cap, so a `--secs`-regenerated pack skips rather than failing
as a frozen player.

The SECOND half — starting the same content again — is NOT closed, and it is an
app gap rather than a test gap. `plxnative-playurl` is read behind `app.rs`'s
one-shot `auto_tried` latch, so a boot gets exactly one playback; on EOS
`finish_playback` -> `exit_player` leaves the player, and with no Plex session
there is no detail page, no Play control and no key path back in. The manifest
case carries a `_replay_note` naming the small app-side change that would close
it (`engine::start_bufferfeed` already re-reads `dev::playurl()` whenever
`route::url()` is empty), and `docs/lg-self-checklist.md` still marks the replay
half untested.

**#43 CASE1 and #14 — `tools/netcond.py` gains `rate:<kbps>`.** The proxy could
make the server dead in four ways and slow in none, so CASE1's own legs (512 Kbps
-> 1 Mbps -> 7 Mbps -> 17.5 Mbps) could not be PRODUCED and #14's degrading link
was anecdote. One token bucket for the whole proxy, because `rate:` names a link
and a link is shared; decimal kilobits, because that is the unit the item states
its legs in; empty at the start, because a full bucket hands the first
quarter-second a free burst and that is most of a short transfer; live under an
open connection, so one scripted run covers all four legs instead of four
launches. Measured through the real proxy: 512 -> 496 kbps, 2000 -> 2000,
17500 -> 17518.

Two pre-existing bugs surfaced in the code it touches, both fixed:

* **The mode SCOPE was honoured only at accept.** `serve_conn` consulted the
  scope-aware `applies()` and then handed `relay` a bare `Mode.split`, which
  discards it — so `stall@/:/timeline` really froze every open connection
  including the media stream, i.e. the exact opposite of what the scope exists
  for. Both docs claimed the working behaviour. `relay` now takes the
  connection's own first bytes.
* **The read poll's socket timeout was also the other direction's WRITE
  timeout.** Both relay threads share one pair of sockets, so `src.settimeout(0.5)`
  set the timeout on the other thread's `dst`; `sendall` on a timed-out socket
  raises having written an unspecified number of bytes, the `except OSError`
  swallowed it, and the stream truncated silently — reachable in exactly the
  situation the proxy exists to measure. The poll moved to `select` and both
  sockets are put back to blocking before relaying.

`--selftest` proves the shaper against a loopback transfer with no television in
the room, in its own temp control file so it cannot release the mode under a live
experiment.

**What this costs and what it does not prove.** The pipeline pack goes from ~0.4
to ~0.7 GB (the 4K H.264 clip is 93 MB of that) and from 8 clips to 15; resolution
is a property of the media, so a matrix cell cannot be a second case on an
existing file. Everything here is generated, so what none of it reaches is a PMS
DECISION on any of these shapes — `library_gaps` says so per entry. While
correcting those entries: `8-bit-hevc` was ALREADY covered by
`pipe_hevc_aac_mp4` (no `hdr` key, so Main / yuv420p) and the gap list had not
caught up; only `4k-h264` is newly closed.

Host-verified only — this lane has no television. `make check` is green (976 Rust
+ 47 harness tests, the harness suite now including the netcond shaper against
real loopback sockets), every fixture verifies under `make_fixtures.py`'s own
ffprobe checks, and `serve_fixtures.py` answers 206/416 with a byte-exact tail
for each new clip. The device run is the integrator's; the recipe is in the PR.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the which-tier skill still said the synthetic tier was twelve cases

It is 19 as of this branch, and the number in that sentence was going to rot
again — the same way the host test count in CLAUDE.md rotted three times — so it
now points at `./tests/run.py --list` instead of restating a census.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: five sentences this branch made false, one of them mine twice over

`doc-claim-auditor` over the branch. All five are contradictions, not omissions.

**The one that matters, because it is the skill whose whole subject is this
error.** `which-tier` opens by warning against "reading a bare `./tests/run.py`
as the suite it used to be" — and its pasteable `sh` block still said **12
synthetic cases**. Worse, 8ede10e fixed the identical number in that file's
PROSE two paragraphs above and left the two copies in the code block, i.e. the
half a reader copies. The file contradicted itself inside one commit. Both counts
are gone; the block now points at `--list`, which it already named two lines down,
and says why a second copy of the number does not survive here.

**`tests/fixtures/README.md` listed two gaps as unbuilt that this script builds.**
Its `library_gaps` summary still named `8-bit HEVC` and `4K H.264` — while
`manifest.json`, rewritten in the same commit, says 4K H.264 is closed by
`pipe_res_h264_uhd` and 8-bit HEVC has been covered since `pipe_hevc_aac_mp4`
landed (no `hdr` key, so `-profile:v main` / yuv420p). A reader of that page goes
off to author media that already exists. Both cut, with what a generated clip
still cannot close said plainly: a PMS DECISION on such an item.

Same sentence, pre-existing and one word: it named **`plxnative-url`** as the
trigger these are fed through. `tests/README.md` says the opposite and is right —
`plxnative-playurl` is the one carrying the DECLARATION, and several remaining
gaps (HLG, HDR10+) are *about* what the payload declares.

**Trap 9 was falsified by this branch's own fixture, 260 lines below it.** "Nothing
is ever shorter than 60 s" is now false: `pipe_h264_ac3_short` is 20 s because
ENDING is what it grades, and `_resolve_fixtures` enforces the opposite bound for
it. The new shape's comment cited "trap 9's second half" as the rule it breaks;
trap 9 itself was never told, and neither was `PIPE_SHAPES`' header, which still
said the only length constraint left was "do not hit EOF". Both now carry both
bounds, and say that adding a second short clip means picking a side.

**`_probe_fixture`'s "three of the twelve" was never right.** It is four fixtures
carrying two cases each, and it was four of twelve on `main` too — a count that
was wrong before the denominator moved. Replaced with the property (a seek case
beside its play case; an audio-lane pair), which is true at any number.

**`docs/lg-self-checklist.md` was dated the day before its own newest content** —
"Status taken 2026-08-22" above four entries that name 2026-08-23. Bumped, and the
line now says to bump it in the same edit as any row, since it is the only sentence
in that file nothing else restates.

Rejected and recorded so the next run does not re-derive them: the Makefile's
"~0.5s" harness-suite note (measured 1.22 s, hedged with a tilde AND an explicit
"measure before budgeting", subprocess count unchanged); `README.md:176`'s "two
gitignored files", false since 4f69d32 and not this branch's; and four notes
recording the 6974 ms reporter-join measurement taken while netcond's scope was
broken — they assert the park and the mechanism, not that the media stream kept
flowing, so none is contradicted. Two more (`async-model-decision.md:399`,
`ui/library.rs:171`) described scoping as working per-request and were FALSE until
this branch fixed `relay`; they are true again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* player: a finished stream can be started again, and #46 gets both halves

The replay half of LG App Self Checklist #46 was the one thing my last PR could
not reach from `tests/`, and the reason was six lines in `app.rs`: the synthetic
tier's only entry into the player is `plxnative-playurl`, read behind a one-shot
`auto_tried` latch, so a boot got exactly one playback. On EOS `finish_playback`
→ `exit_player` leaves the player, and with no Plex session there is no detail
page, no Play control and no key path back in.

Everything else was already in place, which is why the change is small:
`teardown` clears the URL and the `ended` flag on a real stop, and
`engine::start_bufferfeed` re-reads `dev::playurl()` whenever `route::url()` is
empty. So a replay is a second trip through the entry the boot already used.

**A COUNTER re-arming the latch, not a lifted latch.** `auto_tried` also guards
the `autoplay`+`playidx` arm, which does a `request_play_movie` +
`load_detail_now` — an unconditionally re-armable latch would re-fetch a catalog
item on every player exit and loop a REAL playback forever.
`/tmp/plxnative-replay[=N]` is bounded, opt-in, read once at boot (so no file
appearing mid-run can turn it into a loop), gated on `playurl` being armed, and
declines when `finish_playback` handed off to Up Next instead — an auto-advance
chain returns to the player, and that is exactly what the route check tells
apart. An absent file is 0, so every existing boot is byte-identical.
`dev::flag`/`dev::read` are `false`/`None` at COMPILE time without `devtriggers`,
so a release build has no replay arm at all; both feature sets type-check.

`replay_budget` is split out and host-tested for `note_global_press`'s reason one
step removed: the call site is inside the SDL event loop where no host test can
reach, and this half touches no SDL. It matters more than it looks, because every
value it can return is plausible and a misparse is invisible on the panel — 0
reads as "the replay arm is missing from this binary" and 2 reads as a loop.

**The two hazards in the lanes that landed in this file since I last read it are
both safe by construction, and I checked rather than assumed.** b6's
unconsumed-press invariant lives in `note_global_press`, and this change is
nowhere near key dispatch — it adds no press path and no global side effect. b7's
recorder cannot write a bogus record for a synthetic playback either:
`coldstart_place` answers `Route::Player` from `metadata::playing()`, which is
installed ONLY by `route::apply_plan` (the PMS decision path), so a URL-fed
session has no playing item and records nothing — before this change or after it.
A replay also re-enters on the next frame, so the 800 ms post-exit hub refresh
never fires between the two viewings.

**The case.** `pipe_replay_after_eos` plays the same 20 s clip, lets it end, and
starts it again. `expect.replays` is one statement, not two: the harness writes it
into the trigger AND `a_replayed` counts it, so the number the app is told cannot
drift from the number that is graded. Three signals, each worthless alone — the
`replay:` line exactly N times (counted, because more often than asked is a loop
and a loop satisfies everything else); at least N+1 `load:` lines, since
`start_bufferfeed` writes one per SESSION and `teardown` cleared the URL, so a
second line is what says the declaration was really re-read; and a media position
that FALLS and then climbs, which is the only thing separating a restart from a
session that carried on. `server_opens_min: 2` is the wire-side half no log line
can give: the second viewing has to fetch the clip again.

`_resolve_fixtures`' EOS bound becomes per VIEWING (`dur * (1 + replays)`), so a
`--secs`-regenerated pack skips this case instead of failing it as a missing
feature. `pipe_finish_eos` stays separate and grades the finish alone: "never
ends" and "ends and cannot be restarted" are different failures, and one case
would report either as the other.

**Two prose corrections this branch's netcond findings force, both about the same
sentence.** The root `CLAUDE.md` describes scoping — "`stall@/:/timeline` freezes
the progress reporter while video keeps streaming, which is what makes a clean
experiment possible" — as a working feature. It was FALSE for as long as it
existed, because `relay` took a scope-less `Mode.split`; it became true on
2026-08-23. Said so at the sentence rather than three sentences later.

And the **6974 ms** measurement cited beside it was taken under that broken
instrument, so the proxy was stalling every connection and not only the
reporter's. **The number and the conclusion both survive, and the mechanism is
worth recording rather than re-deriving:** it was logged as `THREADJOIN timeline
6974ms` — `task::join` emits one NAMED line per join, so the attribution came
from the instrument and not from inferring a total — and `timeline` is the only
join that COULD have parked whatever else was stalled, because `engine::teardown`
step 1 deliberately wakes the other two before joining them (`http_shutdown` on
the demux socket, `aq_abort` on both AU lanes) while the reporter's POST had no
such wake. Before and after were taken the same way, so the 14x is
apples-to-apples. What CANNOT be claimed from that session is that video kept
streaming while the reporter was frozen — a property of the tool today, not of
that run. Recorded in `CLAUDE.md`, `threads.rs` and `engine.rs`, all three of
which carried the number.

Host-verified: `make check` green — 1069 Rust tests (1066 on main + 3 new) and 51
harness tests — and `--no-default-features` type-checks. No television: the device
run is the integrator's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay count is a third exception to the early-exit rule, and says so

`stream_case`'s soundness note names exactly two ABSENCE checks that early exit
cannot see, and asks that a third be REASONED ABOUT rather than added. `a_replayed`
is a third of the same shape: it grades an EQUALITY (exactly N `replay:` lines,
because more than N is a loop), and an equality can pass at N and fail at N+1.

What it cannot see, stated rather than left to be discovered: an app replaying
forever fires its next `replay:` line only after another full viewing — ~20 s on
the short clip — while the case satisfies everything else at ~28 s, so an early
exit two seconds later stops before the evidence arrives.

Not closed by making this one case burn its whole 100 s cap. That is ~1.5 min on
every suite run to guard three lines whose bound is ALREADY gradeable by `make
check`: `replay_left` is decremented before each re-arm, and `replay_budget`'s
parsing has host tests. `--no-early` is how to go looking for a loop deliberately,
and the trade is worth re-taking only if that app-side bound moves.

Also: `docs/ux-scenario.md`'s #46 row pointed at the checklist "where it is listed
as untested", which stopped being true one commit ago. It now points at the case.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay assertion passed on a replay that never played, and three notes it made false

`/code-review` on the replay work, five findings, all mine, all fixed.

**The one that mattered: `a_replayed` was a false PASS in the ordering the field
will actually produce.** It measured the post-drop climb from the GLOBAL floor —
and a floor is a VALUE, so it only lands in viewing 2 when viewing 2 happens to
reach viewing 1's minimum. The `pos=` heartbeat is 1 Hz and free-running, so
viewing 1 logging `pos=0s` while viewing 2's first sample lands at `pos=1s` puts
the anchor back in viewing 1 and measures VIEWING 1'S OWN CLIMB. Reproduced
against the real function: `[0,5,10,19,1]` read as "fell 18s then climbed 19s" and
PASSED with the second viewing having produced one sample and zero seconds of
playback — defeating near-miss (e) in its own docstring, "restarted and then
stalled at the join".

Worse than a corner: the harness exits the moment every assertion passes, so that
is the state it would NORMALLY have graded. My own near-miss test passed only
because its series starts at 2 rather than 0 — exactly the accident a regression
test is for, and there is now one carrying the counterexample verbatim.

The climb is anchored at the index of the deepest DROP, which the loop computing
`drop` already had in hand.

Four more, each a sentence this branch itself made false:

* `a_finished`'s docstring still said the replay half "is unreachable from this
  tier today and it is an app gap, not a test gap … exactly one playback per boot
  and no key path back into the player" — contradicted by the `a_replayed` fifty
  lines below it, by `/tmp/plxnative-replay`, and by `pipe_replay_after_eos`, all
  added in the same change. It now points at them and says why the two cases stay
  apart.
* `_eof_note`, `make_fixtures.py` trap 9, the `pipe_h264_ac3_short` shape comment
  and `tests/README.md` all said `pipe_finish_eos` was the ONLY case allowed to
  reach EOF and the only one allowed to name that fixture. Two cases do both now.
  The rule was never "one case" anyway — it is "a case graded through a teardown
  has to have declared `reaches_eos`", which is what the unit test was deliberately
  loosened to, so the prose was the last thing still asserting the old form.
* `CLAUDE.md` and the `which-tier` skill both said "19 cases as of 2026-08-23".
  The manifest holds 20. **That count rotted inside the branch that wrote it, one
  commit after that same branch corrected the previous stale copy of it.** Both are
  now the pointer to `--list` rather than a fourth number waiting to go stale.
* `NetcondRate.setUp` leaked a `mkdtemp` per test — six `/tmp` directories per
  `make check`, on the command run most often. `addCleanup(shutil.rmtree)`, like
  every other temp use in that file. Verified: no new directories after a run.

`make check` green — 1069 Rust, 52 harness.

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
* sources: four states where there were two, and the chip stops calling a signed-in owner signed out

Two things the Sources panel and the shared top bar were saying wrongly. Neither depends on the
other; both are the words a surface uses about a fact it already had.

**The Sources panel renders all four `SourceState` variants, and the winning tier.** It drew a
two-state "Not reachable" off `SrcGroup::reachable()`, which is the only question a `bool` could
answer. The group header's accessory is now `[state] · [tier] · handle`, state FIRST — the accessory
is the last run on that line and elides from the right, so leading with the state means a
34-character plex.tv handle is what gives way rather than the fact that a server is not answering.

`Not authorized` is the point of the change. A 401 is a sharing-grant problem whose remedy is one
row down in the same panel — "Check for new shares" IS the `/api/v2/resources` refetch that reissues
the per-(user, server) token. Calling it "not reachable" sends the user to look at a router for
something no router was ever part of. `NotProbed` says nothing, and that is not an omission: a group
only reaches this list once its libraries have landed, so "nobody has dialled" there is a fact about
our own instrumentation, and stating it would put a warning on a working server.

Relay and Remote are spoken; Local is not. Relay is a ~2 Mbit/s tunnel the server transcodes down to
fit, which reads as a broken server unless something says why; Remote explains a slower first frame
and a transcode on a file that direct-plays at home; Local is what a server is expected to be, and
annotating every group with it is noise. A tier is only spoken for a group that WORKS — "Not
reachable · Relay · friend" reads as three problems where there is one.

The dim is a new question. `SrcGroup::reachable()` answers the old two-state one, in which
`Unauthorized` comes back `true` — not because it is browsable but because a `bool` had no way to
say otherwise. `usable()` is an exhaustive match, so a fifth state has to be given an answer rather
than inheriting one, and it still defers to `reachable()` for the three states that method gets
right. `browse.rs` needed no edit.

**And the profile chip.** It decided signed-in-ness from `current().title.is_empty()`, but an
account without Plex Home never gets a profile written at all — so that title is empty for a
signed-in owner, and the chip offered them "Sign in" while the menu behind it already headed itself
with their name and offered "Sign out". On a fresh single-user test account that is the first thing
a reviewer sees. `ui/account_menu.rs`'s module doc has recorded it since the menu was converted, and
named `ui/widgets.rs` as the fix site.

Fixed by moving the words rather than writing the same match a second time: `chip_label` is the one
resolver, it lives beside the rows it has to agree with, and the chip calls it. The avatar's initial
comes off the same name, so a chip reading "Gleb" can never carry somebody else's letter. `peek`,
not `load` — drawing a chip must never be able to WRITE the session file — and the read is inside
the generation-keyed cache, which is the shape `session::peek`'s own "no per-frame reader" note asks
for.

1075 host tests (1069 on the base). Prose corrected where this makes it false: `plex/session.rs`'s
`Account` doc, and `docs/parity-gaps.md`'s now-closed chip entry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* sources: an address you can type, and a seam for whoever dials it

**This commit contradicts a recorded OWNER RULING and is separated from the one before it for that
reason.** `docs/shared-servers.md` §12, dated 2026-08-21, quotes the owner — *"Servers are
configured on a PC or phone. On the television we only CHOOSE from the available servers"* — and
states the consequence: "There is no add-a-server-by-address on the television, and there will not
be." The ruling is left STANDING and annotated rather than rewritten; an agent may not overturn it.
Dropping this commit leaves the one before it building and green, which is the point of the split.

The case that argued for reopening it is `docs/lg-self-checklist.md` #20/#43/#47: a QA bench not on
the same IPv4 LAN as a plaintext-HTTP PMS dead-ends at "no server found", and the app had no surface
anywhere that could be typed an address. That is a question about a REVIEWER being unable to
evaluate the app at all, which is not the question the ruling answered — it may or may not move it.

**No new `Route` and no screen.** It is two rows in the tail of the popover that already exists,
beside "Check for new shares", which is the other answer to "my server is missing" — putting them
side by side is the point. Closed it is one row; open it is the field plus its action row, and the
COUNT holds still because a popover's height is measured from its rows and a sub-line appearing as
you type would resize the panel under the cursor. `Tail::Recheck` becomes `Tail::Panel(&Add)`,
carrying the field's state, so `ui/onboard.rs`'s `Tail::None` call site — which has no field and
never will — did not have to learn about a state it cannot reach.

The row model, the parse and every read-out are pure and tested that way. `ui/library.rs` is the
wiring; `app.rs` gains a `Route::Library` key guard mirroring the `Route::Search` one already there,
because the television's keyboard has no caret and delegates its delete and Clear-all to the app as
ordinary key syms.

**The seam.** The panel's job ends at a validated `Endpoint`. Dialling it, checking `/identity`,
merging by `machineIdentifier` and registering is worker-thread work with a socket in it and is not
here: the two halves meet at `take_request()` and `report(id, ok)` and nothing else. Nothing takes
the request today, so the field ages out after 20s saying nothing answered — literally true of a
request nobody picked up, and the right read-out once somebody does and the address is wrong.

**A one-source failure now KEEPS the Source chip.** That toolbar row used to empty completely, which
was defensible only while the panel had nothing to offer a user with one server. It was the single
state in the app where somebody whose only server cannot be dialled had nowhere to type one — the
exact dead end this exists to remove. The design's rule is untouched where it argued about a WORKING
library: one source, nothing wrong, still no chip.

Five findings from `/code-review high`, all fixed and each with a test:

- **A panic that killed the app.** `has_prefix_ci` byte-sliced the typed text, and the field
  re-parses on EVERY keystroke to state the port — so a hostname in Cyrillic or Japanese whose 7th
  or 8th byte falls mid-codepoint panicked out of the SDL event loop. `str::get(..n)` now, and the
  simulator survives "привет" with the app still running.
- **The keyboard wedge Search is explicitly defended against.** An app-switch left
  `textinput::STARTED` true and `start()` early-returns on it, so the panel never rose again.
  `app.rs`'s background arm now calls `library::leave_keyboard()` beside `search::leave()` — keeping
  what was typed, because an app switch is the OS moving the screen, not the user abandoning it.
- **The tail vanished on an empty list.** It hung off the last GROUP, so a roster where nothing has
  libraries yet drew neither way out, in precisely the state both rows exist for. It is its own
  headerless section now, with no separator drawn over nothing.
- **The mailboxes had no request identity**, so a late answer for an attempt the user had already
  replaced would land on the new address. They carry a `ReqId` and a mismatched verdict is dropped.
- **`::32400` parsed as a machine NAME** and lit Connect, because the host whitelist allowed `:`
  unconditionally. A multi-colon host is shape-checked as an IPv6 literal instead.

1088 host tests (1075 on the commit before it). Prose corrected where this makes it false:
`ui/consts.rs`'s two "only the Search screen reads these" claims and `docs/distribution.md` §7.
`docs/lg-self-checklist.md` carries the same false sentence and is the integrator's file — the
replacement wording is in the PR body rather than in this diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* Revert "sources: an address you can type, and a seam for whoever dials it"

This reverts commit d9513e523518ca362f9b92a797c9b762bebabbcc.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 28, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble
is the reason this file exists: every item must be Pass or N/A, and marking one
Pass when it should be N/A — or vice versa — is a stated rejection ground. So
"we never tested it" is not a markable state, which makes the UNTESTED column
matter as much as the failing one. Eleven items sit there today.

Four fail outright, and three of those are one root cause: `stream.rs::http_open`
builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only —
which takes out #20, #43 and #47 together the moment a QA bench is not on the same
LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is
undefined for a sideloaded app.

§4 records the four items that moved on 2026-08-22 and why they are worth reading
together: every one was found by LOOKING AT THE PANEL, and not one was visible in
a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the
television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes
instead of the native scancodes the app actually receives; a splash 63% black
against LG's "should not be black"; and `requiredMemory` asking for less headroom
than declaring nothing would have.

§5 records the two items that are DECISIONS rather than defects — no on-screen
transport button row, and English-only — because a future reader of the checklist
will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX
scenario for movement details") is what makes the UX scenario document, not code,
the place that answer belongs.

§7 names the defect class rather than the bug: the music note was the visible tip
of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai
titles and subtitles, hits the same two items, and nothing in the host suite can
see.

Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Aug 28, 2026
…ther family (#51)

`http_open` built a `sockaddr_in` by hand from four decimal octets. That is not a
degraded transport for a hostname or an IPv6 server — it is no transport at all, which
is why `plex::probe` ranks a `plex.direct` name BELOW the dotted quad behind it and why
`auth::dial_target` refuses every candidate that is not an IPv4 literal. LG App Self
Checklist #43 CASE2 (IPv6) fails on this line.

`resolve()` now calls `getaddrinfo` with AF_UNSPEC + SOCK_STREAM, so the family and the
ORDER are the system's own destination-address policy (RFC 6724) rather than something
this file picks. The flag split is a correctness fix, not an optimisation: a LITERAL
takes AI_NUMERICHOST, because AI_ADDRCONFIG suppresses AF_INET6 results on a host whose
only IPv6 address is loopback — so `getaddrinfo("::1", …, AI_ADDRCONFIG)` legitimately
resolves to NOTHING on a healthy machine. It also keeps the existing dotted-quad path
free: no NSS module loaded, no packet sent, so the per-seek AVIO reopen costs what the
hand parse did. A NAME takes AI_ADDRCONFIG, which is what that flag is for.

The node handed to the resolver is UNBRACKETED and the `Host:` header is BRACKETED —
`getaddrinfo("[::1]", …)` is EAI_NONAME, while brackets are URI-authority grammar
(RFC 3986 §3.2.2 → RFC 9110 §7.2). `resolver_node` strips and `host_header` re-adds, one
function apart so the asymmetry is visible rather than remembered.

`Host:` is built from the ORIGIN, never the address dialled. That was correct only while
the input WAS an address; sending the numeric one now would break name-based virtual
hosting, invisibly, since the TCP session is identical either way.

`connect_any` walks the WHOLE chain. Trying only the first address is the old
single-address limit wearing a resolver. Both of this file's invariants are
re-established per attempt, not just the first: the fd is published into its atomic
BEFORE connect, and every failed attempt is retired through `close_owned`, never a bare
close.

CONNECT_TIMEOUT_MS 2000 → 8000, as the budget for the whole chain rather than per
address, so the worst-case main-loop block is one number however many addresses came
back. Deliberately NOT derived from the address: RFC1918 is not "local" in Plex's sense,
and probe order is `plex::probe`'s policy. The constant's doc says plainly who pays for
the raise today — no caller hands this module a name yet — so the trade-off is on the
record rather than aspirational.

`HttpStream` gains an `interrupted` latch. Resolving gave the open something it never
had: a NEXT thing to try after a failed connect. A handshake aborted by `shutdown(2)`
and an address that is simply dead are the same value at connect's return, so without
the latch a teardown fired during attempt 1 of 2 is answered by OPENING attempt 2 — the
interrupt consumed, a fresh connection handed to a caller being torn down. Set by
`http_shutdown` unconditionally (including with the fd already -1, which is the
between-attempts window), cleared by `reset_fields`, read on both sides of the walk.

Chunked detection was `find_ci(hdr, b"\r\ntransfer-encoding: chunked")` — one exact
spelling. `Transfer-Encoding:chunked` (OWS after the colon is optional), `Chunked`,
`gzip, chunked` and a list split across two lines all missed, and a miss is not a
failure: the body is then read as close-delimited with the chunk-size lines left INLINE
in it. Now a real list parse.

Two bugs review caught that the host suite could not, both green on Darwin first:

  - The port range check was left to AI_NUMERICSERV, and glibc does not do one — it
    parses with strtoul, checks nothing, and returns htons(70000) = port 4464. The
    assertion passed here and would have gone RED on CI's ubuntu-latest, with the
    truncation still live on the television. Now range-checked in `resolve` itself, in
    Rust, which is the only version true on both platforms.
  - The fd-leak test was sending `999.1.2.3` to the real resolver as a NAME. On a network
    with NXDOMAIN hijacking that resolves to a real web server and the open SUCCEEDS; on
    one with a dead resolver it burns glibc's whole timeout budget inside a suite
    documented as offline and ~0.3 s. Replaced with an out-of-range port — the same early
    exit, and it cannot leave the machine.

989 host tests (976 before), clippy gate clean, `--no-default-features` clean, and the
simulator still reaches Home against a real PMS over plain IPv4.

Host-proven; what still needs a television — chiefly whether glibc's NSS machinery works
inside the app's jail, which LG's c-ares-linked libcurl is NOT evidence for — is in the
PR body.


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
…second (#43 CASE1, partial) (#57)

* quality: a ceiling is a ROUTING policy first, a transcoder parameter second

LG App Self Checklist #43 CASE1 asks that the picture follow the link. The
obvious implementation — a bitrate field on `TranscodeSpec` — does nothing for
exactly the file it exists for, and this deliberately is not that.

`build_stream` picks direct play → remux → re-encode BEFORE a spec exists, and
only the re-encode branch's query has ever carried `maxVideoBitrate`. Direct
play streams the file's own bytes with no encoder anywhere to read a cap; a
remux copies the codecs and sends no cap by design, because a cap is what would
force the re-encode it exists to avoid. So a 30 Mbit/s source on a 4 Mbit/s
link direct-plays straight past any number on the spec.

So a rung is spent the way `link_policy` spends the relay tier: deny the two
flavors that ship the file at its own rate, leaving the one whose whole point is
that the server picks the rate. Only then does the number reach the wire.

  route::Quality        Auto + 5 rungs, each pairing a rate with the frame it
                        makes sense at; each sits under one of the checklist's
                        own legs (512 Kbps / 1 Mbps / 7 Mbps / 17.5 Mbps).
  route::quality_policy returns the same two flags `link_policy` does.
  route::flavors_allowed composes the two — the stricter always wins, per
                        flavor. A relay cannot be loosened by a high rung.
  plex::Ceiling         the parameter half; `None` (Auto) resolves to the
                        native-4K literals this query has always sent.

An unmeasured source fails CLOSED, which is the opposite of
`video_direct_plays`'s unknown-passes rule and deliberately so: a device bound
is a capability, a user ceiling is an instruction. The ceiling is captured per
PLAYBACK (`Session::cur_ceiling`), like `cur_remux` beside it, so a seek or a
track switch rebuilds the identical query rather than reshaping the encode
mid-film.

The picker is a second section of the player's existing `…` popover — leading
checkmarks for the ladder, the trailing On/Off word for the switch above it, no
full-screen sheet (docs/parity-gaps.md's standing decision). Its panel could
hold 320px while this menu had one row; the ladder needs the room that is
actually there.

Six host tests are the gate, and they grade the expression `build_stream`
evaluates rather than a re-derivation of it: Auto changes nothing on any source
or link; under-ceiling content stays direct-play eligible; over-ceiling loses
direct play; over-ceiling loses the remux too; the re-encode query carries the
cap (and Auto's stays byte-identical); relay and rung compose to the stricter.

`plex/CLAUDE.md` said `TranscodeSpec` "must not grow" a bitrate field, which
was right about a LINK ceiling and wrong as a general rule — corrected there,
with the ORDER (flavour first, number second) kept as the rule that survives.

Mid-session adaptive switching is NOT here and #43 CASE1 is NOT closed by this.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: the review's two routing holes, and a picker that did nothing where it lives

`/code-review` found eight, and the two that mattered were both about the
ceiling being remembered in the wrong places.

**A direct play forgot the rung.** `plan.ceiling` was set only on the transcode
branch, after the direct-play `return`, so `cur_ceiling` stayed `None` for every
direct play — and `retranscode` reaches a direct-play session (an audio-track
switch, a subtitle burn; `player/pump.rs` says so in as many words) and spends
`cur_ceiling` on the encode it then starts. Picking "480p · 720 kbps", playing a
small file that direct-plays, then switching audio re-encoded at 4K/60 Mbps: the
rung silently discarded on the one path where an encoder was actually running.
It is now set on every plan, inert where it means nothing.

**Every TV episode measured as unmeasured.** `src_kbps` matched
`metadata::current()` on ratingKey alone, but pressing Play on a show page
resolves the EPISODE's rk against a Detail holding the SHOW's — so the match
never landed, `Ceiling::admits` failed closed, and with any rung selected every
episode in the library lost direct play while `playback_preview`, reading that
same Detail's numbers directly, still promised Direct Play for it. Two answers
to one question, which is the mismatch that preview exists to prevent.
`detail_describes` now accepts the on-deck episode's key too — the leaf whose
technicals `fetch_item_streams` backfilled into the show, and the leaf
`playback_preview` already answers for.

**And the picker did nothing in the only place it can be reached.** The ladder
lives in the player's `…` menu; a rung that bound only future plays meant
pressing BACK and replaying to see any effect, with nothing on screen saying so.
`set_quality` now re-asks the routing question for the item on screen, against
the numbers that resolve measured (`Session::cur_src`), and reloads only when
the answer changed — a higher rung than the picture already satisfies does
nothing. It goes through `request_transcode_refresh`, the identical path a
subtitle-burn change takes, gated in the pump on a session that is actually
Playing. User-initiated, not adaptive: nothing measures a link.

Five smaller ones, all real:
  - `ptr::write` into the now-owned `static mut ROWS: Vec<Action>` leaked the
    previous row list on every `…` press. It is an assignment now.
  - the new panel-height cap was 4px UNDER the content — derived from 560 of
    content, forgetting 40 of padding — so the last rung was clipped until you
    scrolled. Same symptom as the 320 it replaced, one row deep instead of five.
  - every rung's comment claimed to sit "under" a checklist leg it is
    numerically ABOVE. A rung is a CONTENT rate and a leg is a LINK rate; there
    is a table now, and it says out loud that the 512 Kbit/s leg is below this
    ladder's floor.
  - `admits` judged a whole-file bitrate against a cap that ships as
    `maxVideoBitrate`, so each rung bit one AC-3 track early. It reads the video
    stream's own rate where PMS gave one, whole-file as the fallback.
  - `link_policy`'s doc still asserted the rule this work repealed — the third
    copy of that claim, and the one the first commit missed.

Two new host tests pin the two MEDIUM findings; the six routing gates are
unchanged. 984 pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* quality: one assignment of plan.ceiling, not two

The review fix set it for every flavour at the decision site, which left the
transcode branch's original assignment as a duplicate of a value that could not
have changed between the two lines. The comment stays, pointed at where the
assignment actually is.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the three parity-gaps rows this quality work made false

`docs/parity-gaps.md` is a gap CATALOG, so a landed gap left standing reads as
work still to do — and two of these three rows describe exactly what PR #57
built, which is the sort of claim that stays false for months here (the `ar`
claim and the `stream.rs` chunked claim both did).

  - "There is no Quality picker anywhere in the app" — there is. Annotated with
    what landed DIFFERENTLY from the row's own prescription (a section of the
    existing `…` popover, not a new `ui/quality_menu.rs` + a fifth
    `Overlay::Quality`) and with the half it did not anticipate at all: a rung
    is a ROUTING policy before it is a parameter.
  - "TranscodeSpec cannot express any other [target]" — it carries `ceiling`,
    and Auto resolves to those two literals byte for byte. Its *Where* said the
    remux branch should be "only taken at Original", which got sharper rather
    than simpler: a remux is refused for a source the rung cannot carry, and a
    small file under a low rung still remuxes.
  - "The source bitrate, width/height and videoResolution are not in the data
    model" — HALF true now. `Detail` has all three; `PlayingItem` has none, and
    that is the live residual, not a cosmetic one: an episode reached from a
    season list or Up Next measures 0 and fails closed.

Each keeps its *Where* and *Device* notes intact — they are still the map for
the half that is open.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the FOUR remaining copies of "TranscodeSpec has no bitrate field"

The first commit corrected three (`plex/CLAUDE.md`, `link_policy`'s doc,
`TranscodeSpec`'s own). A grep for the claim found four more, in three files —
which is the shape this repo keeps losing to: one sentence, copied into every
place that had to reason about it, then falsified in one edit.

  - parity-gaps.md's TOP-LEVEL summary ("G. Quality is one hard-coded rung"),
    which is the copy most likely to be read. It now also says out loud that
    every duplicate of the row further down the file is historical, so the four
    per-client audit sections do not each need their own annotation.
  - shared-servers.md's step-9 row and its relay-policy bullet. Both are ABOUT
    the relay, where nothing changed — the relay still names no rate — so they
    are corrected in place rather than rewritten: the branch-not-a-parameter
    argument survives, minus the premise that has stopped being true.
  - pms-api.md's Dolby Vision measurement, which quotes the re-encode query
    verbatim. Those two values are still exactly what Auto sends, so the
    measurement stands; the clause now says which configuration produced it.

Prose only.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the doc-claim-auditor's eight, including two the code itself contradicted

Ran `doc-claim-auditor` over the diff. Eight contradictions across 71 tracked
markdown files and 110 Rust files; three I had already fixed while it ran. The
five that were left, plus its one nit:

**Two were MY OWN prose, wrong about my own code.**
  - `plex/CLAUDE.md` said a `Ceiling` reaches `transcode_query` only once both
    fast flavours are denied. It reaches it on EVERY spec, remux included —
    what reaches the WIRE only after a refusal is a rate. `params.rs` says the
    opposite two files away, and `transcoder`'s test builds exactly the spec
    the sentence claimed cannot exist. Corrected, and the remux branch's
    silence is now named as an invariant a test pins rather than a `None`
    anyone may rely on.
  - `app.rs`'s new call-site comment still said a rung "lands on the next
    resolve", which the second commit inverted. It was the only line left
    saying so, and it sat at the call site.

**Two were prose the change falsified elsewhere.**
  - `route::Preview`'s doc enumerates the gates `build_stream` applies and said
    THREE. There are four; the ceiling is the one a reader debugging "why does
    this ordinary h264/AC-3 MKV say Converts" would never think of.
  - `metadata.rs`'s technical-record block said it was "read by nothing else"
    than `ui::tracks_panel`. `route::source_kbps` reads `video.bitrate` from it
    now, so dropping the backfill would move every rung's threshold with a
    green suite.

**And two status records that decide what someone does next.**
  - `ui/CLAUDE.md`'s module table: "a menu with one row", and it named
    `Row::checked` for the row that draws `Row::toggle` — already inverted
    before this change, and now actively misleading, because `Row::checked` is
    what the Quality rungs in that same menu use. The table now carries the
    rule instead of one side of it.
  - `docs/lg-self-checklist.md` #43 CASE1: "one direct-play-vs-transcode
    decision at start, held for the session". A user can change it mid-film
    now; a measurement still cannot, which is why the item still FAILS — the
    verdict is unchanged and the reason is narrower.

Plus the six remaining `parity-gaps.md` quality rows the earlier pass missed
(the file repeats this gap once per reference-client audit), each struck to
"the gap it WAS" with the half that is still open kept: no badge, no PERSISTED
preference store, no force-direct-play, no disable-remux.

`params.rs`'s "asserted in `transcoder`'s tests" was half right — that suite
pins the ceiling is inert on a remux; `route`'s gates 2 and 4 pin the other
half. Both are named now.

Prose only; 984 tests unchanged.

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 a proxy that can be slow (#59)

* tests: the resolution matrix LG asks for, a clip that is meant to end, and a proxy that can be slow

Three checklist items were unanswerable for three different reasons, and none of
them was a defect in the app.

**#50/#51 — resolution x codec.** The item is graded as a MATRIX and this repo
could only answer it as "pieces are covered": every pipeline fixture was 1080p
except one 4K HEVC, so SD and HD had never been played AT ALL, and 4K H.264
existed in neither pack — which is a fact about the maintainer's library (every
4K item there is HEVC or AV1) rather than about the player. Six new generated
clips complete the grid: SD 720x480 / HD 1280x720 / FHD 1920x1080 / UHD 3840x2160
x {h264, hevc}, with ONE audio codec per column so a row-to-row difference is the
raster and nothing else. Each of the eight cells now grades `expect.video_size`,
an EXACT WxH out of the `ff:` line, because `min_video_width` cannot tell 720x480
from 720x576 and a matrix answered with "at least 1900 wide" is the answer the
item is asking us to stop giving.

Four decisions in the matrix look arbitrary and are argued where they live
(`PIPE_SHAPES`' block comment): square pixels at 720x480 (an anamorphic fixture
would grade PAR handling, an axis with no assertion behind it anywhere here);
CRF held constant is constant QUALITY, not bitrate, so 4K H.264 is crf 26 and not
its 1080p sibling's 20 — the same CRF measures ~30 Mbit/s up there, a
quarter-gigabyte clip in service of no assertion; SDR 8-bit throughout, which
makes the UHD/HEVC cell the odd one out because it is the existing HDR10 fixture,
already device-verified; and E-AC-3 down the HEVC column, which is also the
better false-PASS defence, since `engine`'s `_ =>` arm can only ever produce
"AC3".

**#46 — replay after completion.** Its FIRST half now runs: `pipe_finish_eos`
plays a deliberately short 20 s clip to its end and asserts `EOS reached ...
-> ended` followed by `stop_bufferfeed: torn down`, in that order. Ordered
because every stop tears the engine down — the harness's own close included — and
searched forward from the EOS rather than compared against the first teardown in
the log, because `teardown` writes the same line for a `for_reload` stop, which
would fail the case for its whole cap with the evidence reading "the player froze
on the last frame". This is the only case in either tier that is SUPPOSED to run
out, so it gets its own fixture that nothing else may name (everything else is
sized so it cannot hit EOF mid-window, trap 9's second half), and
`_resolve_fixtures` grew the opposite duration bound: it SKIPS when the clip is
longer than 0.6x the cap, so a `--secs`-regenerated pack skips rather than failing
as a frozen player.

The SECOND half — starting the same content again — is NOT closed, and it is an
app gap rather than a test gap. `plxnative-playurl` is read behind `app.rs`'s
one-shot `auto_tried` latch, so a boot gets exactly one playback; on EOS
`finish_playback` -> `exit_player` leaves the player, and with no Plex session
there is no detail page, no Play control and no key path back in. The manifest
case carries a `_replay_note` naming the small app-side change that would close
it (`engine::start_bufferfeed` already re-reads `dev::playurl()` whenever
`route::url()` is empty), and `docs/lg-self-checklist.md` still marks the replay
half untested.

**#43 CASE1 and #14 — `tools/netcond.py` gains `rate:<kbps>`.** The proxy could
make the server dead in four ways and slow in none, so CASE1's own legs (512 Kbps
-> 1 Mbps -> 7 Mbps -> 17.5 Mbps) could not be PRODUCED and #14's degrading link
was anecdote. One token bucket for the whole proxy, because `rate:` names a link
and a link is shared; decimal kilobits, because that is the unit the item states
its legs in; empty at the start, because a full bucket hands the first
quarter-second a free burst and that is most of a short transfer; live under an
open connection, so one scripted run covers all four legs instead of four
launches. Measured through the real proxy: 512 -> 496 kbps, 2000 -> 2000,
17500 -> 17518.

Two pre-existing bugs surfaced in the code it touches, both fixed:

* **The mode SCOPE was honoured only at accept.** `serve_conn` consulted the
  scope-aware `applies()` and then handed `relay` a bare `Mode.split`, which
  discards it — so `stall@/:/timeline` really froze every open connection
  including the media stream, i.e. the exact opposite of what the scope exists
  for. Both docs claimed the working behaviour. `relay` now takes the
  connection's own first bytes.
* **The read poll's socket timeout was also the other direction's WRITE
  timeout.** Both relay threads share one pair of sockets, so `src.settimeout(0.5)`
  set the timeout on the other thread's `dst`; `sendall` on a timed-out socket
  raises having written an unspecified number of bytes, the `except OSError`
  swallowed it, and the stream truncated silently — reachable in exactly the
  situation the proxy exists to measure. The poll moved to `select` and both
  sockets are put back to blocking before relaying.

`--selftest` proves the shaper against a loopback transfer with no television in
the room, in its own temp control file so it cannot release the mode under a live
experiment.

**What this costs and what it does not prove.** The pipeline pack goes from ~0.4
to ~0.7 GB (the 4K H.264 clip is 93 MB of that) and from 8 clips to 15; resolution
is a property of the media, so a matrix cell cannot be a second case on an
existing file. Everything here is generated, so what none of it reaches is a PMS
DECISION on any of these shapes — `library_gaps` says so per entry. While
correcting those entries: `8-bit-hevc` was ALREADY covered by
`pipe_hevc_aac_mp4` (no `hdr` key, so Main / yuv420p) and the gap list had not
caught up; only `4k-h264` is newly closed.

Host-verified only — this lane has no television. `make check` is green (976 Rust
+ 47 harness tests, the harness suite now including the netcond shaper against
real loopback sockets), every fixture verifies under `make_fixtures.py`'s own
ffprobe checks, and `serve_fixtures.py` answers 206/416 with a byte-exact tail
for each new clip. The device run is the integrator's; the recipe is in the PR.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: the which-tier skill still said the synthetic tier was twelve cases

It is 19 as of this branch, and the number in that sentence was going to rot
again — the same way the host test count in CLAUDE.md rotted three times — so it
now points at `./tests/run.py --list` instead of restating a census.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* docs: five sentences this branch made false, one of them mine twice over

`doc-claim-auditor` over the branch. All five are contradictions, not omissions.

**The one that matters, because it is the skill whose whole subject is this
error.** `which-tier` opens by warning against "reading a bare `./tests/run.py`
as the suite it used to be" — and its pasteable `sh` block still said **12
synthetic cases**. Worse, 8ede10e fixed the identical number in that file's
PROSE two paragraphs above and left the two copies in the code block, i.e. the
half a reader copies. The file contradicted itself inside one commit. Both counts
are gone; the block now points at `--list`, which it already named two lines down,
and says why a second copy of the number does not survive here.

**`tests/fixtures/README.md` listed two gaps as unbuilt that this script builds.**
Its `library_gaps` summary still named `8-bit HEVC` and `4K H.264` — while
`manifest.json`, rewritten in the same commit, says 4K H.264 is closed by
`pipe_res_h264_uhd` and 8-bit HEVC has been covered since `pipe_hevc_aac_mp4`
landed (no `hdr` key, so `-profile:v main` / yuv420p). A reader of that page goes
off to author media that already exists. Both cut, with what a generated clip
still cannot close said plainly: a PMS DECISION on such an item.

Same sentence, pre-existing and one word: it named **`plxnative-url`** as the
trigger these are fed through. `tests/README.md` says the opposite and is right —
`plxnative-playurl` is the one carrying the DECLARATION, and several remaining
gaps (HLG, HDR10+) are *about* what the payload declares.

**Trap 9 was falsified by this branch's own fixture, 260 lines below it.** "Nothing
is ever shorter than 60 s" is now false: `pipe_h264_ac3_short` is 20 s because
ENDING is what it grades, and `_resolve_fixtures` enforces the opposite bound for
it. The new shape's comment cited "trap 9's second half" as the rule it breaks;
trap 9 itself was never told, and neither was `PIPE_SHAPES`' header, which still
said the only length constraint left was "do not hit EOF". Both now carry both
bounds, and say that adding a second short clip means picking a side.

**`_probe_fixture`'s "three of the twelve" was never right.** It is four fixtures
carrying two cases each, and it was four of twelve on `main` too — a count that
was wrong before the denominator moved. Replaced with the property (a seek case
beside its play case; an audio-lane pair), which is true at any number.

**`docs/lg-self-checklist.md` was dated the day before its own newest content** —
"Status taken 2026-08-22" above four entries that name 2026-08-23. Bumped, and the
line now says to bump it in the same edit as any row, since it is the only sentence
in that file nothing else restates.

Rejected and recorded so the next run does not re-derive them: the Makefile's
"~0.5s" harness-suite note (measured 1.22 s, hedged with a tilde AND an explicit
"measure before budgeting", subprocess count unchanged); `README.md:176`'s "two
gitignored files", false since 8a5ac95 and not this branch's; and four notes
recording the 6974 ms reporter-join measurement taken while netcond's scope was
broken — they assert the park and the mechanism, not that the media stream kept
flowing, so none is contradicted. Two more (`async-model-decision.md:399`,
`ui/library.rs:171`) described scoping as working per-request and were FALSE until
this branch fixed `relay`; they are true again.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* player: a finished stream can be started again, and #46 gets both halves

The replay half of LG App Self Checklist #46 was the one thing my last PR could
not reach from `tests/`, and the reason was six lines in `app.rs`: the synthetic
tier's only entry into the player is `plxnative-playurl`, read behind a one-shot
`auto_tried` latch, so a boot got exactly one playback. On EOS `finish_playback`
→ `exit_player` leaves the player, and with no Plex session there is no detail
page, no Play control and no key path back in.

Everything else was already in place, which is why the change is small:
`teardown` clears the URL and the `ended` flag on a real stop, and
`engine::start_bufferfeed` re-reads `dev::playurl()` whenever `route::url()` is
empty. So a replay is a second trip through the entry the boot already used.

**A COUNTER re-arming the latch, not a lifted latch.** `auto_tried` also guards
the `autoplay`+`playidx` arm, which does a `request_play_movie` +
`load_detail_now` — an unconditionally re-armable latch would re-fetch a catalog
item on every player exit and loop a REAL playback forever.
`/tmp/plxnative-replay[=N]` is bounded, opt-in, read once at boot (so no file
appearing mid-run can turn it into a loop), gated on `playurl` being armed, and
declines when `finish_playback` handed off to Up Next instead — an auto-advance
chain returns to the player, and that is exactly what the route check tells
apart. An absent file is 0, so every existing boot is byte-identical.
`dev::flag`/`dev::read` are `false`/`None` at COMPILE time without `devtriggers`,
so a release build has no replay arm at all; both feature sets type-check.

`replay_budget` is split out and host-tested for `note_global_press`'s reason one
step removed: the call site is inside the SDL event loop where no host test can
reach, and this half touches no SDL. It matters more than it looks, because every
value it can return is plausible and a misparse is invisible on the panel — 0
reads as "the replay arm is missing from this binary" and 2 reads as a loop.

**The two hazards in the lanes that landed in this file since I last read it are
both safe by construction, and I checked rather than assumed.** b6's
unconsumed-press invariant lives in `note_global_press`, and this change is
nowhere near key dispatch — it adds no press path and no global side effect. b7's
recorder cannot write a bogus record for a synthetic playback either:
`coldstart_place` answers `Route::Player` from `metadata::playing()`, which is
installed ONLY by `route::apply_plan` (the PMS decision path), so a URL-fed
session has no playing item and records nothing — before this change or after it.
A replay also re-enters on the next frame, so the 800 ms post-exit hub refresh
never fires between the two viewings.

**The case.** `pipe_replay_after_eos` plays the same 20 s clip, lets it end, and
starts it again. `expect.replays` is one statement, not two: the harness writes it
into the trigger AND `a_replayed` counts it, so the number the app is told cannot
drift from the number that is graded. Three signals, each worthless alone — the
`replay:` line exactly N times (counted, because more often than asked is a loop
and a loop satisfies everything else); at least N+1 `load:` lines, since
`start_bufferfeed` writes one per SESSION and `teardown` cleared the URL, so a
second line is what says the declaration was really re-read; and a media position
that FALLS and then climbs, which is the only thing separating a restart from a
session that carried on. `server_opens_min: 2` is the wire-side half no log line
can give: the second viewing has to fetch the clip again.

`_resolve_fixtures`' EOS bound becomes per VIEWING (`dur * (1 + replays)`), so a
`--secs`-regenerated pack skips this case instead of failing it as a missing
feature. `pipe_finish_eos` stays separate and grades the finish alone: "never
ends" and "ends and cannot be restarted" are different failures, and one case
would report either as the other.

**Two prose corrections this branch's netcond findings force, both about the same
sentence.** The root `CLAUDE.md` describes scoping — "`stall@/:/timeline` freezes
the progress reporter while video keeps streaming, which is what makes a clean
experiment possible" — as a working feature. It was FALSE for as long as it
existed, because `relay` took a scope-less `Mode.split`; it became true on
2026-08-23. Said so at the sentence rather than three sentences later.

And the **6974 ms** measurement cited beside it was taken under that broken
instrument, so the proxy was stalling every connection and not only the
reporter's. **The number and the conclusion both survive, and the mechanism is
worth recording rather than re-deriving:** it was logged as `THREADJOIN timeline
6974ms` — `task::join` emits one NAMED line per join, so the attribution came
from the instrument and not from inferring a total — and `timeline` is the only
join that COULD have parked whatever else was stalled, because `engine::teardown`
step 1 deliberately wakes the other two before joining them (`http_shutdown` on
the demux socket, `aq_abort` on both AU lanes) while the reporter's POST had no
such wake. Before and after were taken the same way, so the 14x is
apples-to-apples. What CANNOT be claimed from that session is that video kept
streaming while the reporter was frozen — a property of the tool today, not of
that run. Recorded in `CLAUDE.md`, `threads.rs` and `engine.rs`, all three of
which carried the number.

Host-verified: `make check` green — 1069 Rust tests (1066 on main + 3 new) and 51
harness tests — and `--no-default-features` type-checks. No television: the device
run is the integrator's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay count is a third exception to the early-exit rule, and says so

`stream_case`'s soundness note names exactly two ABSENCE checks that early exit
cannot see, and asks that a third be REASONED ABOUT rather than added. `a_replayed`
is a third of the same shape: it grades an EQUALITY (exactly N `replay:` lines,
because more than N is a loop), and an equality can pass at N and fail at N+1.

What it cannot see, stated rather than left to be discovered: an app replaying
forever fires its next `replay:` line only after another full viewing — ~20 s on
the short clip — while the case satisfies everything else at ~28 s, so an early
exit two seconds later stops before the evidence arrives.

Not closed by making this one case burn its whole 100 s cap. That is ~1.5 min on
every suite run to guard three lines whose bound is ALREADY gradeable by `make
check`: `replay_left` is decremented before each re-arm, and `replay_budget`'s
parsing has host tests. `--no-early` is how to go looking for a loop deliberately,
and the trade is worth re-taking only if that app-side bound moves.

Also: `docs/ux-scenario.md`'s #46 row pointed at the checklist "where it is listed
as untested", which stopped being true one commit ago. It now points at the case.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* tests: the replay assertion passed on a replay that never played, and three notes it made false

`/code-review` on the replay work, five findings, all mine, all fixed.

**The one that mattered: `a_replayed` was a false PASS in the ordering the field
will actually produce.** It measured the post-drop climb from the GLOBAL floor —
and a floor is a VALUE, so it only lands in viewing 2 when viewing 2 happens to
reach viewing 1's minimum. The `pos=` heartbeat is 1 Hz and free-running, so
viewing 1 logging `pos=0s` while viewing 2's first sample lands at `pos=1s` puts
the anchor back in viewing 1 and measures VIEWING 1'S OWN CLIMB. Reproduced
against the real function: `[0,5,10,19,1]` read as "fell 18s then climbed 19s" and
PASSED with the second viewing having produced one sample and zero seconds of
playback — defeating near-miss (e) in its own docstring, "restarted and then
stalled at the join".

Worse than a corner: the harness exits the moment every assertion passes, so that
is the state it would NORMALLY have graded. My own near-miss test passed only
because its series starts at 2 rather than 0 — exactly the accident a regression
test is for, and there is now one carrying the counterexample verbatim.

The climb is anchored at the index of the deepest DROP, which the loop computing
`drop` already had in hand.

Four more, each a sentence this branch itself made false:

* `a_finished`'s docstring still said the replay half "is unreachable from this
  tier today and it is an app gap, not a test gap … exactly one playback per boot
  and no key path back into the player" — contradicted by the `a_replayed` fifty
  lines below it, by `/tmp/plxnative-replay`, and by `pipe_replay_after_eos`, all
  added in the same change. It now points at them and says why the two cases stay
  apart.
* `_eof_note`, `make_fixtures.py` trap 9, the `pipe_h264_ac3_short` shape comment
  and `tests/README.md` all said `pipe_finish_eos` was the ONLY case allowed to
  reach EOF and the only one allowed to name that fixture. Two cases do both now.
  The rule was never "one case" anyway — it is "a case graded through a teardown
  has to have declared `reaches_eos`", which is what the unit test was deliberately
  loosened to, so the prose was the last thing still asserting the old form.
* `CLAUDE.md` and the `which-tier` skill both said "19 cases as of 2026-08-23".
  The manifest holds 20. **That count rotted inside the branch that wrote it, one
  commit after that same branch corrected the previous stale copy of it.** Both are
  now the pointer to `--list` rather than a fourth number waiting to go stale.
* `NetcondRate.setUp` leaked a `mkdtemp` per test — six `/tmp` directories per
  `make check`, on the command run most often. `addCleanup(shutil.rmtree)`, like
  every other temp use in that file. Verified: no new directories after a run.

`make check` green — 1069 Rust, 52 harness.

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
* sources: four states where there were two, and the chip stops calling a signed-in owner signed out

Two things the Sources panel and the shared top bar were saying wrongly. Neither depends on the
other; both are the words a surface uses about a fact it already had.

**The Sources panel renders all four `SourceState` variants, and the winning tier.** It drew a
two-state "Not reachable" off `SrcGroup::reachable()`, which is the only question a `bool` could
answer. The group header's accessory is now `[state] · [tier] · handle`, state FIRST — the accessory
is the last run on that line and elides from the right, so leading with the state means a
34-character plex.tv handle is what gives way rather than the fact that a server is not answering.

`Not authorized` is the point of the change. A 401 is a sharing-grant problem whose remedy is one
row down in the same panel — "Check for new shares" IS the `/api/v2/resources` refetch that reissues
the per-(user, server) token. Calling it "not reachable" sends the user to look at a router for
something no router was ever part of. `NotProbed` says nothing, and that is not an omission: a group
only reaches this list once its libraries have landed, so "nobody has dialled" there is a fact about
our own instrumentation, and stating it would put a warning on a working server.

Relay and Remote are spoken; Local is not. Relay is a ~2 Mbit/s tunnel the server transcodes down to
fit, which reads as a broken server unless something says why; Remote explains a slower first frame
and a transcode on a file that direct-plays at home; Local is what a server is expected to be, and
annotating every group with it is noise. A tier is only spoken for a group that WORKS — "Not
reachable · Relay · friend" reads as three problems where there is one.

The dim is a new question. `SrcGroup::reachable()` answers the old two-state one, in which
`Unauthorized` comes back `true` — not because it is browsable but because a `bool` had no way to
say otherwise. `usable()` is an exhaustive match, so a fifth state has to be given an answer rather
than inheriting one, and it still defers to `reachable()` for the three states that method gets
right. `browse.rs` needed no edit.

**And the profile chip.** It decided signed-in-ness from `current().title.is_empty()`, but an
account without Plex Home never gets a profile written at all — so that title is empty for a
signed-in owner, and the chip offered them "Sign in" while the menu behind it already headed itself
with their name and offered "Sign out". On a fresh single-user test account that is the first thing
a reviewer sees. `ui/account_menu.rs`'s module doc has recorded it since the menu was converted, and
named `ui/widgets.rs` as the fix site.

Fixed by moving the words rather than writing the same match a second time: `chip_label` is the one
resolver, it lives beside the rows it has to agree with, and the chip calls it. The avatar's initial
comes off the same name, so a chip reading "Gleb" can never carry somebody else's letter. `peek`,
not `load` — drawing a chip must never be able to WRITE the session file — and the read is inside
the generation-keyed cache, which is the shape `session::peek`'s own "no per-frame reader" note asks
for.

1075 host tests (1069 on the base). Prose corrected where this makes it false: `plex/session.rs`'s
`Account` doc, and `docs/parity-gaps.md`'s now-closed chip entry.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* sources: an address you can type, and a seam for whoever dials it

**This commit contradicts a recorded OWNER RULING and is separated from the one before it for that
reason.** `docs/shared-servers.md` §12, dated 2026-08-21, quotes the owner — *"Servers are
configured on a PC or phone. On the television we only CHOOSE from the available servers"* — and
states the consequence: "There is no add-a-server-by-address on the television, and there will not
be." The ruling is left STANDING and annotated rather than rewritten; an agent may not overturn it.
Dropping this commit leaves the one before it building and green, which is the point of the split.

The case that argued for reopening it is `docs/lg-self-checklist.md` #20/#43/#47: a QA bench not on
the same IPv4 LAN as a plaintext-HTTP PMS dead-ends at "no server found", and the app had no surface
anywhere that could be typed an address. That is a question about a REVIEWER being unable to
evaluate the app at all, which is not the question the ruling answered — it may or may not move it.

**No new `Route` and no screen.** It is two rows in the tail of the popover that already exists,
beside "Check for new shares", which is the other answer to "my server is missing" — putting them
side by side is the point. Closed it is one row; open it is the field plus its action row, and the
COUNT holds still because a popover's height is measured from its rows and a sub-line appearing as
you type would resize the panel under the cursor. `Tail::Recheck` becomes `Tail::Panel(&Add)`,
carrying the field's state, so `ui/onboard.rs`'s `Tail::None` call site — which has no field and
never will — did not have to learn about a state it cannot reach.

The row model, the parse and every read-out are pure and tested that way. `ui/library.rs` is the
wiring; `app.rs` gains a `Route::Library` key guard mirroring the `Route::Search` one already there,
because the television's keyboard has no caret and delegates its delete and Clear-all to the app as
ordinary key syms.

**The seam.** The panel's job ends at a validated `Endpoint`. Dialling it, checking `/identity`,
merging by `machineIdentifier` and registering is worker-thread work with a socket in it and is not
here: the two halves meet at `take_request()` and `report(id, ok)` and nothing else. Nothing takes
the request today, so the field ages out after 20s saying nothing answered — literally true of a
request nobody picked up, and the right read-out once somebody does and the address is wrong.

**A one-source failure now KEEPS the Source chip.** That toolbar row used to empty completely, which
was defensible only while the panel had nothing to offer a user with one server. It was the single
state in the app where somebody whose only server cannot be dialled had nowhere to type one — the
exact dead end this exists to remove. The design's rule is untouched where it argued about a WORKING
library: one source, nothing wrong, still no chip.

Five findings from `/code-review high`, all fixed and each with a test:

- **A panic that killed the app.** `has_prefix_ci` byte-sliced the typed text, and the field
  re-parses on EVERY keystroke to state the port — so a hostname in Cyrillic or Japanese whose 7th
  or 8th byte falls mid-codepoint panicked out of the SDL event loop. `str::get(..n)` now, and the
  simulator survives "привет" with the app still running.
- **The keyboard wedge Search is explicitly defended against.** An app-switch left
  `textinput::STARTED` true and `start()` early-returns on it, so the panel never rose again.
  `app.rs`'s background arm now calls `library::leave_keyboard()` beside `search::leave()` — keeping
  what was typed, because an app switch is the OS moving the screen, not the user abandoning it.
- **The tail vanished on an empty list.** It hung off the last GROUP, so a roster where nothing has
  libraries yet drew neither way out, in precisely the state both rows exist for. It is its own
  headerless section now, with no separator drawn over nothing.
- **The mailboxes had no request identity**, so a late answer for an attempt the user had already
  replaced would land on the new address. They carry a `ReqId` and a mismatched verdict is dropped.
- **`::32400` parsed as a machine NAME** and lit Connect, because the host whitelist allowed `:`
  unconditionally. A multi-colon host is shape-checked as an IPv6 literal instead.

1088 host tests (1075 on the commit before it). Prose corrected where this makes it false:
`ui/consts.rs`'s two "only the Search screen reads these" claims and `docs/distribution.md` §7.
`docs/lg-self-checklist.md` carries the same false sentence and is the integrator's file — the
replacement wording is in the PR body rather than in this diff.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G

* Revert "sources: an address you can type, and a seam for whoever dials it"

This reverts commit d9513e523518ca362f9b92a797c9b762bebabbcc.

---------

Co-authored-by: Claude Opus 5 (1M context) <[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.

2 participants