Skip to content

fix(account): keep the earlier sign-in's PCs off the list when another tab signs in - #4961

Merged
devswha merged 3 commits into
mainfrom
fix/3523-account-list-swap
Nov 28, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/3523-account-list-swap

Conversation

@devswha

@devswha devswha commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Fixes #3523.

Re-checked on main df6bd8a: item 2 was already fixed by #4857 (the service re-checks the stored sign-in after a failed response), item 7 only happens with a pre-#3519 tab open. Items 1, 3, 4, 5 and 6 reproduced and are fixed here:

  • 1 / 5: reading the front page again (load(null) -> refresh(true)) now compares the sign-in on screen (shownFor) and stops when the read is no longer live, so A's kept rows are not drawn under B's heading when B's read fails.
  • 3: replacedBy draws the new sign-in's heading at once instead of only clearing the rows, so A's list does not stay on screen while B's read hangs.
  • 4: the shownFor branch has tests now (turning it off left accountController.test.ts green before).
  • 6: indexedAccountStore.update skips the write (and the ovis:account-session event) when the change returns the value it was given.

Tests (src/lib/relay/accountController.signInSwap.test.ts, src/lib/account/store.test.ts), failing on main:

  • front page is read again after another tab signed in as B and B's read fails (Received: [ "acct-a's PC" ])
  • while B's read is still out (A's row and provider)
  • writes nothing ... (Expected: 0, Received: 2)

With the fix: 114 pass / 0 fail and 1 pass / 0 fail; bun run typecheck passes. Changelog: changelog.d/account-list-other-sign-in.md.

…d read the sign-in without writing it (#3523)

- accountController refresh: a read of the front page (load(null), refresh(true)) now compares the
  stored sign-in with the one on screen as any other read does, so another tab's sign-in drops the
  earlier rows before its read, and a failed read no longer draws them under the new heading.
  It also stops when the page moved on while that heading was drawn.
- replacedBy draws the new sign-in's heading at once, so the earlier list does not stay on screen
  while the replacement's read is out.
- indexedAccountStore.update writes nothing, and announces no session change, when the change
  returns what it was given: every AccountService.session() read went through a write.

Tests: accountController.signInSwap.test.ts (the shownFor branch had none; turning it off now fails
two cases) and store.test.ts.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 173ada3 and 530f8ca.

Files selected for processing: 5

  • changelog.d/account-list-other-sign-in.md
  • src/lib/account/store.test.ts
  • src/lib/account/store.ts
  • src/lib/relay/accountController.signInSwap.test.ts
  • src/lib/relay/accountController.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@devswha
devswha merged commit 5bf0610 into main Nov 28, 2026
15 checks passed
@devswha

devswha commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 530f8cace. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.

main moved but untouched: merged without update. Its new commits up to 4483cfa96 change no file of this pull request, none imported by one, nothing that decides which checks run, and no core path.

Reviews: omo gate reviewer CLEAR at feb3658 (new tests fail on main and pass on head; no stuck skeleton or lost refresh; three LOWs). Codex via axwith (gpt-6.2-sol--fast, xhigh) found one HIGH, reproduced: a failed read whose handling ran after another tab stored sign-in B still drew A's rows under B. Fixed in ea7b7d7 (the failure path reads the stored sign-in again and draws B's heading, then reads B) with a test that fails before the fix; one fix round, no further review rounds. Check fast passed on old-desktop via the heavy runner at the new head (30218 pass, 0 fail). LOWs left: the store test counts events rather than writes; no test drops the item 5 live check; JoinedNotice listens to the sign-in event only (a focus listener would be a follow-up).

@devswha
devswha deleted the fix/3523-account-list-swap branch November 28, 2026 12:21
devswha added a commit that referenced this pull request Nov 28, 2026
devswha added a commit that referenced this pull request Nov 28, 2026
…gn-in made during a leave (#4972)

Refs #3452 (the pending-link item; the phone sign-in item is covered by
#4961; the rest was already fixed or is obsolete, see the issue
comment).

- **A pending link counted as confirmed when leaving**
(`src/lib/account/leave.ts`): a pairing that still holds an older key
with the leaving key in `pending_key` (the state `linkThisDevice` leaves
until the PC answers) was treated as confirmed, so the PC was forgotten
and left out of `unconfirmed` though a link to it was still on its way.
It now stays in `unconfirmed`; a PC confirmed with the leaving key is
handled as before.
- **A phone app sign-in made during a leave stayed on "signing in"**
(`src/lib/relay/accountController.ts`): `refresh()` returned early while
`leaving` and nothing read again afterwards (the leave's own read after
"Your sign-in changed" was skipped the same way). A read asked for
during a leave is now made once when the leave ends.

**Tests** (fail on main, pass here): the new last case in
`src/lib/account/leave.test.ts` ("names a PC whose pairing's link with
the leaving key is still pending...") and
`src/lib/relay/accountController.leave.test.ts` ("draws a sign-in the
phone app made while a leave ran...").

**Checks:** focused files 123 pass / 0 fail; `bun run typecheck`; `bun
run check fast` on another machine via the heavy runner: 30215 pass, 0
fail.
**Reviews before opening:** omo gate reviewer CLEAR (three LOWs) and
Codex via axwith (gpt-6.2-sol--fast, xhigh) CLEAR, no findings.

Changelog: `changelog.d/account-leave-races.md`.

**Update:** the second item's controller change and its test were
dropped. The test first flaked in CI (it waited a fixed number of
event-loop turns), and once rewritten to wait for events it passed on
main too: #4961, merged meanwhile, already draws a sign-in the phone app
made during a leave. This PR now carries only the `leave.ts` fix.
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.

Hosted app account list: follow-ups from the merge review of #3519

1 participant