Skip to content

Discover: one base for the person page and the Watchlist; a mock boot never reaches the real provider - #857

Merged
GLinnik21 merged 6 commits into
mainfrom
crx-discover-iso
Oct 20, 2026
Merged

GLinnik21 merged 6 commits into
mainfrom
crx-discover-iso

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Found while checking captions in the simulator: a run against tests/mock_pms.py with plxnative-plextv and plxnative-discover both armed opened a person page. It sent 2 GETs (biography, credits) to the real https://discover.provider.plex.tv, carrying the mock's demo token. The real service answered 401. Nothing was written and no real account was involved, but a mock run must never reach the real provider.

Cause

plex/src/plex/discover.rs spelled its host as its own const DISCOVER. The Watchlist already resolved a loopback stand-in (plxnative-discover), but that resolution never reached the person profile and credits requests.

Fix

  • One base. account::discover() is the only place the provider's address is decided: the discover trigger, else the loopback plextv points at, else the real host. The person profile, the credits and every Watchlist request read it. ci/check-plex-requests.py (in make check) fails on the host string in non-test Rust anywhere else.
  • Dev-token boots fail closed. A devtriggers build on a dev-token boot (plxnative-token) with neither trigger armed refuses Discover reads and logs the refusal. The boot logs discover: base=real|stand-in reads=open|refused. A refused read settles the person page once, like an empty answer: no worker respawns every ~2 s and no repaint loop. The Watchlist's refused read is asked once and not retried on a timer.
  • What that costs. Such boots show no person biography and no filmography credits; this covers tv-session --guest, --guest --mock, tests/run.py --mock and real-PMS --guest scenes. Arm the stand-in to see them. This is stated once at account::permit_read, with pointers from the docs and skills.
  • Release and interactive boots are unchanged. Trigger reads compile to None without devtriggers, so a public build's URLs are byte-identical. The one interactive change is that Discover now follows a loopback plxnative-plextv redirect.
  • Mock and harnesses. tests/mock_pms.py serves /library/people/{tagKey} and .../credits with synthetic data. The demo library's real actors get a name and departments only, no invented birth dates, places or biographies. tools/screenshots.py, tools/site_video.py and tools/watchlist_captures.py refuse to drive a boot whose log does not read base=stand-in. The ui-sim skill says how to arm it.

Verification

  • Red first, each observed failing before its fix:
    • person_urls_are_built_on_the_armed_stand_in: the person URL was built on the real host.
    • the_person_reads_hand_the_transport_a_url_on_the_armed_stand_in and every_watchlist_request_site_is_built_on_the_armed_stand_in: these use a cfg(test) recorder on the request path that opens no socket. With the base swapped for the real host, all three went red.
    • a_refused_discover_read_settles_the_page_and_is_never_asked_again: got profile=5 credits=5 asks over 10 simulated seconds, now 0.
    • Three mock person-route tests in tests/test_mock_pms_discover.py.
  • Gates on the committed tree (git status --short empty before and after):
    • make check exit 0: 29 test result: lines, all 0 failed; 103 steps — all ok.
    • make check-nodef clean.
    • make check-replay: 3 fixtures, 6 replays, 0 failures. 12-filmography-detail-return is verdict=SAME on 927/927 frames; controlled boots skip the fetch.
  • One review: no blockers. Its point that the refusal costs real-PMS --guest runs the public biography is settled by keeping the fail-closed refusal and stating its cost. The terminal refused landing, the request-path tests and lint, the false sentences it listed, and its nits are all fixed here.
  • No FFI, curl option or net.rs change, so this is not a firmware-compat concern. No Makefile, Cargo, build.rs or workflow change, so no build-bench table.

Not in this PR

A stored session from a mock QR sign-in, booted later with no triggers, reads base=real; plex.tv itself is affected in the same way. Below the screens layer it cannot be told from a real session, so fixing it needs a persisted-session schema change.

🤖 Generated with Claude Code

GLinnik21 and others added 6 commits October 20, 2026 03:17
…red)

The profile and credits URLs were spelled inline on the real host, so arming the loopback
stand-in the Watchlist honours did nothing for them. Extract the two URL builders (behaviour
unchanged) and add the test that fails against them.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…token boot never reaches the real provider

The person profile and credits URLs were spelled on the real host, so the loopback stand-in the
Watchlist honours, and a redirected plex.tv, did nothing for them: a sim run against the mock sent
two GETs to discover.provider.plex.tv. The base now lives once in account.rs beside plex_tv(),
and both discover.rs and watchlist.rs read it: the plxnative-discover trigger, else the loopback
plxnative-plextv already redirects to, else the real host. A devtriggers build driven by a
dev-token boot (plxnative-token) with neither armed REFUSES the provider reads (person routes and
Watchlist GETs), logged once per endpoint shape, instead of dialling it with an identity that has
no account behind it; boot logs 'discover: base=... reads=...'. Release builds and interactive
boots are unchanged. No FFI, curl option or net.rs change: URL selection only.

