Repository navigation
Browse: the Library's source discovery leaves as a typed store job (B-D) - #1103
Merged
Merged
Conversation
Every Bridge entry that steps the Library's source discovery must start the read through the application's runner: four tests refuse the launch with the runner's seam and expect the claim down in the same call (red on the base: spawn_discovery ignores the seam, and a controlled run records the launch as admitted). Two pins that are green on both sides: the counts request's recorded bytes, and a refused discovery's backoff of exactly SRC_RETRY_CD steps. Co-Authored-By: OpenCode <[email protected]>
maybe_discover_owned no longer reads the server registry or starts a worker: it takes the server's ClientKey from the borrowed ClientKeys, raises the discovery claim (now a Fetch<()>, its slot unused because the answer still lands in src_result and the claim drops at apply) and leaves a StoreJob::BrowseDiscovery. The runner resolves the key at launch and hands the body the client; a launch that cannot start is refused, the claim comes back in that call, and the store's next step settles it with the same 600-step backoff, before the countdown's decrement and without an invalidation. The job is admitted Home from the controlled arm (admit_home_jobs, inside the arm, so the recorded line keeps its place) and Direct from Bridge::browse_discover_pump, which the live arm, frame_ingest and boot now go through. The recorded descriptor keeps its keys and values. Removes DiscoveryRequest, execute_discovery, spawn_discovery and the REFUSE_DISCOVERY_FOR_TEST seam, rewrites the tests that used them on the new seams, deletes the data-browse workers ledger (its only line) and one globals line: PINNED_LEDGER_TOTALS 9/66/58/11 -> 8/65/58/11. The wall gate covers discovery_job.rs. LiveKind::BrowseDiscovery keeps discovery live under held(). Co-Authored-By: OpenCode <[email protected]>
Eight runner tests over the live, held and refused starts and the replayed refusal, and four admission tests: the record and replay of the sections request, a mismatched line failing the run, and the encoder encoding only the discovery pump. Co-Authored-By: OpenCode <[email protected]>
The doc-claim audit by hand: sans-io.md (the lane list, a new discovery lane bullet, Home admission, the held runner), stores-as-machines.md, the runner's module docs, the browse module docs and the two comments that named spawn_discovery. Co-Authored-By: OpenCode <[email protected]>
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]>
…launcher Co-Authored-By: OpenCode <[email protected]>
…sync, drain test, docs) A refusal is settled before the step's roster sync, so a re-pointed client re-arms the source and it is asked again at once, as the launcher's in-call backoff always allowed. The frame_ingest drain test runs on a screen that asks for no discovery itself and checks a read was asked. Two docs named admit_hubs_jobs and the held() paragraph gave a reason its own sweep disproved. Co-Authored-By: OpenCode <[email protected]>
…-pointed client gets Co-Authored-By: OpenCode <[email protected]>
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]>
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 #1098
The Library's source discovery (the section list, the server's name and the item counts of one source) no longer starts the Browse store's own worker, and its step no longer reads the server registry. The read leaves as a typed store job,
StoreJob::BrowseDiscovery, that the app'sStoreRunnerstarts. The step captures the source'sClientKeyfrom the borrowedClientKeys, as the section hubs, directory and page reads do (#1021, #1028); the runner resolves the key at launch. This is the last Browse read of the Sans-IO series that was started inbrowse/mod.rs(design row B-D, docs/sans-io.md, "The discovery lane"). B-E (the roster and gate reads) and the pins stay as they are.What changed
The job (
data/src/browse/discovery_job.rsis new;data/src/browse/mod.rs,data/src/stores/{browse,mod}.rs):StoreJob::BrowseDiscovery(Job<BrowseDiscoveryReq>, BrowseDiscoveryPort). The request carries the epoch, the source index, theClientKey, which job (sections, or counts of the landed sections) and whether to ask the server's name.finish_browse_discovery_jobis the IO body, the old worker's, unchanged, still undercatch_unwind(a panic lands asSections(None)/Counts([])).DiscoveryRequest,execute_discovery,spawn_discoveryand theREFUSE_DISCOVERYtest seam are gone; the runner's existingwith_refused_hubs_launches_for_testseam reaches the new launcher.BrowseAdapter::src_fetchingis now aFetch<()>whose slot is unused. The answer still lands insrc_result(the mailboxrecord.rsencodes and the landing gate takes), and the claim still drops atapply_discoveryafter its epoch check, so the landing gate's dump mode is unchanged. Folding the mailbox into theFetchslot would move the recorded landing path, which is not this PR's scope.Admission is
Home, the one Browse kind that is. A controlled Home run starts the discovery and records its request, so:StoreWork::BrowseDiscoveryarm (Bridge::admit_home_jobs(.., StoreId::Browse), which the Hubs arm already uses). Every other sender starts itDirectthroughstart.DiscoveryRequest::descriptorwrote. They are pinned as literals inhome_admission_tests(the sections request, and the counts request after a landing) and inbrowse_discovery_admission_tests. The JSON key order is alphabetical (serde_jsonwithoutpreserve_order), so there was no order to keep.The client:
maybe_discover_owned(adapter, keys, jobs)takeskeys.key(sid); a source whose slot holds no client asks for nothing. The runner'sresolvecompares the key at the launch and refuses a job whose client moved on.Refusal (S2), the B-A shape plus the backoff discovery always had:
Fetch::refuse_for). It never reachessrc_result, so no recorded byte moves.src_flight: id, epoch, source).discovery_settleruns at the head ofmaybe_discover_owned, before the countdown's decrement, only when no claim is up. Iftake_refused(id)and the flight's epoch is still the table's, it sets that source'sretry_cdto the fullSRC_RETRY_CD(600). Nothing is invalidated. A flight whose adapter was replaced, or whose epoch moved, backs off nothing.BrowseStore::sync_rostersettles before it syncs the roster, so a source the sync re-arms in the same step (a re-pointed or retokened client) is asked again at once, exactly as before (review finding 2). No replay fixture holdsadmitted:falsefor a discovery, so no recording moves. Pinned bya_refused_discovery_backs_off_for_the_full_countdown_and_the_source_is_asked_again(lifecycle),assert_settled_into_the_backoffin the runner tests, and the data tests for a refusal across a reset and for a settled refusal of an older epoch.Drains (S3). Every entry that steps discovery now starts what the step emitted in the same call:
Bridge::browse_discover_pumpstart_store_jobs_of(Browse)(new; it had none)StoreWork::BrowseDiscoveryarmbrowse_discover_pump(it had none)frame_ingest(onboard)browse_discover_pump(it called the bare store)StoreWork::BrowseDiscoveryarmadmit_home_jobs)StoreWork::Browsepump (pump_with_gate, which also steps discovery)start_store_jobs_of(Browse); startedDirectHomeIo::discovery_owed{,_with}are deleted: the arm no longer builds a closure around a spawn.The test runner.
LiveKindgainsBrowseDiscovery.held()andpark_page_reads()run it live;held_all()parks it. The reason: threehostsimhelpers ofapp/run.rsrun every parked job on the test thread, and a parked discovery would then run its blocking GETs there against fixtures that park their first request or accept and never answer. No rig waits for a discovery landing from a real worker (every one fabricates it). The decision said to flip if a suite failed with this choice and passed with discovery parked; I tried parking it underheld()and the wholehostsim(1180 then) andapp(1065) suites passed, so no suite forces the choice and live stays, as decided. That is a reason from rig behaviour, not a failing test, and the docs say so.Gates:
ci/check-deps.sh'swall(clock) gate now also coversdiscovery_job.rs. No ledger line was added or edited.Ledgers
ci/allow/workers/data-browse.txtspawn_discoveryspawn_small)ci/allow/globals/data-browse.txtmaybe_discover_ownedclient_forgone)PINNED_LEDGER_TOTALS(workers/globals/forks/fxlanes)The branch merges
mainat 9cab21e, which includes Metadata M3 (#1102): its ledger lines took the sums to 7/64 once both landed. The totals were recomputed from the# count:headers on the merged tree (workers 7, globals 64, forks 58, fxlanes 11).Tests
Fails-first. c2ed77d was committed first and ran red on the base:
test result: FAILED. 0 passed; 4 failed; 0 ignored; 0 measured; 1061 filtered out; finished in 0.00s(each Bridge entry that steps discovery must start the read it emitted in the same call; the controlled arm must record a refused launch as not admitted). Two green pins went in with it and stay unedited:
home_admission_tests::a_sections_landing_then_discovery_records_the_counts_requestand the lifecycle test above.New tests:
discovery_job_tests.rs, 12): the step leaves one job and raises the claim; no client for the server asks for nothing; the admission is the recorded literal; an answer waits in the mailbox and the apply lowers the claim; a refusal lowers the claim and never reaches the mailbox; a late refusal of a superseded request leaves the current claim alone; a refusal across a reset, or of an older epoch, backs nothing off; a panicking sections or counts read lands as a failure; the kind is a Browse store job admittedHome.adapters/stores.rs, 8): live start answered once on a worker; client gone: refused once, and the next step, which sees the re-pointed client, asks again with the new key; the system refuses the thread: refused once and backs off; held: parks and holds its claim, then runs once; held with the client gone by then;held()starts it on a worker andheld_all()parks it; a replay launches nothing and answers a recorded refusal once; the admission descriptor and start.browse_discovery_admission_tests.rs, 4): record writes the literal and starts the job inside the arm; replay answers from the line, launches nothing and lowers the claim only at the recorded landing; a different line fails the run (mismatched synchronous admission); the encoder encodesStoreWork::{Hubs,BrowseDiscovery}and refusesStoreWork::Browse,RetryDiscovery,RetrySourceandRecheckShares.browse_discovery_drain_tests.rs, 4): the C0 tests above.Mutation checks on the committed C2 tree, one at a time, each restored afterwards. Every mutation was killed:
resolvealwaysNoneinlaunch_browse_discovery: 6 tests fail;refused()call instart_browse_discoveryremoved: 5 fail;held()park disabled for the kind: 3 fail.Suites at the review head 5d43380 (
origin/mainis still 9cab21e, nothing to merge):plx_data:test result: ok. 1270 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 12.76stest result: ok. 1085 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 25.70splx_screens:test result: ok. 1721 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 24.80stest result: ok. 1200 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 32.46sreturn_hold:test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 1194 filtered out; finished in 0.15slifecycle:test result: ok. 88 passed; 0 failed; 0 ignored; 0 measured; 1112 filtered out; finished in 4.13sDepGates.test_ledger_totals_match_the_pinned_tableandtest_ledger_count_header_must_equal_its_entries_in_every_area_file: OK.ci/check-deps.sh:check-deps: all gates green.Review
Verdict MERGE, four minor findings; all four fixed (f07877d, 5d43380).
git fetch origin mainshowed no new commits, so there is no merge; the ledger sums are still workers 7, globals 64, forks 58, fxlanes 11.frame_ingestdrains (Onboard's Tick sendsStoreWork::BrowseDiscovery, whose live arm starts the job anyway). Fixed: a new test runs a frame on Login, whose Tick sends no discovery work, under the refused-thread seam, then runs a second frame and asserts the source is in its backoff (retry_cd > 0), so it also proves a read was asked at all (a bare "claim is down" is true when nothing was asked). The Onboard test stays. Mutation check:frame_ingestreverted to the barerig.stores.browse_discover_pump(&rig.client_keys)fails it:the Login frame asked for the discovery and it was refused (retry_cd 0); restored, green.a_refused_discovery_is_asked_again_at_once_when_the_client_is_repointedfailed (left: 0, right: 1) with its controla_refused_discovery_backs_off_when_the_client_is_unchangedgreen. Fix:BrowseStore::sync_rostercallsdiscovery_settlebeforesync_roster_owned; the settle inmaybe_discover_ownedstays and is idempotent. Both new tests pass. The two runner tests that used a retoken to mean "client gone" now correctly see the immediate re-ask and assert it (they asserted the backoff, which was the bug); the refused-thread and lifecycle tests still pin the backoff of an unchanged client.docs/sans-io.mdand thediscovery_settledoc say so.admit_hubs_jobs(docs/sans-io.md,docs/stores-as-machines.md): nowadmit_home_jobs.held()paragraph contradicted itself: it now saysheld()leaves Hubs, the season switch and the page read live because rigs wait for those landings, and gives discovery its own, correct reason (the hostsim helpers that run every parked job on the test thread).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. No Makefile, Cargo or workflow file changed, so no build-bench table is needed. There is no FFI or linkage change.Review. The
pr-revieweragent was not run: this lane spawns no subagents. An advisor read the combined facts once before this PR and asked for the refusal timing, the held-runner reason and the merge resolution to be checked; they are above and below.Doc-claim audit, done by hand per
.agents/agents/doc-claim-auditor.md(C3). Fixed:docs/sans-io.md(the lane list, a new "The discovery lane" bullet, theHomeadmission family, the held-runner paragraph, the local-launcher example),docs/stores-as-machines.md(the Browse adapter paragraph and theStoreWorkrow),docs/poster-scheduler-design.md(the worker table row),ci/check-deps.sh(the same example),base/src/task.rs(the uncounted-worker comment), and the doc comments inadapters/stores.rsandbrowse/mod.rs. Left alone on purpose:docs/module-layers.md:1305-1307is a dated measurement of what one build contained. The wall-gate comments for B-A and B-B/C inci/check-deps.shsay what was true when each file joined.Live path
Checked in the macOS simulator at 960x540 against a fresh
tests/mock_pms.py --verbose, with plex.tv and Discover pointed at the mock and a placeholder token. No keys were sent and no TV or device was touched. Identity lines read before anything else:pms: server 0 version=1.41.0.0000-synthetic,notify: roster servers=1 described=1 owned=1.plxnative-library): the mock sawGET /library/sectionsonce per boot, the countsGET /library/sections/{1,2}/all(size 0, andtype=18) once each, and no repeat while the app ran.Not in this PR
sync_roster_owned,discovery_needs_pumpand the other roster and gate reads still read the registry; the pins still spawn their own workers.src_resultinto theFetch<()>slot.🤖 Generated with OpenCode