Repository navigation
Close out the store-ownership migration - #121
Merged
Merged
Conversation
…see it The last global mutable state in the migrated ownership layers was search/scope.rs's `static mut CACHE`: a memo of SourceScopeSnapshot shared by every Bridge in the process. Move it onto SearchState as a ScopeCache field (RefCell<Option<Cache>>, since the production callers only ever reach it through &self/&mut self) so each Search owner memoizes its own scope. Widen ci/check-statics.sh to also scan search/, person/, metadata.rs, pms.rs and stores/ for static mut, so this class of regression is visible to the gate that let this one survive four migration layers. It finds nothing new. Leave metadata.rs's function-local OnceLock<Option<String>> dev-trigger cache as is: it is not process-wide mutable state, the widened gate correctly does not flag it, and it now carries a reason line for why it stays. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD
Re-record 1-boot-home-chip-grid and 6-settings-family with tools/plxnative-rec rerecord against the current SCREEN_SHAPES_PIN (0x0e66_311c_e4f1_0769, already correct — no bump needed) after six store-ownership shape changes made the committed fixtures unloadable. ALPHABET.json gains three source-backed literals now present in every controlled session commit once a store owns its own persistence: SaveAuthority::Routine (plex/session.rs), PersistencePurpose::Background (plex/session/async_persistence.rs) and CommitAdmission::RegistryOnly (auth/owner.rs). 12-filmography-detail-return could not be re-recorded: the flow's dwell timer fires ContentReq::PreviewStart (screens/detail/mod.rs request_preview), which app/bootstrap/effects.rs's recording encoder does not handle (only Push/Present/Back), so the recorder itself refuses with "unsupported controlled content effect" before the flow completes. This is a pre-existing gap in the recording infra, not a stale-fixture problem, and is out of scope here — left unrecorded and unimported. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD
There was a problem hiding this comment.
🟢 Approval recommended
The changes are internally consistent (code, gates, docs, and fixtures align) and the ownership model improvements are backed by targeted tests and updated CI enforcement.
Pull request overview
This PR completes the store-ownership migration cleanup by removing the last remaining process-wide mutable cache in the migrated modules, tightening CI gates to prevent regressions, updating store-ownership documentation to match the new ownership model, and re-recording/refreshing replay fixtures affected by the migration.
Changes:
- Replace
search/scope.rs’sstatic mut CACHEwith a per-ownerScopeCachestored onSearchState, and update callers/tests accordingly. - Expand CI gates to scan the now-relevant modules (
search/,person/,stores/,metadata.rs,pms.rs) and update gate messaging/documentation to reflect ownerrunseams (vsstores::<store>::apply). - Update docs and replay fixtures/vocabulary to reflect the new ownership and persistence vocabulary now present in controlled recordings.
File summaries
| File | Description |
|---|---|
| tests/fixtures/replay/ALPHABET.json | Adds newly-serialized controlled-recording vocabulary literals tied to persistence purposes/admission. |
| tests/fixtures/replay/6-settings-family/manifest.json | Refreshes fixture manifest schema fields/hashes to match current owned-store recording output. |
| tests/fixtures/replay/1-boot-home-chip-grid/manifest.json | Refreshes fixture manifest schema fields/hashes to match current owned-store recording output. |
| rust-modules/src/stores/metadata.rs | Updates module documentation to reflect MetadataView-based owned borrowing (&'a) and revised read surface. |
| rust-modules/src/stores/browse.rs | Fixes contract-test commentary to reflect per-Stores notice ownership (no process-wide notice draining). |
| rust-modules/src/search/scope.rs | Removes static mut cache; introduces per-owner ScopeCache and adds/updates tests to prove non-sharing. |
| rust-modules/src/search.rs | Wires ScopeCache into SearchState snapshots and directory-driven code paths. |
| rust-modules/src/screens/detail/mod.rs | Updates comments to reflect owned MetadataView borrowing instead of prior 'static semantics. |
| rust-modules/src/route/plan.rs | Updates comments to reflect owned MetadataView borrowing in rationale for purity. |
| rust-modules/src/route/decision.rs | Updates comments to reflect owned borrowing model around metadata::playing() usage. |
| rust-modules/src/pms.rs | Updates comments to reflect per-Bridge ownership of the hub catalog state and testlock purpose. |
| rust-modules/src/metadata.rs | Corrects/reset-related prose and clarifies test-only locking rationale; documents a function-local OnceLock. |
| rust-modules/src/app/bridge.rs | Updates prose describing per-frame notice draining to reflect per-owner notices (not compatibility globals). |
| docs/stores-as-machines.md | Updates phase-4/ownership prose and caller tables to reflect “all stores owned; no apply shim” reality. |
| docs/agent-reference.md | Updates architecture/testing guidance text to reflect Metadata ownership and remaining shared test seams. |
| ci/check-statics.sh | Expands static mut scan scope beyond ui/ and screens/ to cover migrated store modules. |
| ci/check-deps.sh | Updates mutator gate messaging and commentary to match owner run seam usage. |
| ci/allow/mutators.txt | Updates header guidance to reference the owner run/step seam rather than stores::<store>::apply. |
Review details
- Files reviewed: 18/20 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…isible Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD
This was referenced Sep 18, 2026
GLinnik21
added a commit
that referenced
this pull request
Sep 18, 2026
The store-ownership migration's last owed item was the device pass; layers #110/#111/#112/#119 and the cleanup #121 were host-verified only until now. The player-lane scrub legs (paused scrub, tap commit, dropped-keyup net) all passed on the real pipeline. The ownership legs showed a clean boot-time activation reset, but the reused-Bridge case #119 was actually about could not be reached: the only in-app route to a second activation on a live Bridge is the profile picker, and that route is broken for a managed user. Two new findings came out of hitting that dead end: the profile chip and account overlay name the account holder rather than the signed-in managed user, and "Change profile" as a managed user spins forever on a 401 from the home-roster endpoints with no error, nothing logged, and Back inert — only Sign out escapes. Filed as separate issues, along with the pointer scrub path having no device-drivable coverage at all (no held-pointer token in the FIFO, and the one reachable synthetic click didn't engage the scrub band). Claude-Session: https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD Co-authored-by: Claude Opus 5 <[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.
The cleanup PR that closes the store-ownership migration. Browse, ViewState, Person (#110), Search
(#111), Hubs (#112) and Metadata (#119) each moved one store onto its
Bridge; this one removeswhat those six left behind and corrects the prose they falsified.
The last global mutable state, and the gate that never looked at it
search/scope.rs'sstatic mut CACHEwas the final process-wide mutable state in the migratedmodules: a memo of
SourceScopeSnapshotshared by everyBridgein the process, read throughaddr_of_mut!. It is now aScopeCachefield onSearchState—RefCellinside, because theproduction callers only ever reach it through
&self— so each Search owner memoizes its own. Thefree
scope::snapshot()/snapshot_with_directory()functions andreset_for_testare gone.The more useful half: it survived four migration layers because nothing was looking.
ci/check-statics.shscannedstatic mutonly underui/andscreens/, sosearch/was neverexamined. The gate now also scans
search/,person/,metadata.rs,pms.rsandstores/. Itfinds nothing else, which is the point — the blind spot mattered more than the one instance.
Pinned by
two_owners_do_not_share_the_scope_memo, built deliberately on differing directorycontent: two owners with content-identical directories would pass even against a shared cache, which
is exactly how the Search layer's original two-owner tests failed to discriminate. Red was simulated
by routing one owner through a stand-in shared cache, then reverted.
Replay fixtures: two re-recorded, one blocked by something else
The committed fixtures had failed on
mainsince9ab256b7and every layer was told to leave themalone so the cleanup could re-record once. Fixtures 1 (
boot-home-chip-grid) and 6(
settings-family) now replaySAME— 582 and 1214 frames, zero diverged.Two things worth recording:
SCREEN_SHAPES_PINnever needed bumping. It already matched the app's computedstate_fp;only the fixture artifacts were stale. The assumption that six layers of shape changes had moved
the pin was simply wrong.
filmography-detail-return) could not be recorded at all, and not because of thismigration. Its flow trips the Detail page's hero-preview autostart, and the controlled-effect
encoder (
app/bootstrap/effects.rs) handles onlyContentReq::Push,PresentandBack,erroring on everything else. The preview and panel variants added by detail: trailer UX — full-screen mode, transport, seek, and a left column with a spacing grammar #117 have been unencodable
ever since, so any flow touching a hero preview is unrecordable — which is most of Detail. That is
application code and outside this layer, so fixture 12 stays stale and the gap is filed as an
issue rather than patched here.
tests/fixtures/replay/ALPHABET.jsongains three literals (Routine,Background,RegistryOnly), each traced to its source constant with provenance recorded, per that file's ownadd-by-source-backed-name rule: they now serialize into every controlled commit because stores own
their own persistence.
Doc-claim audit: 18 sentences the migration made false
Contradictions only — prose that fails to mention something new is out of scope by construction.
Three were worse than ordinary rot:
ci/check-deps.shtold a contributor whose build had just failed to "usestores::<store>::apply" — a function that exists nowhere. It now names the owner'srunseam.This is the one stale sentence a person was guaranteed to read, at the moment they were blocked.
stores/browse.rsclaimed four stores' notices were "still process-wide globals(
stores::mod.rs'sNOTICES)" and that draining one cleared the others — inside a test namedseparate_store_aggregates_never_share_state_transport_or_notices. It asserted the opposite ofwhat its own test proves;
NOTICESmatched nothing else in the tree.stores/metadata.rs's §1 read-surface contract still described ~11 free functions returning&'static, saying "a screen may call these directly". They areMetadataViewmethods borrowingfrom the owner, and several signatures had changed.
Where a rule was still correct but its stated justification had been deleted — the
&'staticclaims, "one static slot", "a crate-wide global" — the rule was kept and the mechanism corrected.
set_current_for_testkeeps its testlock, because itsassert_heldis real.docs/stores-as-machines.mdalso contradicted itself about its own mutator table (one line callingit historical, another calling it live); that is now split explicitly into a frozen phase-4 census
and a caller column that is maintained.
The audit cleared as already-accurate:
stores/mod.rs's module docs,ui/CLAUDE.md's phase-4paragraph, and every host test count (the docs deliberately refuse to state one and hand over the
counting command instead).
What review found, and what it says about the gate
Review caught the gate widening being partly theatre, which is worth recording rather than quietly
fixing:
ci/check-statics.shwas passing$SRC/person, and Person is the FILEperson.rs, so greperrored and
2>/dev/nullswallowed it — Person was scanned by nothing while the header claimedcoverage.
search.rsandmetadata/were missing too. The gate now checks that every gated pathexists and fails loudly if one does not, because a gate that silently scans nothing is worse than no
gate: it is believed.
It also found that the narrow
static mutpattern could not seesearch/recents.rs'sstatic STORE: Mutex<Option<Store>>andstatic PENDING: Mutex<Vec<Pending>>— real process-widemutable state inside
search/, read on the per-owner publication path. So the "no global mutablestate" claim was not true as first stated. They are now scanned, using Required 1's wider spelling,
and allowlisted with permanent reason lines: they are a persistence seam — a write-behind queue
drained by background workers and a cache keyed by the global session generation — not store state,
and a per-
Bridgecopy would duplicate the on-disk queue and risk a double write.ci/allow/statics.txttherefore goes 7 → 9. That is coverage increasing, not debt increasing:the gate now sees two statics it was never able to see.
The wider pattern is applied to
search/only, deliberately. Run tree-wide it matches everythread_local! { static … }interior declaration — a different, safe, per-thread idiom usedthroughout
ui/andscreens/for render caches and test doubles — producing on the order of 80unrelated hits. Mass-allowlisting those to make one gate change pass would be exactly the wrong
trade, so that widening is left as its own deliberate piece of work. The reasoning is written into
check-statics.shitself, where the next person to touch it will read it.Gates
make check3688 / 3734 / 85 passed, 0 failed ·cargo +nightly check --lib --no-default-featuresclean ·ci/check-deps.shandci/check-statics.shall gates green ·make(ARM) a real relink with a fresh ARM ELF · replaySAMEon fixtures 1 and 6.One CI run of this branch failed on
app::content::library_publication_tests::a_requested_detail_refresh_retries_after_a_child_supersedes_its_request.That is not this PR:
git diff <main> -- src/app/content.rsis empty, the file is byte-identicalto
main, andmainpasses locally.drain_detail_workerssettles an async retry by polling 100iterations with
thread::yield_now()while a genuinely OS-spawned thread races to finish — aload-dependent bound, not a wait, which passes on a 10-core Mac (in both orderings, and under
deliberate CPU saturation) and fails on a smaller, busier runner. Filed separately; fixing it means
giving that completion a real signal, which reshapes how the family observes async work.
Open questions (not fixed here)
app/bootstrap/effects.rs's encoder coversContentReq::PreviewStartand its siblings. Filed separately; it is a recording-infrastructure gap from detail: trailer UX — full-screen mode, transport, seek, and a left column with a spacing grammar #117, not migration
debt.
ui/CLAUDE.md:210still says "Legacy Search currently uses it through a synchronous compatibilitybridge".
ui/search/was deleted before this migration's range began, so it was left alone ratherthan fixed on sight.
CHECK_DEPS_ONLY=<rule>filter (~170 s offmake check's 616 s, sinceDepGatesre-runscheck-deps.shabout thirty times) was held back through the migration so no layer's gate timingsmoved mid-flight. It is a build-speed change, not ownership cleanup, so it belongs in its own PR.
ui::landgatekeyed per
StoreIdrather than perBridge, the missinghubs_notifiedsuppression, thecontrolled_with_directory(Some(Reset))rotation asymmetry, andPersonScreen'sPersonCmd::Closedouble-emit.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD