Skip to content

Watchlist W-1: the stores take the seated profile and its identity from the Bridge (#1107) - #1108

Merged
GLinnik21 merged 4 commits into
mainfrom
sansio/store-jobs-watchlist-w1
Oct 28, 2026
Merged

GLinnik21 merged 4 commits into
mainfrom
sansio/store-jobs-watchlist-w1

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Closes #1107

The Watchlist and catalog stores no longer read the session registry to learn whose list they read. The Bridge reads it in app code (the ledger scan does not cover it) and hands the stores the value. This is the first of the Watchlist's two PRs in the Sans-IO series (design row W-1, S5). It adds no job kind and no runner arm: the worker jobs, find, guid_of, copy_rank and the clock read are W-2's and are untouched.

It copies the Browse pins (#1106) shape: one Bridge reader per entry point, run(cmd) keeping its signature for callers that cannot reach the read (refusing the impossible command with a debug assertion and a log line), and run_with_input as the stepping entry.

What changed

The input (data/src/watchlist.rs):

  • WatchlistInput { profile: Arc<CurrentProfile>, auth: Option<WatchlistAuth> } is a pure value. WatchlistInput::new(profile, credential, client_id) carries the rules capture() had (no user, no credential or an empty client id means no auth).
  • WatchlistAuth::is_current(&self, now: &CurrentProfile) is a pure comparison of generation, id and uuid (what the base compared).
  • WatchlistAuth::capture is deleted. capture_auth / is_current leave WatchlistIo and CatalogIo, with LiveIo's and LiveCatalogIo's impls.

The Bridge (app/bridge.rs, app/watchlist.rs), two helpers because the two kinds of call need different amounts:

  • Bridge::seated_profile() is current_snapshot(), an Arc clone. It goes to the two per-frame passes (WatchlistStore::pump_with_gate(gate, &profile), CatalogStore::pump(&profile)). They never capture, so they need no more, and an Arc clone is what keeps them cheap every frame in every route.
  • Bridge::watchlist_input() builds the profile and Option<WatchlistAuth> from ONE snapshot, plex_tv_credential(&user) and peek().client_id. It is called only where a capture can happen, and never kept, so a capture reads the credential at the moment it is made, as before. plex_tv_credential is a peek() read in disguise (legacy-owner fallback), so it is called here and nowhere in data/.
  • Callers of watchlist_input(): watchlist_feed (page mount), watchlist_open_if_idle, catalog_feed (mount), and Bridge::catalog_open.

Signatures:

Site Signature
WatchlistStore::run(cmd) unchanged. Press, Sort, Filter, Window, Reread and Reset cannot capture or check. Open through it is refused (debug assertion, log line)
WatchlistStore::run_with_input(cmd, &WatchlistInput) new, the stepping entry
WatchlistStore::pump_with_gate(gate, &CurrentProfile) takes the profile
watchlist Machine::step Cmd goes through run; Pump is refused (nothing sends it, and a pump handed no profile would read as a sign-out)
watchlist_tee fan-out unchanged (apply_edit only)
CatalogStore::open(hex, &WatchlistInput) takes the input
CatalogStore::pump(&CurrentProfile) takes the profile
CatalogStore::take_reopen() new

The catalog re-open, which keeps the same-frame behaviour. Catalog pump used to call open itself on a profile switch noticed while a landing was in hand. It now captures nothing: it drops the landing, clears the identity, records the title as owed a read and returns true, as before. Bridge::catalog_pump calls take_reopen() and then its own catalog_open(hex), which reads the input then and starts the job, all in the same call. open and reset clear the owed title.

Decisions (and why)

  • Profile every frame, auth only at Open (not "build both on every call"): the credential, client id and user clone are 4-5 allocations, and the two pumps run every frame in every route with nothing to capture. The pumps cannot capture (a watchlist reset leaves auth = None and the next Open captures), so they take the profile only.
  • The seams leave rather than keep capture_auth / is_current, so no registry read is left under a scanned function. Tests feed the input through one constructor family (WatchlistInput::for_test, signed_out_for_test, profile_for_test).
  • Catalog pump stops re-opening by itself rather than taking the full input every frame, for the same cost reason. The Bridge's drain is the only non-test caller of CatalogStore::pump.
  • Unchanged from the base (stated so a reviewer does not file them as regressions): is_current compares generation and user id/uuid only (a same-profile token refresh does not move the generation); the held WatchlistAuth (including the write path's) is the one taken at the last Open; after a switch the Watchlist store sits Idle until the next Open.

Ledgers

Before After
ci/allow/globals/data-watchlist.txt 6 3 (capture::current_snapshot, capture::session::peek, is_current::current_snapshot deleted)
PINNED_LEDGER_TOTALS 7/60/58/11 7/57/58/11

The three lines that stay are W-2's: copy_rank::current_server, find::client_for, guid_of::client_for. The replay fixtures are unchanged (git diff --stat origin/main -- tests/fixtures/replay is empty).

Tests

Red first (C0 5d69467b7, on the base; the helpers' bodies are the base's own calls, so each test hands a profile or identity that disagrees with the scripted seam):

  • make test-crate C=plx_data T=handed: test result: FAILED. 6 passed; 4 failed; 0 ignored; 0 measured; 1275 filtered out; finished in 0.12s (a_profile_switch_is_noticed_from_the_handed_profile, open_captures_the_handed_auth for each store, a_switch_noticed_from_the_handed_profile_drops_the_landing)
  • make test-crate C=plx_data T=an_input_with_no_auth: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1284 filtered out; finished in 0.00s

Green on the committed tree (git status --short empty):

  • make test-crate C=plx_data: test result: ok. 1290 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 12.99s
  • make test-crate C=plxnative_modules: test result: ok. 1087 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 25.77s
  • make test-hostsim T=return_hold: test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 1196 filtered out; finished in 0.16s
  • make test-hostsim T=lifecycle: test result: ok. 88 passed; 0 failed; 0 ignored; 0 measured; 1114 filtered out; finished in 4.03s
  • python3 tests/test_harness.py -v DepGates.test_ledger_totals_match_the_pinned_table DepGates.test_ledger_count_header_must_equal_its_entries_in_every_area_file: Ran 2 tests ... OK
  • bash ci/check-deps.sh: check-deps: all gates green (globals (57 sites)); python3 ci/check-module-layers.py: green

What pins what:

  • the same-pass switch, per store: a_profile_switch_is_noticed_from_the_handed_profile and a_profile_switch_rotates_the_epoch_and_clears_everything (watchlist); a_switch_noticed_from_the_handed_profile_drops_the_landing and a_landing_for_a_switched_profile_asks_again_under_the_new_one (catalog); Bridge: a_profile_switch_is_noticed_in_the_frame_pass_and_the_new_profile_reads_once, the_bridge_catalog_entry_points_start_the_read_they_emitted_in_the_same_call;
  • a landing with an older generation is dropped: a_landing_tagged_with_the_old_generation_is_dropped_after_a_switch;
  • sign-out to NoAccount: a_sign_out_resets_the_pass_and_the_next_open_is_no_account, an_input_with_no_auth_is_no_account, a_switch_to_a_profile_with_no_credential_reads_nothing;
  • the owed re-open: a_reopen_owed_by_a_pass_is_taken_once_and_cleared_by_an_open, an_owed_reopen_with_no_credential_reads_unreachable; the guard: an_open_sent_through_the_inputless_entry_is_refused.
    The Bridge-level rigs seat a scratch session and a published profile (Bridge::seat_watchlist_account_for_test), because the helper reads the real registry.

Gates

Not run here (delegated to CI, per the lane rules): make check, make check-nodef, make check-replay, the ARM make. No FFI is touched. The doc-claim audit was done by hand over docs/sans-io.md (the Catalog "still reads" bullet was replaced by "The Watchlist and catalog session input"), docs/watchlist.md and the //! / /// of the touched files.

Live path (macOS sim, 960x540, mock Discover stand-in; no TV, no real plex.tv)

A fresh tests/mock_pms.py in-process on its own port (--home-users 2 --authorize-after 2 equivalent), plex.tv and Discover at the mock, a fresh scratch root. Identity lines read before any key: a synthetic PMS version (version=1.41.0.0000-synthetic), owned=1, discover: base=stand-in reads=open. A stored Home session of two profiles, booted with plxnative-pickuser=1:

  1. the Watchlist page lists the stand-in's items (14 tiles, one watchlist: list page 0 -> full read line, one /library/sections/watchlist/all read at the mock);
  2. switching profile through the app's own path (profile chip, Change profile, the picker) seated the other profile (chip A to D); the mock saw exactly one list read per profile, none in between, and the page listed the stand-in's items again after the next Open. The store emptying in the very pass is pinned by the Bridge test above, not by a screenshot: the switch leaves the page for the picker;
  3. a title's Detail (opened from a Watchlist tile) shows its Watchlist state (bookmark disc with the remove face). That title is on the mock server, so it exercised the Watchlist store's membership, not the catalog page's own open; the catalog store's input is covered by the unit and Bridge tests.

Every sim process was killed by the driver; the mock ran in the driver's process.

Not in this PR

W-2: the five worker kinds as jobs, find / guid_of / copy_rank and the clock read in the step. The server_ids / server_probe_result / server_roster_gen / server_facts_gen reads stay.

🤖 Generated with OpenCode

GLinnik21 and others added 4 commits October 28, 2026 15:04
Five tests that hand the stores a profile or an identity that disagrees with
the scripted seam and fail on the base, which asks the seam. WatchlistInput is
the pure value the Bridge will read and hand over; the helpers that pass it
have the base's own calls as bodies.

Co-Authored-By: OpenCode <[email protected]>
…om the Bridge (C1)

WatchlistAuth::capture, is_current and the two IO seams' capture_auth and
is_current leave data/. The Bridge reads the registry in app code: seated_profile
(an Arc of the published profile) is handed to both stores' frame passes, and
watchlist_input (the profile, plex_tv_credential and the client id, from one
snapshot, built per call) to the steps that can capture: the Watchlist's Open and
the catalog's open.

WatchlistStore::run keeps its signature for every command but Open, which it
refuses with a debug assertion and a log line; run_with_input is the stepping
entry. The catalog pass captures nothing: a landing for a switched profile is
dropped and the title owed a read, which Bridge::catalog_pump opens again in the
same call (take_reopen).

Three globals lines leave data-watchlist.txt; PINNED_LEDGER_TOTALS goes
7/60/58/11 -> 7/57/58/11.

Co-Authored-By: OpenCode <[email protected]>
@GLinnik21
GLinnik21 merged commit 5c76ae0 into main Oct 28, 2026
26 of 28 checks passed
@GLinnik21
GLinnik21 deleted the sansio/store-jobs-watchlist-w1 branch October 28, 2026 12:42
Bardioc1977 added a commit to Bardioc1977/plx-native that referenced this pull request Oct 28, 2026
Merge main (plxnative#1103, plxnative#1106, plxnative#1108, Polish locale and the playback work) into the owner-stamp branch.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Heiko Kopp <[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.

Watchlist and catalog: take the seated profile's auth as an input instead of reading the session

1 participant