Repository navigation
Commit f4f38c1
committed
fix(cloud): #92 review, round four — a replay that asks twice, windows that catch up
1. The replay decided before its read and posted after it. replaySessionExpired
asked "is an expiry waiting?", awaited SecretStorage, then posted on that
answer. "Use my own key instead", or a switch to BYOK, landing while the read
was out left the answer stale, and the card came back after the user had
dismissed it. It asks again after the read, immediately before posting. It
also no longer rejects: it runs at the end of a resume or a checkpoint restore,
and a store that will not read is no reason to cut those short.
2. A window did not notice another window ending the session they share. The
focus check returned at "no token", so this window's flag, popover and footer
stayed on "signed in", with no card, until the next message failed — a chat
that is already open sends no second `ready`. The check now starts by
comparing what is stored with what this window is showing, and catches up
when they differ (catchUpWithStoredSession): ended elsewhere -> the card and a
signed-out popover; signed out elsewhere -> the popover; signed IN elsewhere
-> the account message that takes a card still on screen back down.
Two things had to move for that to work. The ten-minute ration lived in the
focus hook, so a window that had checked a minute ago did not look at all; it
is inside the check now, on the half that can cost a request, and every focus
does the local half. And the token is read between session changes
(storedToken), so this window's own half-finished sign-out — flag already
cleared, token not yet deleted — is not mistaken for another window's doing.
On `ready` nothing changes: the handler has just read the same token, and the
card is still replayed last. checkCloudSession no longer rejects either.
3. Not changed here: what inline edit and Agent Sketch say for an ended session.
#95, stacked on this branch, already does that — the shared sentence in both,
and a Sign in action on the edit.
Verified: 43 suites, 768 cases, 0 failing. sessionExpiredHost.test.js goes from 57
to 67 cases; its SecretStorage stand-in can now hold a read open or refuse one.
Each defect put back fails its own case: no second look -> "no card for an expiry
that is no longer waiting", for both ways of answering it; no catch-up on the
check -> the three other-window cases; catching up only on "gone" -> the sign-in
direction; the ration back in the hook, or ahead of the catch-up -> the wiring
guard and "found inside the ten minutes"; the check or the replay allowed to
reject -> "the keychain is locked" escapes; the token read mid-change -> a
second account resync during this window's own sign-out. tsc --checkJs reports
nothing new.1 parent 29ee664 commit f4f38c1
3 files changed
Lines changed: 199 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 430 | + | |
439 | 431 | | |
440 | 432 | | |
441 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
442 | 459 | | |
443 | 460 | | |
444 | 461 | | |
| |||
579 | 596 | | |
580 | 597 | | |
581 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
582 | 602 | | |
583 | 603 | | |
584 | | - | |
585 | | - | |
586 | | - | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
587 | 614 | | |
588 | 615 | | |
589 | 616 | | |
| |||
592 | 619 | | |
593 | 620 | | |
594 | 621 | | |
595 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
596 | 627 | | |
| 628 | + | |
597 | 629 | | |
598 | 630 | | |
599 | 631 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
608 | 648 | | |
609 | 649 | | |
610 | 650 | | |
| |||
1432 | 1472 | | |
1433 | 1473 | | |
1434 | 1474 | | |
1435 | | - | |
| 1475 | + | |
1436 | 1476 | | |
1437 | 1477 | | |
1438 | 1478 | | |
| |||
3293 | 3333 | | |
3294 | 3334 | | |
3295 | 3335 | | |
3296 | | - | |
| 3336 | + | |
3297 | 3337 | | |
3298 | 3338 | | |
3299 | 3339 | | |
3300 | 3340 | | |
3301 | | - | |
3302 | | - | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
3303 | 3345 | | |
3304 | | - | |
| 3346 | + | |
3305 | 3347 | | |
3306 | 3348 | | |
3307 | 3349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | | - | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | | - | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
210 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
211 | 222 | | |
212 | 223 | | |
213 | 224 | | |
| |||
915 | 926 | | |
916 | 927 | | |
917 | 928 | | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
918 | 1034 | | |
919 | 1035 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
| |||
0 commit comments