docs: the live stream owns its page lifecycle; check coverage by logical family
Review on #86. P2: the editor registered its pagehide/pageshow handlers after the fonts were ready and two animation frames, but started the stream before. A page left in between, or hidden and so running no frames, went into the back/forward cache with its stream open; Astra saw two streams held in full Chrome, and cached restores with no handlers in an occluded WKWebView. live-updates.mjs now owns the page's lifecycle: one pagehide/pageshow listener installed when the module loads, before any subscriber or stream can exist, which closes every stream on pagehide, refuses to open one in a page that has been left, and reopens on pageshow from the cache, on the next task (WebKit fails a stream opened inside pageshow, then reconnects one the module no longer holds). The editor's own handlers are gone. P2: the coverage test no longer subtracts committed families. Each element and text node's logical family (its font mark's class, code or pre, or the default) is checked before any fallback: the gate's families are exactly the DOM's logical families and every logical face is one the gate waited for; a committed family must be one the gate waited for and is drawn only in its declared fallback; what is drawn is the gate's families less those committed. A second pass makes every face late past the deadline, so committed families are exercised. Tests, failing first: - TestLeavingADocumentEarlyLetsGoOfItsStream: Chromium with its back/forward cache on (fixtures/engines/leaving.mjs) and a hidden WKWebView (fixtures/engines/leaving-webkit.swift), no animation frames, leaving the moment the stream opens; a collaborator edits while it is away. On 6b2a727 and on main a0dd33a, Chromium keeps the stream open in the cache, and WebKit never reconnects or catches up. - live-updates.test.mjs: leaving closes and coming back reopens and catches up; a page left before its subscriber starts opens nothing. - The coverage test under late fonts catches two gate mutations (an extra family, and italics left out) that the old subtraction let through.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+659
−121
fixtures/editor-entry.js+2 −7fixtures/engines/leaving-webkit.swift+115 −0fixtures/engines/leaving.mjs+59 −0fixtures/live-updates.mjs+65 −14fixtures/live-updates.test.mjs+34 −5internal/docs/fonts_browser_test.go+159 −85internal/docs/leaving_browser_test.go+215 −0internal/docs/static/{editor.a987940e8957731f.js => editor.196c375f7a6a7ab9.js}+10 −10
CI passed — run details
fixtures/editor-entry.jsLoading diff…
fixtures/engines/leaving-webkit.swiftLoading diff…
fixtures/engines/leaving.mjsLoading diff…
fixtures/live-updates.mjsLoading diff…
fixtures/live-updates.test.mjsLoading diff…
internal/docs/fonts_browser_test.goLoading diff…
internal/docs/leaving_browser_test.goLoading diff…
internal/docs/static/{editor.a987940e8957731f.js => editor.196c375f7a6a7ab9.js}Loading diff…