oficina / docs Public

The flash was a reconnect, and a hidden tab now keeps its stream

A hidden tab closed its stream on the spot. Coming back reopened it and
fetched the catch-up, and that round trip cannot beat the paint: the
browser draws the document it already has, which is the one from before
you left, and the corrected text arrives a frame later. On loopback the
gap is 18ms. Over a real network it is the whole round trip, which is
why Paul could see it plainly and a local frame capture could not.

Measured, both ways round, with fixtures/flash-frames.mjs:

  before  DOM has the edit while hidden: false   painted frames showing
                                                 the old text: 1
  after   DOM has the edit while hidden: true    painted frames showing
                                                 the old text: 0

A hidden tab now shortens its deadline to 30s instead of closing, so a
switch away and back never disconnects and there is nothing to catch up.
That is still four times more aggressive than the 120s a merely idle
visible tab already gets, so §7.3's hibernation requirement is served
better than before, not worse.

Two instruments were wrong before they were right, and both are recorded
in the harness so the next person does not repeat them. Counting DOM
mutations measures a proxy: it went to zero in the previous branch while
the thing a person sees was untouched. And Chromium hands a screencast
the last composited surface of a hidden tab, which arrives looking
exactly like a paint — the first version of this harness read one of
those, delivered 787ms BEFORE the reveal, as the flash. The rAF sampler
is the honest instrument: it does not run while hidden, so its first
entry is the first frame actually drawn.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012SBUuPZfv4crd5SGGNscyA
Paul Campbell pushed by paul@keymail.dev fa1309ddb07e3306a64cd45ef30fc15a03b75293 parent d20a813
6 files changed, +398 −24
  • fixtures/editor-entry.js +8 −4
  • fixtures/flash-frames.mjs +290 −0
  • fixtures/live-updates.mjs +44 −3
  • fixtures/live-updates.test.mjs +42 −3
  • internal/docs/static/editor.5dc0309cb2a5ef6b.js +0 −14
  • internal/docs/static/editor.879cf51cc4b8e027.js +14 −0

CI passed — run details

Intent

Attributed to this commit: 130 g CO₂e (14378401 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on flash-stale-paint, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

fixtures/editor-entry.js

Loading diff…

fixtures/flash-frames.mjs

Loading diff…

fixtures/live-updates.mjs

Loading diff…

fixtures/live-updates.test.mjs

Loading diff…

internal/docs/static/editor.5dc0309cb2a5ef6b.js

Loading diff…

internal/docs/static/editor.879cf51cc4b8e027.js

Loading diff…