perf(scripts): the interactive mark waits for the viewer's settled scene
Problem. The load probe marks a load interactive from its trace spans:
- geometry streamed;
- every drain and finalize span that has started is closed;
- metadata is ready;
- the frame after the store settles has passed.
A load that reaches the store's settle before its drain has started passes that rule before the scene exists. That happens on the small-file fast path (#9900), which records no stream.queue span. On FZK with #9900, 2 of 8 samples marked at 434 and 456 ms with no frame drawn yet; scene.finalize ended at about 504 ms and the first frame with draws came at about 503 ms (warm-runtime lane's picture check, untimed).
Change (measurement only; the debug hook is the only viewer change):
- The viewport exposes the viewer's own settled rule as a constant-time debug hook,
__ifc_lite_scene_settled__=isSceneSettled(): store not streaming, no pending instanced shards, and a renderer scene with no queued meshes, no streaming fragments and no finalize running. - The probe holds the mark while that hook reports the scene unsettled. The hold is capped at 15 s. A scene that never settles fails the open with its reason; it never hangs the run or marks silently.
- The mark is still the latest span milestone, so a load the check never holds keeps exactly its old value. Every sample records that old value (
interactiveMsOldGate) together withsceneSettledCheckandsceneSettleHeldMs. - Builds without the hook keep the span rule (
sceneSettledCheck: 'unavailable'). The frozen B0 build is one of them; it never takes the fast path. - Rows also keep presented-frame times from the change event to 3 s after the mark (
presentTimesFromChangeMs). Nothing uses them yet; they let a "first presented frame after X" definition be sized from ordinary runs.
What this does to existing numbers: nothing. I recomputed from stored samples, without new timing: 690 timed, ok browser samples, all sides, every sample's stored trace read.
- Slots covered:
- Result: in 0 of 690 samples does a load neither stream (
stream.queue) nor adopt a snapshot (scene.snapshotAdopted).- Every streamed load already waited for
scene.finalize. - Adopted reopens have no finalize and are settled when adopted.
- Only loads that do neither (#9900's fast path) can change.
- Every streamed load already waited for
- Consequence: past verdicts and the goal board stand unchanged; only #9900 arms move.
Tests (viewer-load-probe-gate.test.mjs, Node 22 and 24; scoreboard suite 71/71):
- A fast-path-shaped load (store settled before any drain span exists, finalize at 504) marks at 424 under the span rule. With the gate it is held, and once settled it marks no earlier than finalize end, with the old value recorded.
- A federated add (no
stream.queue, no finalize), an adopted reopen and a main streamed load keep exactly their old marks, with the hold at 0 ms. - A scene that never settles comes back flagged at the 15 s cap (
sceneSettleTimedOut), andopenAndWaitInteractivethrows, so the sample fails. presentTimesreturns relative, capped times, andnullwhen the counter is absent.
Untimed checks (Pop, untimed, ifc-gpu-check; runs mark/runs/check-*):
- Main + this PR (fed8e83737), FZK, Holter, BWK and advanced_model, cold and both reopens, 48 samples: 48/48 clean.
interactiveMsequalsinteractiveMsOldGatein every sample.- Every settled check read
settled. - Every mark has a finalize end (or an adopted snapshot) and a presented frame by it.
- #9900 + this PR (5e4d8fb3c7), FZK, 4 rounds x 2 sides (8 cold opens, 16 reopens):
- All 8 cold opens are clean, including the case an earlier run of this check found: the store settled before the viewport had installed the hook, and the probe fell back to the span rule (marked at 378 ms, first presented frame at 433 ms). Fixed in fed8e83737 with a build marker,
__ifc_lite_scene_settled_supported__; a build that has the hook but has not installed it yet is held. - One remaining sample is a product gap in #9900, being fixed there:
check-9900FZKbrowser-warm, branch, round 0 marked at 394.1 ms. The settled check was installed and readsettled, butscene.finalizehad not started yet and the first presented frame came at 451 ms. On #9900's fast path,isSceneSettled()is true before its streaming effect has scheduled the finalize. - The fix belongs in #9900: keep the streaming flag, or a pending-finalize flag, set until that effect has finalized. That also affects every viewer consumer of the settled check.
- This PR deliberately does not add a finalize requirement to the probe.
- All 8 cold opens are clean, including the case an earlier run of this check found: the store settled before the viewport had installed the hook, and the probe fell back to the span rule (marked at 378 ms, first presented frame at 433 ms). Fixed in fed8e83737 with a build marker,
- Acceptance check for #9900's confirmation run:
mark/summarize.pymust report 0 flagged samples. It flags any settled check other thansettledon a build with the hook, a non-adopted load with no finalize by the mark, and a mark with no presented frame by it.
The definition question "interactive = first presented frame that draws the final scene" is deliberately not in this PR. It would move 190 of the 690 stored samples, where the mark is the finalize end itself, by an amount stored rows cannot size.
š¤ Generated with Claude Code