Commit f20c40e
fix(addon): stop closing Send tabs when access token has expired (#949)
* fix(addon): stop closing Send tabs when access token has expired
getLoginState() treated an expired OIDC access token (short-lived
`expires_at`) as logged out and called closeAllTbProTabs(), which removed
every send.tb.pro tab — including a Send dashboard tab just opened from the
accounts dashboard inside Thunderbird. The session is still valid: the Send
web app refreshes the access token transparently via signinSilent() using
the refresh_token.
Make getLoginState() a read-only probe: report logged-in based on a stored
session with a refresh_token, regardless of access-token expiry, and drop the
destructive closeAllTbProTabs()/storage-wipe/menuLogout() side effects (real
logout already flows through the SIGN_OUT path). Remove the now-unused
closeAllTbProTabs() helper. Add menu.test.ts covering the regression.
Closes #948
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(send): dedupe OIDC silent refresh and preserve session on transient failure
The web app's token-refresh design caused a storm of token/userinfo requests
and spurious logouts inside Thunderbird. automaticSilentRenew plus on-demand
signinSilent() with no deduplication fired concurrent refreshes that race under
refresh-token rotation (losers fail with invalid_grant), and loadUserInfo added
a post-refresh userinfo round-trip that can fail in Thunderbird and reject an
otherwise-successful refresh; the library's iframe fallback also cannot run there.
- automaticSilentRenew: false, loadUserInfo: false (profile claims come from the
id_token) to remove uncontrolled renews and the fragile round-trip.
- Shared in-flight refreshAccessToken() promise dedupes concurrent callers.
- Distinguish genuine auth failures (invalid_grant/login_required/session_expired)
— which clear login state and notify the add-on via SIGN_OUT — from transient
failures, which preserve the session for a later retry.
Adds auth-store.test.ts.
Closes #951
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(send): stop uploads firing with an empty ownerId (400 storm)
When the session had not populated user.id, the create-entry POST /api/uploads
sent ownerId: undefined; JSON.stringify drops the key, the backend Zod schema
rejects it with 400 ("ownerId Required"), and the upload retry loop re-fired the
whole block repeatedly — the visible signed -> PUT(200) -> uploads(400) storm.
Guard uploadItem: if user.id is empty, re-hydrate via populateFromBackend(), and
if it is still empty, abort with a clear error instead of sending an ownerId-less
body. The Uploader holds the same shared reactive user object, so re-populating
also fixes this.user.id inside doUpload.
Closes #950
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c3ae0a5 commit f20c40e
5 files changed
Lines changed: 380 additions & 79 deletions
File tree
- packages
- addon/src
- test
- send/frontend/src
- apps/send/stores
- stores
- test/stores
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 137 | + | |
156 | 138 | | |
157 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
158 | 149 | | |
159 | 150 | | |
160 | 151 | | |
161 | 152 | | |
162 | 153 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
178 | 158 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 159 | + | |
182 | 160 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
187 | 166 | | |
| 167 | + | |
188 | 168 | | |
189 | 169 | | |
190 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
268 | 285 | | |
269 | 286 | | |
270 | 287 | | |
| |||
0 commit comments