Repository navigation
fix(web): keep paired web starting when a settings migration write fails - #48524
Conversation
The app rail cohort change dropped the catch around the optional web settings migration write. getStoredSettings runs while window.api is built, so a full or denied localStorage threw before the app mounted and Retry threw again. Restore the catch; the migration reruns next load.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ils (#48524) * fix(web): keep startup working when the settings migration write fails The app rail cohort change dropped the catch around the optional web settings migration write. getStoredSettings runs while window.api is built, so a full or denied localStorage threw before the app mounted and Retry threw again. Restore the catch; the migration reruns next load. * test(web): restore the storage spy and cover a denied OSC 52 notice write
Summary
Paired web could fail to start when the browser refused a settings write (storage full or writes denied).
#48442 removed the try/catch around the optional browser-settings migration write in
getStoredSettings. That function runs whilewindow.apiis being built (installWebPreloadApi→createWebUiApi→readLocalWebUIState→getStoredSettings). So iflocalStorage.setItemthrew, the error escaped before the app mounted, and the web root's Retry hit the same error again.This PR restores the catch around the migration writes: the settings write and the OSC 52 notice write. Settings still load from what is stored. Existing browser profiles still read the app rail as off on every load until a write succeeds, so the new-user vs existing-user behavior from #48442 does not change. The next settings read retries the write.
Fixes STA-17981.
Out of scope: if the settings write succeeds but the OSC 52 notice write fails, that notice is not shown again. Main behaved the same way before #48442.
Testing
web-preferences-app-rail-default.test.ts: existing readable settings with every write denied, and only the OSC 52 notice write denied. Both fail on main withQuotaExceededErrorand pass with this change (run locally on this one file).No comparable: mechanical.
Performance
None, by reading the code. This adds one try/catch on an existing path. When writes keep failing, each settings read retries one write: one
JSON.stringifyplus one thrown exception. That is the same cost as before #48442 and small next to the JSON parse each read already does. Nothing loops or recurses.