Skip to content

fix(desktop): drop in-flight folder/people loads that finish after an account switch - #9829

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

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

Review in cubic

… account switch

AppState cleared folders/people on .runtimeOwnerDidChange, but loadFolders()
and 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.

Add 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) —
30 tests green across the fence suites; live account-switch round trip
re-verified on the named bundle at this commit (conversations render →
swap_test_owner clears to empty state → restore_test_owner returns).

Co-Authored-By: Claude Fable 5 <[email protected]>
@kodjima33
kodjima33 merged commit 4a3cb44 into main Jul 15, 2026
@kodjima33
kodjima33 deleted the kodjima33/fix-conversations-owner-switch branch July 15, 2026 18:49
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