Repository navigation
fix(account): keep the earlier sign-in's PCs off the list when another tab signs in - #4961
Conversation
…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.
|
Warning Review limit reachedYou'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. View limit details
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. |
|
Merged through
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). |
…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.
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:
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.replacedBydraws 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.shownForbranch has tests now (turning it off leftaccountController.test.tsgreen before).indexedAccountStore.updateskips the write (and theovis:account-sessionevent) 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 typecheckpasses. Changelog:changelog.d/account-list-other-sign-in.md.