Commit 3a6d5e5
refactor(auth): replace SessionManager facade with SessionStateMachine actor
Replaces the two-layer `SessionManager` struct + `LiveSessionManager` actor
with a single `SessionStateMachine` actor that owns all session state
transitions explicitly.
- Introduces `SessionState` enum with `.uninitialized`, `.unauthenticated`,
`.authenticated`, and `.refreshing` cases
- State starts as `.uninitialized` and loads from storage on first access,
avoiding a dependency on `Dependencies` being registered before init
- Refresh coalescing is now an explicit property of the `.refreshing` state
rather than an implicit nullable `Task?` field
- `remove()` cancels any in-flight refresh task via the `.refreshing` state
- `.tokenRefreshed` event emission is consolidated inside `refresh(token:)`
- Removes the `SessionManager` struct facade; consumers hold a
`SessionStateMachine` reference directly via `Dependencies`
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent fe75f12 commit 3a6d5e5
10 files changed
Lines changed: 233 additions & 194 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
142 | | - | |
| 144 | + | |
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| |||
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
354 | | - | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
| |||
457 | 459 | | |
458 | 460 | | |
459 | 461 | | |
460 | | - | |
| 462 | + | |
461 | 463 | | |
462 | 464 | | |
463 | 465 | | |
| |||
635 | 637 | | |
636 | 638 | | |
637 | 639 | | |
638 | | - | |
| 640 | + | |
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
| |||
895 | 897 | | |
896 | 898 | | |
897 | 899 | | |
898 | | - | |
| 900 | + | |
899 | 901 | | |
900 | 902 | | |
901 | 903 | | |
| |||
960 | 962 | | |
961 | 963 | | |
962 | 964 | | |
963 | | - | |
| 965 | + | |
964 | 966 | | |
965 | 967 | | |
966 | 968 | | |
| |||
976 | 978 | | |
977 | 979 | | |
978 | 980 | | |
979 | | - | |
| 981 | + | |
980 | 982 | | |
981 | 983 | | |
982 | 984 | | |
| |||
1084 | 1086 | | |
1085 | 1087 | | |
1086 | 1088 | | |
1087 | | - | |
| 1089 | + | |
1088 | 1090 | | |
1089 | 1091 | | |
1090 | 1092 | | |
| |||
1189 | 1191 | | |
1190 | 1192 | | |
1191 | 1193 | | |
1192 | | - | |
| 1194 | + | |
1193 | 1195 | | |
1194 | 1196 | | |
1195 | 1197 | | |
| |||
1206 | 1208 | | |
1207 | 1209 | | |
1208 | 1210 | | |
1209 | | - | |
| 1211 | + | |
1210 | 1212 | | |
1211 | 1213 | | |
1212 | 1214 | | |
| |||
1234 | 1236 | | |
1235 | 1237 | | |
1236 | 1238 | | |
1237 | | - | |
| 1239 | + | |
1238 | 1240 | | |
1239 | 1241 | | |
1240 | 1242 | | |
| |||
1385 | 1387 | | |
1386 | 1388 | | |
1387 | 1389 | | |
1388 | | - | |
| 1390 | + | |
1389 | 1391 | | |
1390 | 1392 | | |
1391 | 1393 | | |
1392 | 1394 | | |
1393 | 1395 | | |
1394 | 1396 | | |
1395 | | - | |
| 1397 | + | |
1396 | 1398 | | |
1397 | 1399 | | |
1398 | 1400 | | |
1399 | 1401 | | |
1400 | | - | |
| 1402 | + | |
1401 | 1403 | | |
1402 | 1404 | | |
1403 | 1405 | | |
| |||
1411 | 1413 | | |
1412 | 1414 | | |
1413 | 1415 | | |
1414 | | - | |
1415 | | - | |
| 1416 | + | |
| 1417 | + | |
1416 | 1418 | | |
1417 | 1419 | | |
1418 | 1420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
126 | 128 | | |
127 | | - | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 69 | + | |
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
| |||
118 | 114 | | |
119 | 115 | | |
120 | 116 | | |
121 | | - | |
| 117 | + | |
122 | 118 | | |
123 | 119 | | |
124 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
This file was deleted.
0 commit comments