tests/mock_pms.py's Discover stand-in now answers GET /library/people/{tagKey} and .../credits
with synthetic data (credits 401 without a token, as the provider does).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…oot assertion, truthful docs

The Discover base was pinned by tests of URL helpers, not of the requests the person
page and the Watchlist actually make. Now the account GET path has a recording seam
(probe_gets, no socket) and the person profile and credits are asked through the public
methods; every Watchlist request site is asked against an armed stand-in. Putting the
real host back in any of them turns those tests red (shown: the three tests fail with
the base use replaced by the real host).

The host is private to account.rs, and make check (ci/check-plex-requests.py) fails on
the Discover host spelled in any other non-test Rust, in any crate.

The simulator drivers that boot against tests/mock_pms.py (screenshots.py,
site_video.py, watchlist_captures.py) now fail the run unless the boot logged
discover: base=stand-in (mock_pms.discover_stand_in_problem, fail-closed).

The mock no longer invents a birth date, place or biography for the demo library's
real actors; its docstring lists the person routes. The request registry's evidence
lines point at the request lines. Sentences the earlier change made false or unproven
(scenarios.rs, focusfp.sh, the ui-sim skill, person.rs, the refusal's own comments) now
say what holds.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…(red)

A dev-token boot with no Discover stand-in armed has both person reads refused in-process. The
refusal comes back as a failure, so the store respawns a worker for each mailbox every ~2 s for as
long as the page is open: five asks per read over ten simulated seconds. The test counts the asks at
the host transport cut and fails with profile=5 credits=5.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ked again

The refusal of Discover reads on a dev-token boot with no stand-in armed stays (fail closed). What
changes is how the person page meets it. The refusal came back as a failure, so each of the profile
and credits mailboxes respawned a worker every ~2 s for as long as the page was open (five asks per
read over ten simulated seconds).

The person store now asks the refusal on its own thread before it spawns a worker, because the
answer is fixed at boot. A refusal lands as Landing::Refused through the mailbox and settles the
page the way an empty answer does: profiled/profile_tried and credited turn, the placeholder sweep
stops, address() stops asking, and no backoff is armed. Nothing is invented and a seeded filmography
is left alone. Controlled boots still land None on a tape without asking.

The Watchlist and catalog needed no change: a refused list read clears list_wanted when its worker
spawns and nothing sets it again, so it lands once as the unavailable read-out. A test pins it.

Every sentence about the refusal now states the decision and its cost once (such a boot shows no
biography and no filmography credits; arm the stand-in to see them): account.rs, person.rs,
docs/watchlist.md, docs/pms-api.md, the tv-session and ui-sim skills, tests/README.md, focusfp.sh.
The registry's evidence lines point at the current request lines.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 1e433c4 into main Oct 20, 2026
19 checks passed
@GLinnik21
GLinnik21 deleted the crx-discover-iso branch October 20, 2026 01:36
GLinnik21 added a commit that referenced this pull request Oct 20, 2026
…st, deep shelves, Home and Recommended Detail return) (#864)

App-tier route tests for the routes #857-#861 changed, in the World rig (real screens behind the real dispatch). Each was watched red against a stub of the production behaviour it guards (applied to the committed tree, restored, never committed).

- A released card is at exact rest on Home and Recommended after an 8-card held walk (red with Spring::land a no-op: "only the focused card is off rest, got [(0, 0, 1.0000001) ... (0, 8, 1.0899999)]").
- The same rule as conformance case eight, released_card_lands_at_rest: Tier 1 shelf and eight Tier 2 shelf screens go red with the same stub; the grid components pass by construction (one pop and one shrink spring).
- A publication that adds a shelf leaves focus on its card (guards key stability; red with an identity-minting rebuild) and the new shelf is reachable (red with sync ignoring later publications).
- A held Down through a deep Home reaches every row on a card that has landed (red with the hold band's reach at 0).
- A deep Recommended page returns from Detail onto the same published card (red with Enter::Restored passing no focus; the rows-in-view clauses live through the latched-band premise).
- Home -> Detail -> BACK lands on the card it left, at rest, with OK performed by the World pump through home_requests' guards and input::activate_deck_card -> activate_card -> open_detail (red with Enter::Restored dropping the focus, and with activate_card handing open_detail a focus-less return state). content::home_requests' arm and activate_home_item take the whole App and are not covered.

Outside the tests: test-support accessors only (HomeScreen/RecommendedScreen::probe_card_pops, BrowseStore::released_rows_for_test, World helpers), each #[cfg(any(test, feature = "test-support"))]. No production path change.

Gates on the committed tree: make check 103 steps ok, hostsim 938/0, check-nodef clean, check-replay 6/0. One review (no blockers; its should and nits fixed here). CodeQL cleartext-logging alerts on test assert messages printing fixture probe text dismissed as used in tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant