Docs: saving never stops while a link is loading, and a stop closes the streams
WebKit refuses every ordinary fetch a page starts while its main frame waits for a navigation's answer: the promise rejects at once with "Load failed" and nothing is sent. The page stays on screen and editable, and a navigation answered with a download, or not at all, never takes it away. Every save then read as a network failure: "Trouble saving. Retrying…", retried four times a second, with no request reaching the edge, until a reload ended the navigation. Measured in WKWebView and Playwright's WebKit; Chromium sends them. Saves now go keepalive (which WebKit still sends then, and which also survives leaving), in batches of at most 32KiB. WebKit never settles a keepalive save answered while its page is in the back/forward cache, so the queue sends again on pageshow and gives up on any save unanswered after 35s; fetch aborts one hung for 30s. On SIGTERM the stream handler never ended, because a graceful shutdown cancels no request: an open editor held the shutdown its full 10s and the process exited 1 (12:49:18-29 today). Docs now drains its hub on the signal, ending every stream at once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 files changed,
+1,085
−18
cmd/docs/main.go+15 −0cmd/docs/shutdown_test.go+184 −0fixtures/editor-entry.js+18 −7fixtures/engines/saving-webkit.swift+142 −0fixtures/engines/saving.mjs+49 −0fixtures/save-queue.mjs+99 −3fixtures/save-queue.test.mjs+113 −2internal/docs/app.go+8 −0internal/docs/hub.go+25 −1internal/docs/saving_browser_test.go+356 −0internal/docs/static/editor.f50559a532abe5ff.js+14 −0internal/docs/stream.go+14 −3internal/docs/stream_test.go+48 −2
cmd/docs/main.goLoading diff…
cmd/docs/shutdown_test.goLoading diff…
fixtures/editor-entry.jsLoading diff…
fixtures/engines/saving-webkit.swiftLoading diff…
fixtures/engines/saving.mjsLoading diff…
fixtures/save-queue.mjsLoading diff…
fixtures/save-queue.test.mjsLoading diff…
internal/docs/app.goLoading diff…
internal/docs/hub.goLoading diff…
internal/docs/saving_browser_test.goLoading diff…
internal/docs/static/editor.f50559a532abe5ff.jsLoading diff…
internal/docs/stream.goLoading diff…
internal/docs/stream_test.goLoading diff…