Repository navigation
fix(desktop): clear active conversations search on in-place account switch - #9826
Merged
Merged
Conversation
…witch ConversationsPage keeps its search state (searchQuery/searchResults/ isSearching/searchError) and multi-select/merge/folder-sheet state in local @State; with a search active during an in-place account switch, the previous account's ServerConversation rows kept rendering from searchResults even after AppState and the repository reset. The page now clears its owner-scoped local state on .runtimeOwnerDidChange (same fence as the repository, AppState, and the detail host). Also adds a set_conversations_search automation-bridge action (posts the same notification pattern as open_conversation) so the real debounced search path can be driven 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. Fence suites (ConversationRepositoryTests, MemoriesViewModelOwnerFenceTests, AppStateOwnerFenceTests) all green — 28 tests; test-quality checker at baseline. Co-Authored-By: Claude Fable 5 <[email protected]>
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
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-localsearchResultseven 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 aset_conversations_searchautomation-bridge action (same notification pattern asopen_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=nikrendered the account's search results;swap_test_owner(productionperformEffectiveOwnerTransitionpath) cleared the query and results to the empty state with the previous account's folder chips gone;restore_test_ownerreturned cleanly. Two-panel screenshot captured. Fence suites (ConversationRepositoryTests26,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