Repository navigation
Person store: emit store jobs and read the server registry as an input - #990
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 Person store no longer starts its own worker and no longer reads the client registry inside its step. Its pump emits one typed StoreJob::Person per request, in ascending slot order, and the app's StoreRunner starts it. - PersonReq names the request (slot, generation, args, guid, and the work: a plex.tv profile or credits read with the identity the step decided on, or a read of one registered server with the ClientKey it decided on). PersonPort lands the answer into the adapter slot it was emitted for, and its refusal releases only that generation's claim. - The step decides from ClientKeys the Bridge refills right before the call (the scaffolding the collection lane added). A source whose server holds no client emits nothing and backs off, as before. - Bridge::person_pump refills the keys, steps, and starts the person jobs in the same call, so the tape's admissions keep their cross-store order. - The runner resolves the client inside the tape's launch closure and compares it with the job's key; a mismatch is a refused admission. Parked person jobs survive a newer Detail request and are re-resolved when run. - finish_person_job is the old worker body, moved to the runner side: the Controlled identity answers the failure value without a read. Admission records are byte-identical to the base tree's (pinned by a Bridge-level test that passes on both trees). What stays in the step: tape::active, session::peek_settled, session_watch, the synchronous discover-refused landing, server_ids and server_roster_gen. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The collection lane's stage B and review fixes retire its own ledger lines and pins; this branch needs them so ci/check-deps.sh sees no stale collection line. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Delete ci/allow/{workers,globals}/data-person.txt (both held only the lines
the store job lane removed; the fork lines stay, the fetch bodies stay in
data/). PINNED_LEDGER_TOTALS goes to the real sums with the collection lane
merged in: workers 22, globals 97.
docs/sans-io.md: Person is on the store job lane; PersonPort carries the slot
and the generation because several Person jobs are out at once; the Person
step is not pure and the section lists the reads it keeps (tape::active,
session::peek_settled, the session watch, the refused-discover landing,
server_ids, server_roster_gen). Comments that said the pump or the person
store spawns a worker now say it emits a job, and the capture-at-spawn rule
that left the step lives on the runner's resolve helper.
Co-Authored-By: Claude Sonnet 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]>
…y test The rig's pump is step() plus run_jobs(), and run_jobs() hands each job to finish_person_job, bypassing tape::admit, so the test's tape::finish() assertions (no requests, no failure) could no longer see anything a controlled step emitted. Step alone and assert_fx!(jobs, []) puts the 'no request' half back where it can be observed. The person also carries a guid now, so the two plex.tv reads WOULD be wanted if the profiled/credited flags were not honoured (address() is None for an empty guid whatever the flags say); with address() ignoring profiled, the test fails on the outbox. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…to sansio/store-jobs-person Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s-person Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s-person Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The list of what the Person step still reads omitted
plx_base::devtrig::read("personcredits"), which seed_dev_credits makes on every
pump while a person is open and no tape is armed (dev-trigger builds only).
Review note F3.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Behaviour-identical cleanups from the pre-PR simplify pass:
- PersonPort::of and the cfg(test) at_for_test collapse into one private PersonPort::to.
- local_landing takes the key list by value, so the Roles landing moves it instead of cloning.
- The test owner drops its stored keys and its second run path: step is step_with over the
registry's keys, run_jobs unwraps through person_jobs; holding() and media_job() replace
eight repeated key literals and three repeated open/step/find preambles.
- Comments that narrated the migration ("as the worker did before", "the old pump") state the
present behaviour; the plex-layer docs no longer name the data layer's launch mechanism; the
K_RESOLVE note names the places a new kind now edits.
- bridge.rs uses the imported StoreId.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
Records the squash on the branch; its tree is already in (c9b61f8's tree is byte-identical to 10e9287's). 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
GLinnik21
added a commit
that referenced
this pull request
Oct 24, 2026
#990 deleted the data-person ledger files and set the pins to workers 22 and globals 97. Take those, and restate this diff's pin comment and the docs/sans-io.md sentence as the change's own net effect (-3 deleted, +3 seeded, net zero) instead of naming a total other lanes move. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 24, 2026
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 #989
The Person store no longer starts workers or reads the server registry from inside its step. It now emits one typed
StoreJob::Personper fetch slot, and the app'sStoreRunnerstarts them. This is the lane Detail took in #975 and Collection in #987. It is wave 1, store 2 of the Sans-IO series (docs/sans-io.md, "The store job lane"), and it reuses #987'sClientKeysinput and per-store drains unchanged.What changed
The step.
maybe_spawnkeeps everything that comes before the start: the busy andretry_cdchecks, the address, the plex.tv branch with its session early return, the claim, and the synchronous refused landing. Then, instead of spawning, it pushes aJob<PersonReq>.ClientKeythe step chose. When a source's server holds no key, the step backs offRETRY_FRAMESwithout claiming.Controlled, or the settled session.Addressing.
Addr.reqis a per-state wrapping sequence, so every job's address is unique. The slot and the person generation travel inPersonPort, anddone/refusednever read the address. The tape's admission JSON takes itsgenfrom the request, so the recorded bytes are unchanged.The runner.
start_personadmits through the tape.ClientKey::of(c)still matches the job's key. Otherwise it records"admitted":false, andPersonPort::refusedreleases only that generation's claim.The job body.
finish_person_jobholds the old worker body.Controlledanswers the failure value without a read.Settledrunsfetch_profile/fetch_creditsundercatch_unwind.PersonAnsweris opaque, soLandingstays private.The Bridge.
Bridge::person_pumprefills the keys, steps, then runsstart_store_jobs_of(StoreId::Person), all in one call. Person still pumps before Collection and the Detail reconciliation, so the tape's cross-store admission order holds.Not pure yet. The Person 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 only,devtrig::read("personcredits"). docs/sans-io.md lists these reads and claims no purity for Person.fetch_profile/fetch_creditsstay indata/, so theforkslines stay.Ledgers
ci/allow/workers/data-person.txtmaybe_spawn::spawn_small×2)ci/allow/globals/data-person.txtmaybe_spawn::client_for)PINNED_LEDGER_TOTALS(workers/globals/forks/fxlanes)Tests
Nineteen new tests:
10 step tests in
data/src/person.rs, over theassert_fx!contract:7 runner tests in
app/adapters/stores.rs: admitted and answered once; plex.tv admitted whatever the registry holds; a declined admission refused once with its claim back; owed under replay; a moved-on client not started; parked Person jobs survive a newer Detail request; a parked job whose client is gone is refused.2 Bridge tests in
app/person_admission_tests.rs:Both pass on the pre-change tree and on this branch, so the admissions are equal.
controlled_person_ignores_ambient_session_recoverynow steps and pins the outbox empty, instead of running the jobs inline past the tape. Making the profile arm ignore its flag fails it.The
datatest rig runs emitted jobs inline throughfinish_person_job, so the sleeps anddrain_workers_for_testcalls are gone.Gates, run on the committed tree
Run on head
c9b61f80b. That head carries the stacked re-base onto #987's squash andmainate843b99f1, the one-line docs addition, and a behaviour-identical simplify commit. The simplify commit merges the port constructors intoPersonPort::to, moves the Roles key list instead of cloning it, adds test helpers, and rewords comments.make checktest result:line reports 0 failed. The application crate passed 957 tests (default features) and 1070 (hostsim). check-deps reports workers 22, globals 97, forks 60, fxlanes 11 and "all gates green".make check-nodefmake check-replayverdict=SAME, with every*_diffs=0. No fixture changed, including fixture 12.make(ARM, tvdev)pkg/plxnativelinkedOne review, verdict FIX FIRST. Its two should-fix findings are in this branch: the controlled-step outbox pin and the live-path proof below. Its two notes are covered by the docs line and the re-base.
Live path
Replay never launches a job, so the live runner was checked in the macOS simulator against
tests/mock_pms.py --seed 1, with plex.tv and Discover pointed at the mock.The mock saw each of these once, with no re-ask and no refusal loop:
GET /library/people/19/media;GET /library/people/<guid>(200);GET /library/people/<guid>/credits, which answered the mock's 401 for a token boot without an account token;GET /library/metadata/<26 keys>.The capture shows the biography header and the Movies (22) and Shows (4) shelves.
The proof does not show a successful Credits landing (unit tests cover it) or a cross-server Resolve read (one server). It is host-simulator evidence only, with no TV claim. No drawing code or FFI changed.
🤖 Generated with Claude Code