Give the browser a way out of a corrupt snapshot (Task 7)
The server serves a snapshot without ever calling into the CRDT core, so it cannot detect one corrupted on disk after it was written and verified. Y.readUpdate throwing is the browser's own detection of that, and until now there was no way out: the resync controller would refetch the same corrupt bytes forever, leaving the document permanently unloadable in the editor while it went on rendering fine server-side. live-updates.mjs's fetchSince now takes a second argument carrying a raw flag; drain() retries the same cursor once with raw:true when applying fetched bytes throws, and only advances the cursor once something actually applied — a second throw reports through onError and leaves the cursor alone. editor-entry.js wires the same fallback into fetchSince and into attemptResync's own initial whole-log fetch, which runs before any subscriber exists and would otherwise stop the editor mounting at all. The retry emits the literal query string raw=1, matching handlers.go's raw=1 escape hatch exactly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
4 files changed,
+127
−40
fixtures/editor-entry.js+58 −17fixtures/live-updates.mjs+35 −7fixtures/live-updates.test.mjs+21 −3internal/docs/static/{editor.3e44c12d757809a4.js => editor.9afcd625b7781c14.js}+13 −13
fixtures/editor-entry.jsLoading diff…
fixtures/live-updates.mjsLoading diff…
fixtures/live-updates.test.mjsLoading diff…
internal/docs/static/{editor.3e44c12d757809a4.js => editor.9afcd625b7781c14.js}Loading diff…