Skip to content

fix(desktop): clear account-scoped conversation UI state and open detail on in-place account switch - #9823

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

Completes the owner fence from #9821 (reviewer-identified residuals): an open conversation detail (ConversationsPageHost keeps selectedConversation in 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 the signOut()-only .userDidSignOut handler.

  • AppState now subscribes to .runtimeOwnerDidChange → resetOwnerScopedContent() (mirrors the sign-out handler's conversation subset; people were never cleared on any auth path before).
  • ConversationsPageHost dismisses any open detail on the same signal.

Verification

  • New AppStateOwnerFenceTests regression: folders, filter selections, counts, flags, and people all clear on the notification. 31 tests green across the fence suites (ConversationRepositoryTests, MemoriesViewModelOwnerFenceTests, AppStateOwnership/OwnerFence).
  • Real path on a named bundle signed into the real account: opened a conversation detail (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 (All/Starred/Work/Personal/Social/Test → All/Starred); restore_test_owner returned cleanly. Two-panel screenshot captured.

Still-deferred (named)

DashboardViewModel / HomeStatusStore / AppProvider / MemoryGraphViewModel remain deferred-only via ViewModelContainer.resetStartupState.

Product invariants affected

none

🤖 Generated with Claude Code

Review in cubic

…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
kodjima33 merged commit d1397ec into main Jul 15, 2026
@kodjima33
kodjima33 deleted the kodjima33/fix-conversations-owner-switch branch July 15, 2026 18:06
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)
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