Repository navigation
transport: an Origin is what a server's address IS, parsed from a URL and never rebuilt from one - #53
Merged
Merged
Conversation
…from a URL
Everything below the transport carried a server's address as a bare
`(host, port)` pair. That pair cannot say `https`, and — the half that
matters — it cannot be *made* to say it afterwards, because the host a
`plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in
`Connection.uri`, while `Connection.address` stays the dotted quad behind
it. `probe.rs` has said so in prose since it was written ("https to the
bare IP fails validation by design"), and `auth::resolve_roster` then
threw `Candidate::url` away and wrote `address` into the session file. A
later lane adding a `scheme` field on top of that would have produced a
control plane that looks like it speaks TLS and fails hostname validation
on every real server.
So: `plex::Origin` — scheme + host + port, parsed from a URL by
`Origin::parse`, never assembled from an address. `Candidate::origin()`
is the one derivation; `Candidate::address` is documented down to what it
actually is, the diagnostic half.
Threaded through every site that passed a bare pair: `Client` (with
`host()`/`port()` kept as views, so the ~30 call sites below the layer
are untouched), `StreamUrl` and its two construction sites,
`register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`,
`app.rs`'s boot gate and `install_pms`, and the engine's URL splitter.
`dev::DevServer` gains an optional `scheme`, which is how an https origin
can be exercised headlessly through the `plxnative-servers` trigger by
anyone who has no such server to discover.
Two invariants are pinned by tests rather than left to prose.
`Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node —
and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL
serialization; `probe::host_of` returned the bracketed spelling and is
gone, replaced by one shared reading of a URL. And a session file written
by 0.4.1, carrying `address`/`port` and no origin, must still boot as
`http://{address}:{port}`: `Session::server` is not a soft-parsed roster
entry, so dropping it is a silent sign-out at every boot for every
existing user. Both have a test with a literal 0.4.1-shaped JSON string.
NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same
address: `dial_target` accepts only a plain-http IPv4 candidate, whose
URL `probe::candidates` synthesized as `http://{address}:{port}`, so the
parsed origin and the old pair are equal today — asserted, not assumed.
The registry's two log lines now print `origin.authority()`, which is
byte-identical for every http/IPv4 origin and correct for a v6 literal,
which `{host}:{port}` could not spell at all.
996 host tests pass. A simulator boot against a real PMS produces an
event log identical to the pre-change one on all 30 non-heartbeat lines;
the three `loop=`/`fps=` lines vary run to run on an unchanged binary.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
…o rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
…taken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
… recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
… real socket
CI was red on Linux with `thread '<unknown>' has overflowed its stack`,
at a different point in the output each run, while `make check` passed on
the dev Mac. The mechanism is not serde_json and not the session file.
`moving_a_server_to_https_re_points_its_slot` called the public
`register_origin`, where every other test in this module deliberately
goes through `register_with_client_id`. The public path fires
`serverinfo::refresh`, which spawns a `task::spawn_small` worker that
really opens a socket — and in a DEBUG build `stream::http_stream_boxed`
materialises its 64 KiB `HttpStream` as a STACK temporary before it ever
reaches the heap, despite the comment above it promising the opposite
("box it off the caller's stack"). lldb caught it on the guard page:
frame #0 stream::http_stream_boxed
frame #1 stream::http_get(host="10.0.0.1", port=32400, …)
frame #2 Client::get_json
frame #3 Client::server_root
frame #4 serverinfo::fetch_once
frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB
Measured on this branch by varying `SMALL_STACK`: debug overflows at 48,
128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is
exactly why one host passed and the other did not. **`--release` passes at
48 KiB**, so the optimizer elides the temporary and the television — which
ships `cargo build --release` (Makefile:438) — is not affected. It is a
latent debug-only hazard in `stream.rs`, pre-existing and not this
branch's to fix; the base simply had no host test that reached
`http_get` from a `spawn_small` worker. Reported on the PR.
The fix is the test, which was wrong on its own terms: `register` also
mints and PERSISTS a client-id uuid, and that seam's doc has said since it
was written that a host test must not write one. It gains an origin-taking
sibling (the pair-shaped one cannot express a scheme, which is what this
test is about) and a second documented reason nobody had paid for yet.
Verified with the same differential that found it: at `SMALL_STACK = 48 *
1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both
`--test-threads=1` and parallel. `task.rs` is untouched.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
GLinnik21
added a commit
that referenced
this pull request
Aug 26, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble is the reason this file exists: every item must be Pass or N/A, and marking one Pass when it should be N/A — or vice versa — is a stated rejection ground. So "we never tested it" is not a markable state, which makes the UNTESTED column matter as much as the failing one. Eleven items sit there today. Four fail outright, and three of those are one root cause: `stream.rs::http_open` builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only — which takes out #20, #43 and #47 together the moment a QA bench is not on the same LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is undefined for a sideloaded app. §4 records the four items that moved on 2026-08-22 and why they are worth reading together: every one was found by LOOKING AT THE PANEL, and not one was visible in a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes instead of the native scancodes the app actually receives; a splash 63% black against LG's "should not be black"; and `requiredMemory` asking for less headroom than declaring nothing would have. §5 records the two items that are DECISIONS rather than defects — no on-screen transport button row, and English-only — because a future reader of the checklist will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX scenario for movement details") is what makes the UX scenario document, not code, the place that answer belongs. §7 names the defect class rather than the bug: the music note was the visible tip of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai titles and subtitles, hits the same two items, and nothing in the host suite can see. Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 26, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 27, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble is the reason this file exists: every item must be Pass or N/A, and marking one Pass when it should be N/A — or vice versa — is a stated rejection ground. So "we never tested it" is not a markable state, which makes the UNTESTED column matter as much as the failing one. Eleven items sit there today. Four fail outright, and three of those are one root cause: `stream.rs::http_open` builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only — which takes out #20, #43 and #47 together the moment a QA bench is not on the same LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is undefined for a sideloaded app. §4 records the four items that moved on 2026-08-22 and why they are worth reading together: every one was found by LOOKING AT THE PANEL, and not one was visible in a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes instead of the native scancodes the app actually receives; a splash 63% black against LG's "should not be black"; and `requiredMemory` asking for less headroom than declaring nothing would have. §5 records the two items that are DECISIONS rather than defects — no on-screen transport button row, and English-only — because a future reader of the checklist will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX scenario for movement details") is what makes the UX scenario document, not code, the place that answer belongs. §7 names the defect class rather than the bug: the music note was the visible tip of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai titles and subtitles, hits the same two items, and nothing in the host suite can see. Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 27, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 28, 2026
The checklist is a submission DOCUMENT, not a private rubric, and its own preamble is the reason this file exists: every item must be Pass or N/A, and marking one Pass when it should be N/A — or vice versa — is a stated rejection ground. So "we never tested it" is not a markable state, which makes the UNTESTED column matter as much as the failing one. Eleven items sit there today. Four fail outright, and three of those are one root cause: `stream.rs::http_open` builds a `sockaddr_in` from four decimal octets, so no TLS, no DNS, IPv4 only — which takes out #20, #43 and #47 together the moment a QA bench is not on the same LAN as a plaintext PMS. Plus no ABR (#43 CASE1) and factory reset (#53), which is undefined for a sideloaded app. §4 records the four items that moved on 2026-08-22 and why they are worth reading together: every one was found by LOOKING AT THE PANEL, and not one was visible in a green test run. Subtitles rendering `.notdef` tofu because neither Inter nor the television has U+2669-U+266C; transport keys bound to CEA-2014-A web keyCodes instead of the native scancodes the app actually receives; a splash 63% black against LG's "should not be black"; and `requiredMemory` asking for less headroom than declaring nothing would have. §5 records the two items that are DECISIONS rather than defects — no on-screen transport button row, and English-only — because a future reader of the checklist will otherwise try to "fix" the first one, and item 45's own remark ("refer to UX scenario for movement details") is what makes the UX scenario document, not code, the place that answer belongs. §7 names the defect class rather than the bug: the music note was the visible tip of "any codepoint outside Inter tofus", which is CJK, Hebrew, Arabic and Thai titles and subtitles, hits the same two items, and nothing in the host suite can see. Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Aug 28, 2026
… and never rebuilt from one (#53) * transport: an Origin is what a server's address IS, and it is parsed from a URL Everything below the transport carried a server's address as a bare `(host, port)` pair. That pair cannot say `https`, and — the half that matters — it cannot be *made* to say it afterwards, because the host a `plex.direct` certificate is issued for is the HOSTNAME plex.tv puts in `Connection.uri`, while `Connection.address` stays the dotted quad behind it. `probe.rs` has said so in prose since it was written ("https to the bare IP fails validation by design"), and `auth::resolve_roster` then threw `Candidate::url` away and wrote `address` into the session file. A later lane adding a `scheme` field on top of that would have produced a control plane that looks like it speaks TLS and fails hostname validation on every real server. So: `plex::Origin` — scheme + host + port, parsed from a URL by `Origin::parse`, never assembled from an address. `Candidate::origin()` is the one derivation; `Candidate::address` is documented down to what it actually is, the diagnostic half. Threaded through every site that passed a bare pair: `Client` (with `host()`/`port()` kept as views, so the ~30 call sites below the layer are untouched), `StreamUrl` and its two construction sites, `register_origin`/`install`, `SourceRef`/`ServerRef`, `ReadyCreds`, `app.rs`'s boot gate and `install_pms`, and the engine's URL splitter. `dev::DevServer` gains an optional `scheme`, which is how an https origin can be exercised headlessly through the `plxnative-servers` trigger by anyone who has no such server to discover. Two invariants are pinned by tests rather than left to prose. `Origin::host()` is ALWAYS unbracketed — it is the `getaddrinfo` node — and `Origin::authority()` ALWAYS brackets a v6 literal, because it is URL serialization; `probe::host_of` returned the bracketed spelling and is gone, replaced by one shared reading of a URL. And a session file written by 0.4.1, carrying `address`/`port` and no origin, must still boot as `http://{address}:{port}`: `Session::server` is not a soft-parsed roster entry, so dropping it is a silent sign-out at every boot for every existing user. Both have a test with a literal 0.4.1-shaped JSON string. NO BEHAVIOUR CHANGE. Every origin is still `http://` and dials the same address: `dial_target` accepts only a plain-http IPv4 candidate, whose URL `probe::candidates` synthesized as `http://{address}:{port}`, so the parsed origin and the old pair are equal today — asserted, not assumed. The registry's two log lines now print `origin.authority()`, which is byte-identical for every http/IPv4 origin and correct for a v6 literal, which `{host}:{port}` could not spell at all. 996 host tests pass. A simulator boot against a real PMS produces an event log identical to the pre-change one on all 30 non-heartbeat lines; the three `loop=`/`fps=` lines vary run to run on an unchanged binary. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * docs: name what the origin model made stale, rather than leaving it to rot `plex/CLAUDE.md` and `servers.rs`/`client.rs`'s module docs described the registry in terms of `(host, port)`, which is the shape the change replaced. `docs/plex-api-design.md` is a design note whose sketches were the implementation of their day — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host, no DNS", and the two struct sketches), not a rewrite. `docs/shared-servers.md` §7 gains the `plxnative-servers` trigger's new `scheme` field, which is the only way to put a TLS origin through the registry without an account that has one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * session: the stored origin field is `origin_url`, so it cannot be mistaken for `origin()` `SourceRef`/`ServerRef` had a FIELD `origin` (the serialized string) beside a METHOD `origin()` (the parsed value). Rust puts those in different namespaces so it compiles either way, which is exactly the problem: two characters separate "the raw JSON string" from "the thing to dial", at every use, forever. The field takes the `_url` suffix; `#[serde(rename)]` keeps the FILE's key spelled `origin`, which is what a human editing a session file on the television reads, and the round-trip test proves the rename applies to both halves of serde. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * review: close the gap between the origin that was DIALLED and the one recorded Eight findings from `/code-review high`; six fixed, two answered in prose. **The one that mattered.** `resolve_roster` recorded `Candidate::origin()` while `probe_server` dialled `(&c.address, dial_port(c.port))`, and the comment justifying that divergence was wrong about its own gate: `dial_target` checks `is_ipv4_literal(&c.address)`, which admits a plex.tv-advertised `uri` candidate and not only the synthesized twin. A connection whose `uri` names a different port from `port` would be verified at one and written into the session file as the other, and every later request would go somewhere nothing ever answered from. So `dial_target` now returns the ORIGIN, `probe_server` dials that origin's host and port, and `Reach::At` carries it back beside the candidate — one value, so what answered and what is recorded cannot be two addresses. The candidate stays for the diagnostic fields. Its fixture had `url` and `port` disagreeing, which is what let the old shape look consistent; it builds both from one pair now, as `probe::candidates` does. **The silent-instrument trap, twice.** `dev::DevServer`'s `scheme` field exists so a lane with no TLS server of its own can put an https origin through the registry — and both registry log lines and `DevServer:: describe` printed `host:port`, so such a run was byte-identical to an http one. `Origin::log_form()` is the shared answer: the bare authority for a plaintext origin (an archived log stays comparable, and the byte-identical gate holds) and the whole URL as soon as the scheme is worth saying. **`player::engine` REFUSES a TLS stream target** instead of silently downgrading it, which is what the code did while its comment claimed the opposite. It is reachable today: a client registered at an https origin copies that origin into `direct_play_url`/`transcode_start_url`, so `route` would store an https URL and the engine would open a plaintext socket to it. Also: an EMPTY port (`http://h:`) is a port that was WRITTEN and cannot be dialled, so `Origin::parse` refuses it rather than defaulting to 32400 — a truncated write of the session file is exactly the "port nobody wrote down" case `dial_port` exists for. And `reconcile_primary` no longer logs "primary now answers at …" when the only thing that changed was the stored origin going from empty to populated, which is what the FIRST BOOT after this lands does on every existing install — a false DHCP-churn report in the file this project treats as its primary evidence surface. Answered rather than changed: `Origin::port`'s doc claimed a narrowing one constructor does not perform (`ServerRef::origin`'s legacy `port as i32`), so the doc now says where the narrowing really lives; and `Session::can_go_local` still asks "is there an address written down" rather than "can THIS build's transport open it" — gating it would send a user to a QR code for a transport gap that is not theirs, and the half-landed state it exposes is named in the doc and refused out loud one layer down, in the engine. 997 host tests pass. The simulator event log is still identical to the pre-change one on all 30 non-heartbeat lines. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G * tests: a registry test must not call the PUBLIC register — it opens a real socket CI was red on Linux with `thread '<unknown>' has overflowed its stack`, at a different point in the output each run, while `make check` passed on the dev Mac. The mechanism is not serde_json and not the session file. `moving_a_server_to_https_re_points_its_slot` called the public `register_origin`, where every other test in this module deliberately goes through `register_with_client_id`. The public path fires `serverinfo::refresh`, which spawns a `task::spawn_small` worker that really opens a socket — and in a DEBUG build `stream::http_stream_boxed` materialises its 64 KiB `HttpStream` as a STACK temporary before it ever reaches the heap, despite the comment above it promising the opposite ("box it off the caller's stack"). lldb caught it on the guard page: frame #0 stream::http_stream_boxed frame #1 stream::http_get(host="10.0.0.1", port=32400, …) frame #2 Client::get_json frame #3 Client::server_root frame #4 serverinfo::fetch_once frame #5 serverinfo::refresh::{closure#0} <- spawn_small, 256 KiB Measured on this branch by varying `SMALL_STACK`: debug overflows at 48, 128 and 192 KiB on ARM64 and needs more than 256 KiB on x86-64, which is exactly why one host passed and the other did not. **`--release` passes at 48 KiB**, so the optimizer elides the temporary and the television — which ships `cargo build --release` (Makefile:438) — is not affected. It is a latent debug-only hazard in `stream.rs`, pre-existing and not this branch's to fix; the base simply had no host test that reached `http_get` from a `spawn_small` worker. Reported on the PR. The fix is the test, which was wrong on its own terms: `register` also mints and PERSISTS a client-id uuid, and that seam's doc has said since it was written that a host test must not write one. It gains an origin-taking sibling (the pair-shaped one cannot express a scheme, which is what this test is about) and a second documented reason nobody had paid for yet. Verified with the same differential that found it: at `SMALL_STACK = 48 * 1024` the branch was 3/3 aborts and is now 3/3 clean, 997 tests, both `--test-threads=1` and parallel. `task.rs` is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
T1 of the transport chain:
plex::Origin— a server's address as ONE value, parsed from a URL.A behaviour-preserving refactor that deliberately changes nothing a user can see, and exists so the
lanes above it cannot build the one bug that would make TLS look done and be broken.
Why it has to land before any
schemefieldplex/probe.rsbuilds ranked connectionCandidates from/api/v2/resources. ACandidatecarriesboth
urlandaddress, and the two are deliberately different: plex.tv advertises theplex.directhostname inConnection.uriwhileConnection.addressstays the dotted quad behindit.
probe.rshas said so in prose since it was written — "https to the bare IP fails validation bydesign" — because the certificate is issued for the name.
auth::resolve_rosterthen threwCandidate::urlaway and wrotec.addressintoSourceRef, whichbecame
plex::register(host, port)and thenClient { host, port }. Adding aschemefield on topof that would have produced a control plane that looks like it speaks TLS and fails hostname
validation on every real server — including the LG reviewer's, which is the whole point of the
project.
So the origin is parsed from a URL, never rebuilt from an address, and
Candidate::addressisdocumented down to what it actually is: diagnostic metadata for the log and the Sources panel.
The shape
The bracket rule is an invariant, not a detail, and it is pinned by a round-trip test:
http://[::1]:32400→host() == "::1"→authority() == "[::1]:32400"→base()identical to theinput. Without it the failure is silent in the worst direction — URL construction keeps looking right
while name resolution quietly stops working.
probe's ownhost_ofreturned the bracketedspelling, correct for a URL and wrong for a resolver, so it is gone: there is now exactly one reading
of a URL in the layer (
origin::url_host).Threaded through every site that passed a bare
(host, port):Client(withhost()/port()keptas views, so the ~30 call sites below the layer are untouched),
StreamUrland its two constructionsites,
register_origin/install,SourceRef/ServerRef,ReadyCreds,app.rs'sinstall_pmsand boot gate, and the engine's URL splitter.
dev::DevServergains an optional"scheme". That is how every other lane and the integrator canput a TLS origin through the whole control plane headlessly, with no account that has one — and a
value that is neither
httpnorhttpsfails the trigger loudly rather than silently meaninghttp.The two hard gates
(a) A 0.4.1 session file must still boot.
Session::serveris not a soft-parsed roster entry —de_soft_veccovers the lists beside it and cannot cover a missing field meaning something else — sodropping it is a silent sign-out at every boot for every existing user.
ServerRef::origin()isdeliberately TOTAL (the roster's
SourceRef::origin()isOption, becauseusable()gates everycaller there); the test uses a literal 0.4.1-shaped JSON string and asserts
can_go_local()plushttp://{address}:{port}. Two more pin the other side: a stored origin beats the address pair besideit, and an undialable stored origin is refused rather than repaired (
…:4294999696must notbecome 32400, which is what that number wraps to).
(b) No behaviour change. Every origin is still
http://and dials the same address, and theequality is asserted rather than assumed: the only candidates this transport dials are plain-http
IPv4 ones, whose URL
probe::candidatessynthesized ashttp://{address}:{port}.Verification
make check: 997 pass, 0 fail (nightly, plus the three named clippy lints,ci/flavor.py --selftestandtests/test_harness.py). ~24 of those are new.RELEASE=1/--no-default-featurestype-checks clean — thePostToolUsehook ran after everyedit and blocked several intermediate states, correctly.
non-heartbeat lines, including
plex: server slot 0 registered at <pms-host>:32400. The onlydiff is the three
loop=/fps=heartbeat lines, and those vary run-to-run on an unchangedbinary too (two consecutive AFTER runs differ on one of them), so they are sampling noise. Home
renders correctly: hero, shelves, posters, tab strip.
No device tier was run and none is needed: no FFI, no linkage, no
dynlib!, no playback path, nopixels. This is control-plane plumbing plus one URL parser, and the simulator exercises all of it
against a real PMS.
/code-review high— 8 findings, 6 fixed, 2 answeredThe two that were worth the review on their own:
The origin recorded was not provably the origin dialled.
resolve_rosterwroteCandidate::origin()whileprobe_serverdialled(&c.address, dial_port(c.port))— and my commentjustifying that was wrong about its own gate:
dial_targetchecksis_ipv4_literal(&c.address),which admits a plex.tv-advertised
uricandidate and not only the synthesized twin. A connectionwhose
urinames a different port fromportwould be verified at one and written down as theother. Now
dial_targetreturns theOrigin,probe_serverdials that origin's host and port,and
Reach::Athands it back beside the candidate — one value, so the two cannot diverge. (Itsfixture had
urlandportdisagreeing, which is exactly what let the old shape look consistent; itbuilds both from one pair now.)
The silent-instrument trap, twice. The
schemetrigger exists so a lane can exercise an httpsorigin — and both registry log lines and
DevServer::describeprintedhost:port, so such a run wasbyte-identical to an http one.
Origin::log_form()is the shared answer: the bare authority for aplaintext origin (archived logs stay comparable, and gate (b) holds) and the whole URL as soon as the
scheme is worth saying.
Also fixed:
player::enginenow refuses a TLS stream target with a logged reason instead ofsilently opening a plaintext socket to it (reachable today — a client at an https origin copies that
origin into
direct_play_url);Origin::parserefuses an empty port (http://h:) rather thandefaulting to 32400, since that is a truncated write, not a request for the default; and
reconcile_primaryno longer logs "primary now answers at …" when the only change was the storedorigin going from empty to populated — which is what the first boot after this lands does on every
existing install, i.e. a one-shot false DHCP-churn report in the primary evidence surface.
Answered in prose rather than changed:
Origin::port's doc claimed a narrowing one constructor doesnot perform, so it now says where the narrowing really lives; and
Session::can_go_localstill asks"is there an address written down" rather than "can THIS build's transport open it" — gating it
would send a user to a QR code for a transport gap that is not theirs. The half-landed state that
exposes (discovery accepting https before
stream.rsspeaks it) is named in the doc and refused outloud one layer down, in the engine.
What a later lane inherits
rust-modules/src/ui/alt_sources.rs's dev stand-in is the one remaining(host, port)callerthat has an origin and discards it (
register(&name, c.host(), c.port(), &token)). It is#[cfg(not(test))]and needsdev::read("token"), so it is dev-only and cannot mis-dial a realserver. The fix is one line —
register_origin(&name, c.origin(), &token)— and it is written downin
plex/CLAUDE.mdrather than done here, because that file is not in this unit's ownership.SourceRef::describe()still prints the address pair, not the origin. That is right for adiagnostic today; the TLS lane may want it to say the origin.
register,register_with_client_idandOrigin::httpare kept as explicitly plaintextspellings. That is the point:
Origin::http(is the grep that finds every remaining cleartextassumption, and today they are all correct because
stream.rsspeaks nothing else.Docs
plex/CLAUDE.md,servers.rsandclient.rsdescribed the registry in(host, port)terms and wereupdated.
docs/plex-api-design.mdis a design note whose sketches were the implementation of theirday — it gets a banner naming the one thing in it that would now mislead (rule 9, "Numeric host,
no DNS", and the two struct sketches), not a rewrite.
docs/shared-servers.md§7 gains the trigger'snew
schemefield.One place the plan and the tree disagreed
The plan put
client.rs'sStreamUrlat:363-395; it is:362-395. Everything else checked out,including both
probe.rsline references and thesession.rs:124de_soft_vecnote.🤖 Generated with Claude Code
https://claude.ai/code/session_01GovTtrsD9P7Ld7DnLCMK2G
CI was red on Linux, and the mechanism was not where anyone was looking
make checkpassed on the dev Mac while the x86-64 Linux runner aborted twice withthread '<unknown>' has overflowed its stack, at a different point in the output each run.It was not serde_json and not the session file.
moving_a_server_to_https_re_points_its_slotcalled the public
register_origin, where every other test in that module deliberately goesthrough the
register_with_client_idseam. The public path firesserverinfo::refresh, which spawnsa
task::spawn_smallworker that really opens a socket — and in a debug buildstream::http_stream_boxedmaterialises its 64 KiBHttpStreamas a stack temporary before itreaches the heap, despite the comment directly above it promising the opposite ("box it off the
caller's stack"). lldb caught it on the guard page:
Measured, by varying
SMALL_STACKon this branch: debug overflows at 48, 128 and 192 KiB onARM64, and needs more than 256 KiB on x86-64 — which is exactly why one host passed and the other did
not. The margin was always razor-thin; the base just had no host test that reached
http_getfrom aspawn_smallworker.Does it bite in production? No — measured, not assumed
--releasepasses at 48 KiB, where debug aborts. At release opt-level the zeroing goes straightinto the heap allocation and the temporary never exists. The television ships
cargo build --release(Makefile:438), so its 256 KiBspawn_smallstacks are unaffected andSMALL_STACKkeeps the headroomtask.rsmeasured (3745 threads againstRLIMIT_NPROC).It is still a latent hazard worth someone's attention, and it is not this PR's to fix —
stream.rsis another lane's file and the code is unchanged from the base. For whoever picks it up:the fix is to allocate zeroed on the heap instead of copying a stack temporary into it
(
Box::new_uninit()+write_bytes, oralloc_zeroed), which makes the comment true in everyprofile and costs nothing. Until then, no test in this crate may call
register/register_origin— that is now written into the seam's doc, with this run as the reason.
The fix here
The test was wrong on its own terms regardless of the stack:
registeralso mints and persists aclient-id uuid, and that seam's doc has said since it was written that a host test must not write
one. It gains an origin-taking sibling (the pair-shaped seam cannot express a scheme, which is what
this test is about) and a second documented reason nobody had paid for yet.
Verified with the same differential that found it: at
SMALL_STACK = 48 * 1024this branch was 3/3aborts and is now 3/3 clean — 997 tests, both
--test-threads=1and parallel.task.rsis untouched.