Skip to content

fix(desktop): clear active conversations search on in-place account switch - #9826

Merged
kodjima33 merged 1 commit into
mainfrom
kodjima33/fix-conversations-owner-switch
Jul 15, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
kodjima33/fix-conversations-owner-switch

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 15, 2026 •

Copy link
Copy Markdown
Collaborator

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

Review in cubic

…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
kodjima33 merged commit 9dd1b5e into main Jul 15, 2026
8 of 10 checks passed
@kodjima33
kodjima33 deleted the kodjima33/fix-conversations-owner-switch branch July 15, 2026 18:23
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)
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.

1 participant