Repository navigation
Metadata detail chain runs its GETs through the client the runner resolved - #1013
Merged
Merged
Conversation
…esolved The detail job's chain no longer re-reads the server registry in every sub-fetch. StoreRunner:: start_detail reads client_for(sid) once, records that client's instance in the tape admission as it always did, and hands the very client down: finish_detail_fetch(port, addr, key, client, fetch) calls fetch(client), and fetch_full, fetch_detail, fetch_item_streams, fetch_seasons, fetch_primary_trailer, fetch_extras_rows (and its scoped thread), resolve_trailer, project_extras and fetch_related take it as a parameter. fetch_playing_item takes the client its caller (route/plan.rs build_stream) already holds. A server the registry holds no client for still launches and lands the failure, as before; finish_detail_fetch answers it without calling fetch. Semantic change, accepted: the chain used to turn every GET after a sign-out or a re-pointed slot into None; it now keeps the client it was handed for the rest of its GETs (the capture-at-the-step rule of pms::kick_with, and what ask_related does). The opening season's episodes (fetch_episodes) still resolve their own client until the season worker moves. Ledger: the eight data-metadata client_for lines (fetch_detail, fetch_playing_item, fetch_item_streams, fetch_seasons, fetch_primary_trailer, fetch_extras_rows, resolve_trailer, fetch_related) are deleted, the file's count goes 16 -> 8, and PINNED_LEDGER_TOTALS globals 90 -> 82. The detail admission bytes are unchanged (same request JSON); replay never launches a job. Tests: the pure chain tests and the panic test are handed a registered client (metadata_test_support::offline_client); a job with no client answers the failure and asks nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Five tests on two loopback PMSes (rust-modules/data/src/metadata_detail_client_tests.rs). The slot is registered against the first, its client taken as the runner takes it at the admission, and the registry then moves on: the slot re-pointed at the second server, or emptied as a sign-out does. fetch_full for a movie (extras with a trailer that needs its follow-up GET), a movie whose /extras is refused (primaryExtraKey fallback) and a show (seasons, the stream backfill's episode, extras, related) reach only the first server, whole; the signed-out movie finishes all four GETs; and fetch_playing_item reads through the client its caller holds. The show test also pins what deliberately did not move: the opening season's episodes (fetch_episodes) still resolve their own client and are the one read the second server sees (M2 empties that list). Checked against the old behaviour: with every sub-fetch asking client_for again, all five fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/sans-io.md, "The store job lane": the detail fetch chain is the first worker body to take its client as an argument (the eight client_for reads gone from data/src/metadata.rs, what the capture changes about a sign-out halfway through, the opening season's episodes still resolving their own), and a bullet for the Detail job, which carries no ClientKey and is resolved by presence once at the admission. docs/stores-as-machines.md: the paragraph that says the stores still read client_for names the chain as the exception. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… flight The old chain re-resolved its client before each GET, so after a sign-out its later GETs found no client and after a re-point they went to the slot's new client. The chain keeps the client it was handed, and the registry blanks that client's token on both events (revoke_all, and the re-point arm of register_lazy): the tail asks tokenless and lands None. A sign-out ends as it did (the requests are now sent and refused, not skipped); a re-point leaves a partial page where the old chain followed the slot to its new origin. The docs said the chain "finishes against the client it was handed". Also: the chain is not the first worker body to take its client as an argument; the Collection, Person, Hubs and subtitle-search bodies already do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The emptied-registry test no longer claims to model a sign-out (reset_servers_for_test nulls the slot and blanks no token). The runner's header says the Detail job carries no key, and the Held arm's comment says where a live job's client is resolved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The chain asks no registry bar the opening season's episodes (fetch_episodes still resolves its own client until M2), so the places that said it never asks again now say so. A re-point sends the old chain to the slot's new client, not to its "new origin". The detail-client test rig says it neither blanks a token nor models a sign-out, and its repoint helper no longer names a credential change (a same-origin retoken keeps the same client). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in #805 (player playback speed); no file it touches is one this lane changed. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…k_related resolves in its worker Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
Main carries the Metadata (#1013) and Search (#1015) store-job lanes. Both sides' additions are kept: StoreJob::Search, SaveRecents and BrowseHubs side by side in the enum, admission(), store(), take_jobs_of/has_jobs_of, the runner's start/admit_home/retire/run_held arms, and the wall list (search and section_hubs.rs). The Search and section-hubs bullets of docs/sans-io.md both stay (Browse's is the ninth store on the lane). PINNED_LEDGER_TOTALS is the real sum of the '# count:' headers at the merged tree: workers 14, globals 75, forks 58, fxlanes 11. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 24, 2026
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.
Closes #1012
The Metadata detail chain no longer asks the server registry for its client before each GET.
StoreRunner::start_detailresolves the client once, at the admission, andfinish_detail_fetchhands it tofetch_fulland on through the chain. Collection, Person, Hubs and subtitle search already work this way (#987, #990, #996, #1011). This is wave 4, step M1 of the Sans-IO series (docs/sans-io.md, "The store job lane").What changed
The chain (
data/src/metadata.rs):finish_detail_fetch(port, addr, key, client: Option<&'static Client>, fetch)takes the runner's client. With none, it logs, landsNoneand never callsfetch.client: &'static Client:fetch_full,fetch_detailandfetch_item_streams;fetch_seasonsandload_show_seasons;fetch_primary_trailerandresolve_trailer;fetch_extras_rows, which moves the client into its scopeddetail-extrasthread;project_extrasandfetch_related.client_forreads are gone.fetch_episodes). The season worker shares it, and M2 moves it.The runner (
app/adapters/stores.rs):start_detailmakes the oneclient_for(sid)call. The tape admission is built fromclient.map(instance_gen), so the recorded bytes are the same as before.launch_detailis handed that client.Heldarm resolves its own client when the held job runs.fetch_playing_item(client, sid, rk, want): its caller,build_streaminmedia/route/plan.rs, already holds the client and now passes it.build_stream's ownclient_forline onci/allow/globals/media.txtstays.No key compare:
DetailReqcarries noClientKey. Its step reads no registry, so the runner's one read is a presence check, not the key compare that Collection, Person and Hubs make. A server the registry holds no client for still launches, and its worker answers the failure without asking anything, as the old chain's first read did. The plan was to refuse such a job at launch instead. That broke seven app tests that park Detail jobs against unregistered servers, so it was dropped.What a sign-out or a re-point does to a page in flight
The old chain re-resolved its client before each GET:
None;This chain keeps the client it was handed. On both events the registry blanks that client's token in place (
revoke_all, and the re-point arm ofregister_lazy), so the rest of the chain is sent tokenless, is refused, and landsNone:Ledgers
ci/allow/globals/data-metadata.txtclient_forlines of the eight functions above deleted)PINNED_LEDGER_TOTALS(workers/globals/forks/fxlanes)No ledger line was added or edited. The eight left in
data-metadata.txtare M2-M4's:fetch_episodes,fetch_episode_page,ask_relatedand the alternate-source reads.Tests
metadata_detail_client_tests.rs, five tests against two loopback servers, A and B. Each test registers the slot at A, takes the client, then re-points the registry at B or empties it. What each pins:/extras,/related, trailer) to A, and B sees none;/extrasfalls back to the primary trailer through the same client;/library/metadata/<show>/children, M2'sfetch_episodes;fetch_playing_itemreads through the caller's client.client_forrestored, all five fail.plx_data: 1196 passed, 0 failed;plx_media: 1729 passed, 0 failed;plx_media1891 passed,plx_data1196 passed, and appreturn_hold6 andlifecycle86 passed, all with 0 failed.ci/check-deps.share green.plx_data'sdetail_clienttests pass on it.Gates
This PR's CI is the gate for
make check,check-nodef, the replay fixtures (simulators.ymlreplays every committed fixture on arust-modules/**change) and the ARM build. None of them was run locally.metadata/record.rsandtests/fixtures/replay/are untouched.One review, verdict FIX FIRST, with three should-fix findings:
make check-replaymust run" is a false positive. CI replays the fixtures (above).Three notes are also fixed: a test name and its header no longer claim the rig models a sign-out, a runner comment is reworded, and the runner's module doc states the Detail exception. One note is left for a follow-up: pinning the runner half of the capture in an app test.
A doc-claim audit found five sentences this change made false. All five are fixed here:
docs/sans-io.md, thefinish_detail_fetchdoc and the test header;docs/stores-as-machines.mdand two comments, which now say "bar the opening season's episodes";ServerId;ask_relatedalready does":ask_relatedresolves its client inside its worker, which is why it is still on the ledger.Live path
Detail pages were checked in the macOS simulator against
tests/mock_pms.py --seed 1, with real key navigation. It was a mock-only run with no real account, on a non-test build, so the fetch went throughStoreRunner::Live.metadata/1001,/related,/extrasmetadata/2006,/children,20061/children(the opening season's episodes),200611(first-episode streams),/related,/extrasseasons=2 eps=6 related=5; page drew 2 seasons/relatedNo page re-asked. This mock's
/extrasis empty, so extras and trailers could not be shown. The run was at ec1b67b, before themainmerge, which touched nothing the chain runs through. This is host-simulator evidence only, with no TV claim. No drawing code or FFI changed.Not in this PR
ask_related, and the alternate-source reads.🤖 Generated with Claude Code