Repository navigation
fix(desktop): clear account-scoped conversation UI state and open detail on in-place account switch - #9823
Merged
Conversation
…ail on in-place account switch Completes the owner fence from the previous commit: the conversation LIST reset, but account-owned UI state outside the repository survived an in-place switch — an open conversation detail (ConversationsPageHost keeps selectedConversation in view-local @State) kept showing the previous account's conversation, and folders, folder/date/starred filter selections, counts, loading/error flags, and people were cleared only by the signOut()-only .userDidSignOut handler. AppState now subscribes to .runtimeOwnerDidChange and clears the account-scoped conversation state (resetOwnerScopedContent, mirrored from the sign-out handler's conversation subset), and ConversationsPageHost dismisses any open detail on the same signal. Verification: new AppStateOwnerFenceTests regression (folders, filters, counts, flags, and people all clear on the notification) — 31 tests green across the fence suites. Real path on a named bundle signed into the real account: opened a conversation detail via open_latest_conversation, ran swap_test_owner (production performEffectiveOwnerTransition path) — the detail dismissed and the list showed the empty state with the previous account's folder chips gone; restore_test_owner returned cleanly. Co-Authored-By: Claude Fable 5 <[email protected]>
kodjima33
added a commit
that referenced
this pull request
Jul 15, 2026
…witch (#9826) ## What Third and final residual of the account-switch owner fence (#9821, #9823): with a **search active** during an in-place account switch, the previous account's rows kept rendering from `ConversationsPage`'s view-local `searchResults` even after AppState and the repository reset. The page now clears its owner-scoped local state (search query/results/flags, multi-select/merge state, folder sheets, filter-loading flags) on `.runtimeOwnerDidChange` — the same fence as the repository, AppState, and the detail host. Also adds a `set_conversations_search` automation-bridge action (same notification pattern as `open_conversation`) so the real debounced search path can be exercised in verification without synthetic keyboard/mouse input. ## Verification Live on a named bundle signed into the real account: `set_conversations_search query=nik` rendered the account's search results; `swap_test_owner` (production `performEffectiveOwnerTransition` path) cleared the query and results to the empty state with the previous account's folder chips gone; `restore_test_owner` returned cleanly. Two-panel screenshot captured. Fence suites (`ConversationRepositoryTests` 26, `MemoriesViewModelOwnerFenceTests`, `AppStateOwnerFenceTests`) — 28 tests green; test-quality checker at baseline. (The cleared state is view-local `@State`, so coverage is the live bridge verification rather than a unit seam.) ## Product invariants affected none 🤖 Generated with [Claude Code](https://claude.com/claude-code)
kodjima33
added a commit
that referenced
this pull request
Jul 15, 2026
… account switch (#9829) ## What Race residual of the account-switch fence series (#9821/#9823/#9826): `AppState` cleared folders/people on `.runtimeOwnerDidChange`, but `loadFolders()` / `fetchPeople()` had no owner fence — a previous account's **in-flight response landing after the reset** repopulated the cleared state, and the skip-while-non-empty reload guards then pinned the stale data for the new account. Adds `ownerScopeGeneration` (bumped by `resetOwnerScopedContent()`); the loads capture it before awaiting and drop their result if it moved — same pattern as `ConversationRepository.requestGeneration`. Injectable fetch seams enable hermetic race coverage. ## Verification - Two new behavioral regressions: a gate-suspended folder load and people fetch complete **after** `.runtimeOwnerDidChange` and are ignored (state stays empty). 30 tests green across the fence suites (`ConversationRepositoryTests` 26 incl. the owner-change regression, `MemoriesViewModelOwnerFenceTests`, `AppStateOwnerFenceTests` 3). - Live account-switch round trip re-verified on the named bundle at this commit (real account's conversations render → `swap_test_owner` clears to the empty state → `restore_test_owner` returns cleanly); two-panel screenshot captured. ## Product invariants affected none 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.
What
Completes the owner fence from #9821 (reviewer-identified residuals): an open conversation detail (
ConversationsPageHostkeepsselectedConversationin view-local@State) kept showing the previous account's conversation after an in-place account switch, and folders / folder-date-starred filters / counts / loading-error flags / people were cleared only by thesignOut()-only.userDidSignOuthandler.AppStatenow subscribes to.runtimeOwnerDidChange→resetOwnerScopedContent()(mirrors the sign-out handler's conversation subset; people were never cleared on any auth path before).ConversationsPageHostdismisses any open detail on the same signal.Verification
AppStateOwnerFenceTestsregression: folders, filter selections, counts, flags, and people all clear on the notification. 31 tests green across the fence suites (ConversationRepositoryTests,MemoriesViewModelOwnerFenceTests,AppStateOwnership/OwnerFence).open_latest_conversation), ranswap_test_owner(productionperformEffectiveOwnerTransitionpath) — the detail dismissed and the list showed the empty state with the previous account's folder chips gone (All/Starred/Work/Personal/Social/Test → All/Starred);restore_test_ownerreturned cleanly. Two-panel screenshot captured.Still-deferred (named)
DashboardViewModel/HomeStatusStore/AppProvider/MemoryGraphViewModelremain deferred-only viaViewModelContainer.resetStartupState.Product invariants affected
none
🤖 Generated with Claude Code