Skip to content

Give each Bridge its own Person store - #110

Merged
GLinnik21 merged 3 commits into
mainfrom
stores/person-owner
Sep 17, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
stores/person-owner

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Summary

  • Person store state, worker adapter and change notice are now owned per Bridge (via Stores), following Browse (aff24392) and ViewState (4b390cdd). The process-wide CURRENT/GEN/FETCH/RETRY_CD/HELD statics, the global notice and the free person::current/loading/pump facades are gone; screens read PersonView through PersonLike.
  • ViewState::pump takes a Person callback, so optimistic watched edits fan out only to the owning Bridge's Person store.
  • New check-deps gate: person-owner has zero global storage, transport, selectors or free facades (no allowlist).
  • Review fix: person::open is idempotent on the identity already held, and PersonScreen requests Open on every Enter/Uncover. Before this, a stack eviction at CAP could queue a Close for the same actor in the same drain as a new page's Enter, leaving that page blank.

Tests

  • separate_bridges_do_not_share_any_person_owner_state_or_notice: two owners share no state, landings or notice. Red was simulated (both owners aliased to one Bridge).
  • reopening_an_evicted_same_identity_person_leaves_the_store_holding_it: fills the stack to CAP with Person A at the bottom and reopens A. Watched red before the fix.
  • Local: make check (both feature passes), --no-default-features check, ARM make, ci/check-deps.sh all green.

Open questions (not fixed here, out of scope)

  • Fixture replay (tests/focusfp.sh) is refused on main itself: the committed fixtures have been stale since 9ab256b7, because SCREEN_SHAPES_PIN was bumped by later PRs without re-recording. They will be re-recorded once, at the end of the store-ownership migration. A make check assertion that fixture state_fp matches the live one would stop this from recurring.
  • P3: a_fresh_filmography_reads_only_the_person_view_it_is_given takes no testlock, although PersonCmd::Open reads the global server registry.
  • P3: the replay landing gates for Person (bootstrap::stores::poll("person", …), stores::take_landing(StoreId::Person, …)) are still process-wide. Harmless with one production Bridge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Em5yYDNi5A2peYR6oPMXwD

GLinnik21 and others added 3 commits September 13, 2026 21:11
Resolves the bridge.rs conflict from origin/main's mechanical test-file
split (d821b21, "Split ff.rs, metadata.rs, bridge.rs, ..."), which moved
the inline `mod tests { ... }` block this branch's Person commit
(efb3dd1) had edited out into per-group files. Both mod-declaration
conflicts in bridge.rs are resolved by taking origin/main's split-file
form; the Person-owner tests and helper functions efb3dd1 added to the
old inline mod tests block are carried into the corresponding split file,
app/session_dispatch_tests.rs and app/viewstate_directory_policy_tests.rs.

Also applies the ViewState::pump 3-arg (person callback) signature change
from efb3dd1 to app/session_dispatch_tests.rs's
endpoint_outcomes_cross_central_dispatch_machine_bridge_and_boot test,
which the split carried forward with the old 2-arg call since main predates
the Person store's ownership commit.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Enter/Uncover decided whether to emit PersonCmd::Open by reading the store
synchronously, but Close and Open are both deferred AppFx::Store effects
applied after screen event delivery in the same drain. A stack eviction
(ui::containers::stack::evict at CAP) delivers Unmount to an evicted body —
queuing Close for the identity it still holds — in the same Push drain that
mounts and Enter(Fresh)s a new page for that same identity: the new page's
guard sees the store still holding the identity and skips Open, then the
queued Close lands after it, leaving the store empty under a page that never
re-requests it (e.g. reopening an actor's cast credit once the stack is CAP
bodies deep, or a PopTo across two same-person pages).

Reproduced with a dispatcher-level test that fills a stack to exactly CAP
live bodies with a Person A page at the bottom, then reopens the same
Person A identity — the Push evicts the bottom body in the same drain as
the new page's Enter(Fresh). Watched red on the unfixed code.

Fix: person::open is now idempotent on the identity it already holds — an
early return before any generation bump, fetch-claim clear or retry-backoff
reset, and before the Person is rebuilt — so a redundant Open for the
already-held (sid, key) is a true no-op (no refetch storm, no dropped live
landing). screens::person's Enter(_) | Uncover arm now calls request_store
unconditionally instead of only when its own person(cx) read is None: a
same-identity Close queued earlier in the drain is now harmless (Open
re-requests it), and a same-identity page already correctly held costs
nothing (Open no-ops).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 17, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Person notices are bumped for idempotent or otherwise unchanged commands; propagate actual change status and add repeated-Open coverage.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Moves Person state and transport from process-wide globals to per-Bridge ownership, with updated screens, tests, documentation, and dependency gates.

Changes:

  • Adds per-Bridge PersonStore and PersonView.
  • Routes optimistic updates and lifecycle commands through the owning Bridge.
  • Adds ownership isolation and regression coverage.
File summaries
File Description
tests/test_harness.py Adds dependency-gate tests.
rust-modules/src/viewstate.rs Routes Person optimistic updates.
rust-modules/src/ui/CLAUDE.md Updates UI architecture guidance.
rust-modules/src/stores/viewstate.rs Threads Person ownership through ViewState.
rust-modules/src/stores/person.rs Implements Person state and notices.
rust-modules/src/stores/mod.rs Integrates Person into Stores.
rust-modules/src/screens/registry.rs Adds PersonLike access.
rust-modules/src/screens/person.rs Uses owner-bound Person data and lifecycle.
rust-modules/src/screens/person_bio.rs Uses owner-bound biography data.
rust-modules/src/screens/filmography.rs Uses owner-bound filmography data.
rust-modules/src/person.rs Replaces global Person state.
rust-modules/src/lib.rs Updates ownership documentation.
rust-modules/src/dev/scenarios.rs Uses Bridge-owned Person state.
rust-modules/src/app/viewstate_directory_policy_tests.rs Tests ownership isolation.
rust-modules/src/app/session_dispatch_tests.rs Updates dispatch coverage.
rust-modules/src/app/search_owned_tests.rs Updates Person view fixtures.
rust-modules/src/app/run.rs Pumps the Bridge-owned store.
rust-modules/src/app/person_lifecycle_tests.rs Adds lifecycle regression coverage.
rust-modules/src/app/library_shelf_action_tests.rs Updates Person view fixtures.
rust-modules/src/app/bridge.rs Wires and dispatches Person state.
rust-modules/src/app/boot.rs Resets owned Person state.
docs/stores-as-machines.md Documents store ownership.
docs/agent-reference.md Updates architecture reference.
ci/check-deps.sh Adds the Person ownership gate.
Review details
  • Files reviewed: 24/24 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +71 to +72
let changed = self.state.run(&self.adapter, cmd);
self.bump();
@GLinnik21
GLinnik21 merged commit e276f6c into main Sep 17, 2026
6 checks passed
@GLinnik21
GLinnik21 deleted the stores/person-owner branch September 17, 2026 12:05
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants