Repository navigation
Metadata Related tail windows emit a store job; the runner resolves the client - #1102
Merged
Merged
Conversation
…e job An edge ask (WantRelated) and a seek (SeekRelated) are expected to leave one request on the outbox with the single-flight claim up and no worker started. Both fail on the base: the ask starts "related-tail" itself, so the outbox is empty. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ner resolves the client A Related row's tail window read (an edge ask or a seek) no longer starts the Metadata store's own worker, and its body no longer reads the server registry. The step takes the single-flight claim, as before, and leaves a StoreJob::MetaRelated on the outbox: Direct, StoreId::Metadata, the request carrying everything the worker closure captured (sid, rk, ask, the window it starts from with its cards, the keys to skip, the hubs, the ledger, the view-state stamp). The app's StoreRunner resolves the server's client once at the launch and runs finish_related_job on a worker; a server with no client still launches and its body answers the failure without a GET. The held test runner parks the kind. The port settles the claim: done lowers it and lands the window unless the reader withdrew the read; refused lowers it and the withdrawal with it, in the call that refuses, which is where the inline !spawned arm gave it back. A body that panics lands as a failure, posted outside the guard. One worker line and one client_for line leave the data-metadata ledgers, and PINNED_LEDGER_TOTALS goes workers 9->8, globals 66->65. The existing related tests that drive the store directly start their jobs through start_related_jobs, as the season tests do. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…anches, panic and withdrawal Data level: the exact request an edge ask and a seek emit, a refused job giving the claim back in the refusing call with the next edge asking again, a withdrawn-then-refused job leaving no stale withdrawal, a withdrawn job's answer dropped, no client answering the failure without a GET, a panicking body landing as a failure, and a job emitted before a Reset answering into the retired adapter. Runner level, against a loopback that answers the pager (Pms::serve_query hands its closure the query, so the X-Plex-Container-Start/Size window is honoured): started and answered once and not taped, launched live under replay, no client, held park-and-run, held with the client gone, and a cancel while parked. The Bridge entry test now also covers the Related ask and seek. The held runner parks the kind (held() and held_all()): no rig in the app, screens or hostsim tests waits on a Related landing through a real worker, so no LiveKind is added. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
docs/sans-io.md gains the Related window under "The Metadata reads" (the claim, the request, the capture-at-launch client, the port's settle of the claim, the return value, the drains and the held-runner choice) and names the kind in the admission and held-runner inventories. docs/stores-as-machines.md, the Metadata wrapper's WantRelated/SeekRelated entries, the jobs field, the shared-address note, the ask/cancel/test-seam docs, the runner's module and held() docs and Bridge::metadata_run's doc say the read is a job now. The detail chain's note that ask_related resolves its client inside its worker, which was the reason it stayed on the globals ledger, no longer holds and is replaced. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ot "a false claim" Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…usal; retire_parked_details says why a Related job is kept N1: the replay test serves a listing that answers and asserts the window slid past where it stood, so a launch that was refused, or one that dropped the client, no longer passes it. The no-client and client-gone tests count the answers waiting in the mailbox (a new test seam, related_landed_for_test) and assert exactly one failure landed: a refusal gives the claim back too and lands none. N2: the data-level no-client test asserts one answer landed before it checks that none is a window, so an empty mailbox no longer satisfies "a failure, not a window". N4: the retire_parked_details doc says what a newer Detail request does to a parked Related job. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…oc paragraphs the Related job touched are re-wrapped read_related_window derived `before` and `start` from two matches over the same `ask`; one match yields both. Behaviour is identical (a seek reads from half a window before its position and never reads backwards; an edge reads from the window's start or end by its direction). The doc paragraphs this branch edited (read_through, pages_addr, the detail chain, the runner's module and Held docs, Bridge::metadata_run) had lines left over-long or ragged by the edit; they are re-wrapped, words unchanged. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 28, 2026
Metadata M3 (#1102) landed first: the ledger sums are 7/64/58/11 (workers 8 -> 7, globals 65 -> 64) and PINNED_LEDGER_TOTALS follows. Co-Authored-By: OpenCode <[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.
Closes #1101
The Detail page's Related row no longer starts the Metadata store's own worker for its tail windows, and the window read no longer reads the server registry. Each edge or seek ask leaves as a typed
StoreJob::MetaRelated, which the app'sStoreRunnerstarts with the client it resolved at launch. This is the third Metadata PR of the Sans-IO series (docs/sans-io.md, "The store job lane").What changed
The job (
data/src/metadata.rs,data/src/stores/{metadata,mod}.rs):StoreJob::MetaRelated(Job<MetaRelatedReq>, MetaRelatedPort)is addressed by the window's send sequence (related_addr(seq), the same id space asseason_addr).Directand belongs toStoreId::Metadata. A controlled run never emits it, becausebootstrap/effects.rshas no related arm. No fixture records it, and the fixtures are unchanged.ask_relatedkeeps every guard and the claim block as before. Inside the claim it bumpsrel.sentand pushes the job where it used to callspawn_small.finish_related_jobreads through M2'sread_throughguard, so a panicking read lands as a failure. The answer is posted outside the guard.MetaRelatedPort::donelowers the claim, and it drops the answer of a withdrawn read.refusedlowers the claim and clearswithdrawnin the refusing call.The client:
read_rowovertail_page) takes the&'static Clientthe runner resolved. The runner captures it once, on the main thread, at launch; onmainit was resolved inside the worker.window: Nonewithout a GET, which is whatclient_for(sid)?inside the worker gave.Refusal (S2). A refused job leaves what a failed start leaves on
main: the claim is lowered in the refusing call, and the next edge asks again (related_addr(2)).Drains (S3). Every path to
ask_relatedisBridge::metadata_run, from the Detail screen'sWantRelated/SeekRelatedeffects, and that already drains Metadata right after its step. Onlyscreens/detail/mod.rsbuilds those commands outside tests. No bare-store caller and no fan-out reaches it; ViewState's closures send Metadata onlyApplyView, andpump_related_pagesemits nothing. No drain was added.the_bridge_metadata_run_starts_the_related_window_it_emittedpins it.The runner (
app/adapters/stores.rs):start_meta_related/launch_meta_relatedare new, in the file'sstart_*/launch_*shape. The Live arm callsclient_for(job.req.sid)once and startsspawn_small("related-tail", ..).start,admit_homeandrun_held_where.retire_parked_detailskeeps a parked Related job. Its doc now says why: the pump's item check rejects its landing, and it holds the single-flight claim until it runs, as a worker still reading would.The test runner.
held()andheld_all()both parkMetaRelated, andLiveKindis unchanged. No app rig waits on a Related landing through a real worker:detail_related_landing_tests.rslands the window withland_related_for_test.Shared test support:
Pms::serve_query(bridge_test_support.rs) hands the loopback closure the query string too, so it can honour the pager'sX-Plex-Container-Start/Size.Pms::serveis now a thin wrapper over the same spawn.start_related_jobs()(metadata_test_support.rs) copies M2'sstart_season_jobs.related_claim_for_testandrelated_landed_for_testare read-only seams besidedetail_inflight_for_test.Ledgers
ci/allow/workers/data-metadata.txtask_related::spawn_smallgone)ci/allow/globals/data-metadata.txtask_related::client_forgone)PINNED_LEDGER_TOTALS(workers/globals/forks/fxlanes)No ledger line was added or edited. M4's
request_alt_sourcesworker line and its five globals lines remain.Tests
Fails-first. 4365642 was committed first and run red on the base. An edge ask and a seek ask each leave their request on the outbox and start no worker:
New tests in
metadata_related_job_tests.rs, one for each claim path:Resetanswers into the retired adapter.The existing adopt and withdrawn-read tests still pass unchanged. Nine call sites in
metadata_related_tail_tests.rsstart their jobs throughstart_related_jobs, and no assertion was weakened.Runner tests (
adapters/stores.rs):The client tests serve
Pms::serve_query(related_listing), a loopback that answers. A worker handed the client lands a window past(0, 24), and one handed none lands a failure. Each strengthened assertion was mutation-checked on the committed tree and turned red, then reverted:client_for→Nonein the Live arm;run_held_wherearm;launch_meta_related;refusedwithoutrel.withdrawn = false;donereturning before the landing push.Not forced by a test. The OS refusing the thread cannot be forced on a host. The refusal is pinned at the port (
a_refused_related_job_gives_the_claim_back_and_the_next_edge_asks_again,a_withdrawn_then_refused_related_job_leaves_no_stale_withdrawal), and the arm is a three-line copy ofstart_meta_seasonandstart_meta_episodes.Targeted suites at 29e0933 (main has not moved since the base, 944d9c2):
The two ledger harness tests are OK, and
ci/check-deps.shis green.Gates
This PR's CI is the gate for
make check,check-nodef, the replay fixtures and the ARM build. They were not run locally.Review. One review, verdict MERGE, with four notes and no blocker:
retire_parked_detailsnow says why a Related job is kept.Doc-claim audit. The writer fixed every inventory that named the M2 kinds:
docs/sans-io.md, in five places, anddocs/stores-as-machines.md;held()andHeld;Bridge::metadata_runand thestores/metadata.rs//!;jobsfield,pages_addr,read_through,ask_related,cancel_relatedandland_related_for_test;ask_relatedresolves its client inside its worker.An independent audit afterwards found no contradictions.
Live path
Checked in the macOS simulator at a 960x540 window against a fresh
tests/mock_pms.py --seed 1 --movies 120, with plex.tv and Discover pointed at the mock and a placeholder token. The identity lines, read before any key, wereversion=1.41.0.0000-syntheticandowned=1.The app booted into movie 1001's Detail page with focus on the Related row, and 125
rightpresses walked to the last card. The mock read/library/metadata/1001/similarnine times, at nine distinct start offsets: 8, 31, 43, 55, 67, 79, 91, 103 and 115. Each window was read once, with no repeat. The row grew from the 8-card head to the end of the listing, there was nostores: WARNand no panic, and the reads went through the production Live arm.This is host-simulator evidence only, with no TV claim. No drawing code or FFI changed.
Not in this PR
request_alt_sources, the alt pruning).🤖 Generated with Claude Code