Repository navigation
stream: the transport learns to resolve, and to dial an address of either family - #51
Merged
Merged
Conversation
…ther family `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. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
This was referenced Aug 23, 2026
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 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
…, 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 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
…, 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 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
…, 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stream.rsbuilt asockaddr_inby hand from four decimal octets. That is not a degradedtransport for a hostname or an IPv6 server — it is no transport at all, and it is why
plex::probehas to rank aplex.directname below the dotted quad behind it and whyauth::dialablerefuses every candidate that is not an IPv4 literal. This replaces the octetparse with
getaddrinfo, dials down the whole address chain it returns, and closes LG App SelfChecklist #43 CASE2 (IPv6).
Only
rust-modules/src/stream.rschanges.What it does now
Resolution.
resolve()callsgetaddrinfowithAF_UNSPEC+SOCK_STREAM, so the familyand the ORDER are the system's own destination-address policy (RFC 6724) rather than something
this file picks. The flag split is the subtle half and it is a correctness fix, not an
optimisation:
AI_NUMERICHOST— becauseAI_ADDRCONFIGsuppresses AF_INET6results on a host whose only IPv6 address is loopback, so
getaddrinfo("::1", …, AI_ADDRCONFIG)legitimately resolves to nothing on a perfectly healthy machine. A literal has nothing to
configure-filter in any case. It keeps today's dotted-quad path free as a side effect: no NSS
module is loaded and no packet is sent, so the per-seek AVIO reopen costs what the hand parse did.
AI_ADDRCONFIG, which is exactly what that flag is for.AI_NUMERICSERV.The node is UNBRACKETED, the
Host:header is BRACKETED.getaddrinfo("[::1]", …)isEAI_NONAME; the brackets are URI-authority grammar (RFC 3986 §3.2.2 → RFC 9110 §7.2).
resolver_node()strips,host_header()re-adds, and they sit one function apart so theasymmetry is visible rather than remembered. A bracketed host does reach here in practice —
probe::host_ofreturns one. (This is the same split theOriginlane landed ashost()/authority(); the two agree, and a rebase onto it should be small.)Host:comes from the ORIGIN, never the resolved address. It used to emit the numeric address,which was correct only while the input was an address.
nas.local:32400now sendsHost: nas.local:32400. Sending the address instead breaks name-based virtual hosting outright (areverse proxy in front of a PMS routes on this header) and is invisible from the connect — the TCP
session is identical either way.
The whole chain is walked.
connect_any()tries each address until one answers. Resolving tothree addresses and dialling only the first is the old single-address limit wearing a resolver.
Every attempt re-establishes the two invariants this file already had, not just the first: the fd
is published into the atomic before
connect, and every failed attempt is retired throughclose_owned, never a bareclose.CONNECT_TIMEOUT_MS2000 → 8000, and it is now the budget for the whole chain, not peraddress, so the worst-case main-loop block is one number however many addresses DNS returned.
2000 ms was a LAN number: Linux's first SYN retransmit is at 1 s, so one lost SYN plus a
trans-continental RTT spent it and a server that would have answered got reported unreachable.
Deliberately not derived from the address — RFC1918 is not "local" in Plex's sense, and probe
order/patience is
plex::probe's policy, not this layer's.A new interrupt 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 arethe same value at
connect's return, so without a latch a teardown fired during attempt 1 of 2 isanswered by opening attempt 2 — the interrupt consumed, a brand-new connection handed to a caller
being torn down.
HttpStream::interruptedis set byhttp_shutdown(unconditionally, includingwhen the fd is already -1, which is the between-attempts window) and cleared by
reset_fields. Itis read on both sides of the walk, which makes "a shutdown anywhere in an open aborts that open"
true rather than nearly true.
Chunked detection was an exact single-spelling compare.
find_ci(hdr, b"\r\ntransfer-encoding: chunked")missedTransfer-Encoding:chunked(OWS after thecolon is optional),
gzip, chunked(the legal list form), and a list split across two lines. Amiss is not a failure — the body is then read as close-delimited with the chunk-size lines left
inline in it, i.e. silent corruption from a healthy server. Now a real list parse.
Two bugs review caught that the host suite could not
Both were in my first draft, both green on Darwin, and one is the exact hazard this repo documents
as "Tier 1 runs on Darwin, the app runs on Linux, and they disagree".
AI_NUMERICSERV, and glibc does not do one. Darwin rejectsan out-of-range numeric service; glibc parses it with
strtoul, range-checks nothing, andreturns
htons(70000)— port 4464. So the assertion "an out-of-range port now fails instead ofwrapping" passed on the machine I ran it on, would have gone red on CI's
ubuntu-latest, andthe truncation it claimed to have fixed would still have been live on the television. Fixed by
range-checking in
resolve()itself, in Rust, before the resolver — the only version of thisthat is true on both platforms.
999.1.2.3to the real resolver. It is not an address,so it went out as a name. On a network with NXDOMAIN hijacking it resolves to a real web
server, the open SUCCEEDS and the test fails; on one with a dead resolver it burns glibc's whole
timeout × attempts × nameserversbudget inside a suite documented as offline and ~0.3 s. Thatcase is now an out-of-range port — the same early exit (refused in
resolve, before any socket)and it cannot leave the machine.
Two deviations from the brief, both deliberate
sockaddr_storage.connect_timeouttakes(*const sockaddr, socklen_t)as asked, butthe pair handed to it is the
addrinfo's ownai_addr/ai_addrlen, forwarded without a copy.Same end, no size assumption, and the family never has to be tested.
connect_timeoutcall sites in the tests changed spelling (to aconnect_v4adapter) because the signature changed. Every assertion in the 10 pre-existing tests is
unchanged.
Host-proven
make check: 989 passed (976 on base; +13 here), clippy gate clean, stable over fourconsecutive runs.
cargo check --no-default-features(theRELEASE=1setmake checkcannot see)is clean.
The new tests, and what each actually enters:
::1, an AF_INET6 socket opened because the resolver saidso, a 200 and its body read back, and a bracketed
Host:captured off the wire. Both::1and
[::1]as input. Verified to have actually run, not skipped (the skip path prints).localhostagainst a listener bound to 127.0.0.1 only, so on anyhost that offers
::1first this passes only by walking past a refused address.Host:carriesthe name.
::1node, then a live v4one), because which addresses a name yields and in what order is the machine's business.
descriptors if a single
close_ownedis missed.receiving no connection), and a new open clears the previous teardown.
::1listener connects and is handed backBLOCKING, and a
::1refusal is immediate. A wrongsocklen_tor a straysockaddr_incastshows up here and nowhere else.
block — and a wire test proving
Transfer-Encoding:chunkednow decodes rather than handing thecaller
4\r\nabcd\r\n0\r\n\r\n.resolve's own check rather than the platform's.Simulator:
make sim-shotstill reaches Home against a real PMS over plain IPv4 — hero art,hubs and posters all loaded, every one of them a
stream.rsGET through the new path. NoDNS FAILEDline in the sim event log.Firmware, offline (
tools/fwcompat.py, all 14 inventories):getaddrinfoandfreeaddrinfoare exported by
libc.so.6as@GLIBC_2.4on every release 1.2.0 → 11.2.0, andlibnss_dns.so.2/libnss_files.so.2/libresolv.so.2are present on every one.Still needs a device
That glibc's NSS machinery works from inside this app's jail. The inventory proves those
.sofiles are in the image — not that the jailed process candlopenthem, nor that/etc/resolv.confand/etc/nsswitch.confare readable there. The blast radius is bounded:a literal never enters the NSS path (
AI_NUMERICHOST), so if this is broken on device, today'sworking IPv4 flow is unaffected and only names fail.
And the obvious reassurance is unsound — worth stating so nobody re-derives it. "libcurl
already resolves plex.tv on the dev set, so the jail's resolver clearly works" is false: LG's
libcurl is linked against c-ares on all 14 images (
--inventory libcares libcurl), whichparses
/etc/resolv.confitself and speaks UDP/53 directly. It never callsgetaddrinfoandnever loads an NSS module. Sign-in working today is evidence about c-ares, not about glibc.
This change is the first code in this process to take the glibc path. The one thing that
does transfer: the app already
dlopens libcurl by bare SONAME on the set, so the jail's loadersearch path reaches the system library directory — the same path glibc's NSS
dlopenuses.Related, benign in the failure direction:
AI_ADDRCONFIGis implemented through__check_pf,which opens an
AF_NETLINKsocket. If the jail denies netlink, glibc's documented fallback is toreport both families present — it degrades to no filtering, not to a failure. Reasoned from
glibc's source, not measured.
A real IPv6 PMS connection. IPv6 here was exercised against
::1on Darwin. Whether the sethas a global IPv6 address at all — and therefore whether
AI_ADDRCONFIGreturns AAAA for aname — is a device question.
The teardown-mid-open path.
shutdown(2)aborting a handshake is TV-kernel behaviourmeasured with
tools/sockprobe.c; Darwin does the opposite (it reports connect success ona socket that never connected). The latch test therefore arms the latch rather than racing it,
which grades the branch that decides the outcome but not the race.
The 8000 ms budget as a felt UI behaviour. An 8 s worst-case main-loop block against an
unreachable server is only observable on the set.
The
DT_NEEDED/ undefined-symbol matrix on the built ELF. I could not cross-build (fleetrule: no bare
makein a worktree — it rebuilds FFmpeg), so linkage was graded from SOURCE.CI runs the real matrix. What the source grade did establish, via
fw-compat-reviewer:getaddrinfo/freeaddrinfo;everything else added (
AF_INET6,AF_UNSPEC,AI_*,addrinfo,in6_addr,sockaddr_in6,socklen_t) is a constant or a type. Both live inlibc.so.6, already line 5of
ci/expected-dt-needed.txt, and the PRE-change binary already imports both — they comein through Rust's
stdunder-Z build-std. Nothing pulls libnss/libresolv in at link time;glibc dlopens those from inside libc at first lookup.
fwcompatstrips@VERbeforecomparing and would have graded a mismatch green. The NDK sysroot defines
getaddrinfo@@GLIBC_2.4; all 14 inventories export@GLIBC_2.4; neither function ever got asecond version on ARM (2.4 is the ARM base).
libc::addrinfomatches glibc 2.12 field for field (the crate's Android arm — which swapsai_canonnameandai_addr— iscfg-gated away from ourtarget_os = "linux"), andAI_NUMERICHOST/AI_ADDRCONFIG/AI_NUMERICSERVare0x0004/0x0020/0x0400in both thecrate and the NDK's
netdb.h.getaddrinfocorrectly does NOT belong indynlib!—libc.so.6islibc.so.6on all14, it is already a hard
DT_NEEDED, and moving it would trade link-time symbol checking fornothing.
One honest limitation, and it is not mine to fix here
getaddrinfois BLOCKING and nothing in this file can interrupt it. Every other wait in anopen is bounded and can be cut short by
http_shutdown, because there is a published descriptorto shoot. There is none here — the resolver owns its sockets. A name whose DNS server is not
answering holds the caller for the resolver's own budget (glibc:
timeout×attempts×nameservers, defaulting to 5 s × 2 each), far past anything
CONNECT_TIMEOUT_MSbounds, and on themain thread that is the 60 fps loop.
ff.rs::seek_cbdoes a fullhttp_openper AVIO seek hop, soa name-based part URL would re-resolve on every seek.
It does not touch the path the app takes today, because a literal never reaches the resolver's
network side. It becomes real the moment a name is dialled. The two levers, neither of them this
file's to pull: resolve off the main thread, or set
RES_OPTIONS=timeout:2 attempts:1at boot(glibc reads it at
res_init). Flagging it for whoever owns probe policy.Handover
The capability is not yet REACHABLE through the sign-in/probe path.
auth.rs::dial_targetstill gates on
is_ipv4_literal(&c.address) && scheme == Http, so a name or a v6 candidate isrefused before it ever reaches
http_open. That gate is the Origin/probe lane's file, not mine —this PR removes the transport limitation underneath it, and #43 CASE2 is not closed end to end
until that predicate widens. The one path with no gate in front of it is the
plxnative-playurltrigger, where a hostname works today.A
CONNECT_TIMEOUT_MSjudgement call is flagged rather than settled. Review's position is that8000 is not reachable today (see the gate above) and quadruples the LAN freeze in the meantime, so
2000 should stand until names are actually dialled. I kept 8000 because the brief asked for one
conservative number and forbade deriving it from the address, and I wrote the trade-off into the
constant's own doc rather than leaving the justification aspirational. If the integrator prefers
2000 for now, it is a one-line revert and the doc paragraph beside it says why.
Docs.
doc-claim-auditorfound 15 contradictions across the tree, none in this file. Twofamilies: "
stream.rshas no name resolution" (plex/probe.rs:196,auth.rs:598/:618,plex/client.rs:27/:38,CLAUDE.md:308/:334/:339,README.md:80,tests/README.md:227,docs/shared-servers.md:193,docs/macos-app.md:27,docs/distribution.md:823,docs/lg-self-checklist.md:36/:42,.claude/skills/ui-sim/SKILL.md:73,dev.rs:366,bin/sim.rs:62), and — the family nobody thought to look for —CONNECT_TIMEOUT_MS's old valuequoted as the price of a design decision in
viewstate.rs:16andauth.rs:719, both of whichargue from "2 s". Three are live instructions to a human that now refuse something which works:
bin/sim.rs:62prints "It must be a NUMERIC IP" at simulator startup,dev.rs:366tells anoperator not to put a hostname in
plxnative-playurl, andtools/keytable.py:156hard-refuses anon-numeric
--pms.All left untouched deliberately — other lanes are in those files right now, and a fleet-wide
CLAUDE.md edit is a merge conflict waiting to happen. Worth a separate docs-only PR once the
Origin/probe lanes land.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G