Repository navigation
Collection store: emit store jobs and read the server registry as an input - #987
Merged
Merged
Conversation
The store-agnostic pieces the Person and Collection stores need to move onto
the store job lane (the lane Metadata's detail fetch already uses).
plx_plex::plex::{ClientKey, ClientKeys}: the registry's answer for every
server slot as a plain value, so a store's step decides from an argument
instead of reading client_for itself. ClientKey is (instance, token): the
client object plus the credential it held. There is deliberately no reader on
the type; the application fills one in place from the live registry
(adapters::stores::refill_client_keys), and the Bridge owns the one buffer so
a pump that runs every frame allocates nothing for it.
Fetch::release_for(gen): a refusal hands back the claim of the request it
answers and leaves a newer request's claim alone.
Stores::take_jobs_of(StoreId) and Bridge::start_store_jobs_of(StoreId): a
store's Bridge pump drains only its own outbox, in the same call as its step,
so a job some other sender left behind is still found and counted by the
backstop instead of being started silently. take_jobs / has_jobs now walk
StoreId::ALL, so a store joins the aggregate in one place. metadata_run drains
its own store this way (the same jobs today: only Metadata has an outbox).
The backstop and frame-check texts name every drain, not only metadata_run.
The runner's parked-job handling (retire_parked_details, run_held) is a match
over every job kind, so a store that joins the lane must say what a newer
detail request does to its parked jobs.
store_admission_tests: pins the tape admission a pumped collection records as
literals (rating-key open, tag open, unregistered server). Written against
signatures that do not change when Collection moves onto the lane, so the same
file runs on both sides of that change.
Two dead-code expectations (the keys buffer and its refill) are fulfilled by
the next commit, which removes them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The collection store's step no longer starts a worker and no longer reads
the client registry. Its pump claims the fetch and pushes a typed
StoreJob::Collection (CollectionReq: server, the ClientKey it decided on,
the work) on an outbox; Bridge::collection_pump refills the Bridge's
ClientKeys, steps, and hands the job to the StoreRunner in the same call.
- CollectionReq / CollectionPort / CollectionAnswer / finish_collection_job
in plx_data::collection. Addr.req is the listing generation (one fetch is
out at a time). done() lands the answer stamped with that generation;
refused() releases only that generation's claim (Fetch::release_for).
- CollectionStore::{run, pump} take &ClientKeys; Open and the pump's
client-changed check compare ClientKey values instead of calling
client_for. ViewState reaches the store through view_edit_collection,
which only forwards ApplyView and passes no keys.
- The runner admits the request through the tape in the recorded shape
(byte-identical to the old inline admission) and resolves the client
inside the launch, accepting it only if it is still the client the step
named. A Held runner parks the job; a newer Detail request retires only
parked Detail jobs and keeps the rest.
- Contract tests for the emitted jobs (assert_fx!), the admission shape,
refusal and supersede handling, and the runner's four outcomes; the
Bridge-level admission test from the previous commit passes unchanged.
- The lifecycle rig that walks a collection page runs the held jobs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e lane Collection's step emits its request as a store job and reads the client registry as an input, so its four ledger lines are gone: the worker start (`workers`, 25 to 24) and the three `client_for` reads (`globals`, 101 to 98). Both area files held nothing else and are deleted; PINNED_LEDGER_TOTALS follows, forks and fxlanes unchanged. The `wall` clock-read gate now scans data/src/collection.rs (no hit). docs/sans-io.md "The store job lane" names Collection as the second store, ClientKeys as the input for a registry read, the per-store drain inside each Bridge pump (refill keys, step, start_store_jobs_of) and the generic backstop. CollectionStore's unreached Machine::step comment no longer says empty keys strand a job (they fail the page; real keys without a drain strand it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s revision a_server_without_a_client_emits_nothing_reads_failed_and_holds_off asserted Failed, no job and no claim, then pumped with empty keys, which emit no job whether or not retry_cd was set. It now asserts that the revision does not move across the RETRY_FRAMES - 1 held-off pumps and does move when the hold-off ends. With the `self.retry_cd = RETRY_FRAMES` line removed from maybe_spawn's no-client branch the test fails (revision 3 against 2); with it, it passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… first The Bridge-level admission pins opened and pumped a collection alone, so the order across stores inside one frame (the positional tape comparison) was pinned on no tree. One test opens a person and a collection, pumps person_pump then collection_pump inside one FrameScope and compares tape::finish() with the full literal list: the person's three requests in slot order (the shapes fixture 12 records), then the collection's header read. It uses only signatures that exist on the base tree. Swapping the two pumps makes it fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The job tests import Job and Port that the parent module's glob already supplies, the Bridge spells StoreId in full where the file imports it, and the client_keys module doc narrated what the step "used to" do. Names and wording only; no behaviour, expectation or ledger line moves. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
…s-person Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
#990) The Person store no longer starts workers or reads the server registry from inside its step. It emits one typed StoreJob::Person per fetch slot, which the app's StoreRunner starts, the lane Detail took in #975 and Collection in #987; wave 1, store 2 of the Sans-IO series, reusing #987's ClientKeys input and per-store drains unchanged. The step: maybe_spawn keeps the busy and retry_cd checks, the address, the plex.tv branch with its session early return, the claim and the synchronous refused landing, then pushes a Job<PersonReq>. A pump emits at most one job per wanted slot, in ascending slot order, up to the fan-out width. A server read carries the server and the ClientKey the step chose; with no key the step backs off RETRY_FRAMES without claiming. A plex.tv read (Profile, Credits) carries the identity the step decided on: Controlled, or the settled session. Addr.req is a per-state wrapping sequence; the slot and the person generation travel in PersonPort, and the tape's admission JSON takes its gen from the request, so the recorded bytes are unchanged. The runner: start_person admits through the tape. A server read starts only if ClientKey::of(c) still matches the job's key; otherwise it records "admitted":false and PersonPort::refused releases only that generation's claim. The Held lane re-resolves the client and refuses on a mismatch, and a newer Detail request leaves parked Person jobs alone. finish_person_job holds the old worker body: Controlled answers the failure value without a read, Settled runs fetch_profile/fetch_credits under catch_unwind, a server job runs the Resolve, Media or Roles read with its chunking kept, and a server job handed no client is refused. PersonAnswer is opaque. Bridge::person_pump refills the keys, steps and drains StoreId::Person in one call, still before Collection and the Detail reconciliation, so the cross-store admission order holds. Not pure yet: the step still reads tape::active(), session::peek_settled(), the session watch, the refused-discover landing, server_ids(), server_roster_gen() and, in dev-trigger builds, devtrig::read("personcredits"); docs/sans-io.md lists them and claims no purity for Person. Ledgers: data-person's workers (2) and globals (1) files deleted; PINNED_LEDGER_TOTALS 24/98/60/11 -> 22/97/60/11. Tests: 10 step tests in data/src/person.rs (slot order and width, the no-key back-off, plex.tv identity, unique addresses across a reset, a pre-reset port lands only into the old adapter, a refusal releases only its own claim, the admission record in fixture 12's shape, a controlled read without IO, a clientless server job refused); 7 runner tests in app/adapters/stores.rs; 2 Bridge admission-order tests that pass on the pre-change tree and on this branch. The controlled-session test now steps and pins the outbox empty. Fixture replays all SAME; the live runner loaded a Person page's Media, Profile, Credits and batched Roles reads once each against the mock server in the macOS simulator. Closes #989 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 24, 2026
Closed
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
…he step can observe (#996) The subtitle-search and view-reconcile stores no longer start workers or read the server registry from inside their step. Each emits a typed store job that the app's StoreRunner starts, the lane Detail (#975), Collection (#987) and Person (#990) took; wave 2, lane A of the Sans-IO series. A refusal the step can observe: Fetch::refuse_for(gen) releases that generation's claim and records the refusal, only when the claim is its own; Fetch::take_refused(gen) answers once, and a refusal for a superseded generation frees and records nothing. These stores back off RETRY_FRAMES after a refused start, and the backoff survives the start leaving the step. Subtitle search: maybe_spawn claims and pushes Job<SubSearchReq> with the server and the ClientKey the step chose; pump reads take_refused before maybe_spawn and backs off one pump later, with no respawn spin; the no-client branch is unchanged; finish_subsearch_job runs under catch_unwind. View reconcile: kick pushes Job<ReconcileReq> per server batch. A landing is Landing { id, outcome } with Outcome::{Read, NotStarted}; a refused or key-mismatched flight posts NotStarted, which requeues its leaves and parents (an item asked for again goes back as an item), drops the dirty marks it covered, backs off and settles nothing. reset() keeps a job still on the outbox, which answers into the retired adapter. The runner resolves the client inside the launch and starts a job only if ClientKey::of(c) still matches; both kinds are untaped and launch live under replay; Held parks them, run_held re-resolves or refuses, and a newer Detail request leaves them parked. Bridge::subsearch_pump and reconcile_pump refill the keys, step and drain their own store in one call. Ledgers: data-subsearch's and data-viewreconcile's workers and globals files deleted; PINNED_LEDGER_TOTALS 22/97/60/11 -> 20/95/60/11. The wall gate scans data/subsearch.rs. Tests: 36 new (Fetch refusal 4, subsearch job 8, view reconcile job 11 plus 1 parents test, runner 12), and the stop-after-identity-change regression test now sweeps the parked read-back. Fixture replays all SAME; in the macOS simulator against the mock server, a watched-state read-back and a player subtitle search were each sent to the runner, ran and landed. Closes #995 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 #984
The Collection store no longer starts a worker or reads the server registry from inside its step. It emits a typed
StoreJob::Collection, which the app'sStoreRunnerstarts, the same lane the Detail store took in #975. This is wave 1, store 1 of the Sans-IO series (docs/sans-io.md, "The store job lane").Shared pieces every later store reuses
The first commit (
ca9fe8a5f) is store-agnostic.ClientKeyandClientKeys(plx_plex::plex):ClientKey { instance, token }names a client and its credential:instance_gen(), thentoken_gen().ClientKeysmaps each server to its key.adapters::stores::refill_client_keysrefills it in place just before a store step, and it is the only loop over the registry.Fetch::release_for(gen)releases a claim only if it was made for that generation.Stores::take_jobs_of(StoreId)takes one store's outbox;take_jobsandhas_jobswalkStoreId::ALLthrough it.Bridge::start_store_jobs_of(StoreId)starts that store's jobs.StoreRunnermatches on the job. A newer Detail request retires only parked Detail jobs, never another store's.Collection
maybe_spawnno longer spawns. With a key for the server, it claims the generation and pushesJob<CollectionReq>. The request carries the server id and theClientKeythe step decided on. Without a key, it holds offRETRY_FRAMESand showsFailedif nothing is on screen.run,pumpandrefresh_if_client_changedtake&ClientKeys, so the threeclient_forreads are gone.resolve(sid, key)and starts the job only if the registry still answers that exact client. Otherwise it records"admitted":falseand refuses the port, andCollectionPort::refusedreleases the claim.finish_collection_jobruns the IO undercatch_unwind, falls back to a transport failure, and answers throughCollectionPort::done.CollectionAnsweris an opaque newtype, soLandingstays private.Bridge::collection_runandBridge::collection_pumpfollow refill keys → step → drain.CollectionStore's unreachedMachine::step, and ViewState'sApplyViewclosures.ApplyViewreads no key, and adebug_assert!guards it.Ledgers and gates
ci/allow/workers/data-collection.txtmaybe_spawn::spawn_small)ci/allow/globals/data-collection.txtclient_for×3)PINNED_LEDGER_TOTALS(workers/globals/forks/fxlanes)ci/check-deps.sh'swallgate now scansdata/src/collection.rstoo, with zero hits. docs/sans-io.md describes the key input, the per-store drains and the store's unreachedMachine::step.Tests
data/src/collection_job_tests.rs(10 tests):RETRY_FRAMES - 1pumps, then moves. Withretry_cdremoved, the test fails.a_collection_job_whose_client_the_registry_has_moved_on_from_is_not_started.store_admission_tests.rspins the recorded admission literals, includinga_frame_with_a_person_and_a_collection_admits_the_person_first, which checks the full cross-store order in one frame. It passes byte-equal onmain(with the file and its three-linemoddeclaration added) and on this branch. Swapping the two pumps fails it.collections_page_to_member_ok(hostsim) now runs the parked store jobs between frames. The Held runner parks collection jobs, so before this the member never landed.Gates, run on the committed tree
Run on head
ec40c78bb, which includes a merge ofmainat3e6665a53and a names-only simplify commit:make checktest result:line reports 0 failed. The application crate passed 948 (default features) and 1061 (hostsim). check-deps reports workers 24, globals 98, forks 60, fxlanes 11, "all gates green".make check-nodefmake check-replayverdict=SAME, every*_diffs=0. No fixture changed (fixture 12 included).make(ARM, tvdev)pkg/plxnativelinkedOne review, verdict FIX FIRST. Its three should-fix findings are in this branch: the live-path proof below, the cross-store admission test, and the observed hold-off.
Live path
Replay never launches a job, so the live runner was checked separately in the macOS simulator against
tests/mock_pms.py(--movies 240), booted straight into collection50001with no plex.tv or Discover reach.GET /library/metadata/50001(the header job) and one 60-itemGET /library/collections/50001/children(the children job). There was no refusal loop and no re-ask.refused,panicormismatchline.This is host simulator evidence only, with no TV claim. The change touches no drawing code and no FFI.
🤖 Generated with Claude Code