fix(decoder): connect even when the browser storage is full

A big installation outgrew the localStorage quota; saveState() threw
QuotaExceededError and, since connecting saves first, the decoder never
came online. The local copy is only a cache of the server state, so a
write that doesn't fit now drops it instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Opus 5.5 committed 2026-10-18 16:06:35 +02:00
1 parent c8a797fe6f
commit 2c6c37f6ca
9 files changed
+99 -4

No files matched your search

+9
View File
@@ -967,6 +967,15 @@ Reported by the user: non-technical club members found it too hard to start a ne
Verified: 266 unit tests and 80 browser scenarios pass, including `tests/browser_race_day_quick.js` (Dashboard Start practice creates, starts and opens a practice on Race Day; the quick layout moves it; the picker switches session; Timing has no run controls). `tests/browser_race_day.js` now checks that buttons are shown only when they apply. Video frames checked: count-down, To 10 s, then Pause/Finish once the heat runs.
### Follow-up: decoder offline from a full browser storage (2026-10-18)
The decoder kept showing offline on the club PC although AMMC on 9443 was reachable (TCP from the PC, a `101 Switching Protocols` handshake from the server) and served other clients. The browser console showed `QuotaExceededError` on `localStorage.setItem("rc_timing_control_v1")` in `saveState()`, called by `connectDecoderHelper` before it opens the socket - so every Connect and the startup connect aborted. The diagnostic log only ever showed `disconnected`, never `connecting`.
- [x] `src/local_cache.js` `writeLocalCache()`: never throws; on failure it removes the stale cache (no partial copy, which could be synced back over the server state).
- [x] `saveState()` uses it and warns once in the console.
Verified: unit tests in `tests/local_cache.test.js`; `tests/browser_decoder_url.js` makes the state key throw `QuotaExceededError` and checks that Connect still reaches a fake decoder, the URL is saved to the server and the local copy is dropped. It fails without the fix ("Timed out: connects although the browser storage is full"). 269 unit and 81 browser scenarios pass.
## Documentation maintenance
- [x] Update the architecture's module/dependency inventory as modules change.