perf(scoreboard): verify reopen output with an untimed identity pass
Why
A cache hit carries no element geometry hashes, so every browser-warm1 and browser-warm cell read UNVERIFIABLE; on board B2 that was 12 cells. Reopen lanes that change what a cache hit adopts (snapshots, cache keys computed from file slices) need a real output verdict.
What
Viewer (only under ?perf.sceneIdentity=1, a new kill-switch entry in the perf-flag registry). Timed and memory samples never set it; a normal load does one flag read per tap.
-
sceneIdentityTap.tshashes two things off the load path:- the snapshot as the cache stored it (after
putSceneSnapshot, ordinals already reordered); - the snapshot a reopen adopted.
The hasher,
sceneIdentity.ts, is loaded only when the flag is on. - the snapshot as the cache stored it (after
-
__ifc_lite_scene_identity__()covers every CPU geometry piece the scene keeps: flat pieces and materialised instanced occurrences. Each is hashed by exact bytes (positions, normals, indices, colour) per expressId, independent of order. The hook also returns the tapped snapshot signatures.
Scoreboard (load-scoreboard-identity.mjs):
- Round 0 adds one untimed identity sample per side and fixture.
- A reopen matches only if its pieces equal its own cold open's, and every snapshot it adopted equals one that an earlier open of the sample wrote. Before leaving each page, the pass waits for every cache write to close and then re-reads the written signatures.
- With
browser-cold's element hashes (base cold == branch cold), this links across sides. A reopen lane's output verdict now comes from these rows; missing input is never a match. - Control:
LOAD_SCOREBOARD_CORRUPT_SNAPSHOT=1flips one vertex byte of every stored snapshot before each reopen, a different byte per reopen. The table CRC still passes, so the viewer adopts and draws the snapshot, and the verdict must read RESTORE MISMATCH.
Evidence
Untimed dry runs on Pop under ifc-gpu-check, viewer build 70ecd5a09c against itself, 1 round:
| fixture | normal run (harness 0d060ecffb) | altered-snapshot control (harness 294df5e40a) |
|---|---|---|
| FZK (uncached tier, reopens stream) | match on both sides, both reopens | match: nothing is stored to alter (correct) |
| advanced_model (adopts snapshot) | match on both sides, both reopens | RESTORE MISMATCH on both sides, both reopens |
| Holter (adopts snapshot) | match on both sides, both reopens | RESTORE MISMATCH on both sides, both reopens |
- Normal run: the piece layer is identical across cold, warm1, warm2 and both sides (e.g. advanced_model 6,401 elements, 11,223 pieces).
- Control: each note records the flipped byte, e.g. Holter base
@223712: 48->12. - Harness revisions: 294df5e40a changed only the control function. Earlier revisions fixed three harness bugs, each found by these dry runs:
- comparing against the finalize capture instead of the stored, reordered snapshot;
- a race with the deferred snapshot write;
- the control flipping a rewritten byte back, then a shadowed name that made the flip position NaN.
Gates
- At efb32e819b (fleet c87faa97): perf-flag lint, viewer typecheck, focused viewer tests (sceneIdentity, perf flags, viewport debug hooks, sceneSnapshot) and scoreboard tests all passed.
- Since then: the viewer changed only in the tap point (written instead of captured), and the scoreboard tests (
load-scoreboard-identity+-stats+-cli) pass locally on node 24.22. The same gates at 70ecd5a09c passed on the PC: perf-flag lint and viewer typecheck; focused viewer tests, 5 files, 42/42; scoreboard tests 51/51. The commits after 70ecd5a09c touch onlyscripts/perf.
Gates at the final head (ceba2e4266, 2026-11-13):
- Perf-flag lint and viewer typecheck passed on the PC at 597b33d034.
- That PC run failed one focused test, "a JSON round trip of hostData keeps the signature". The test round-tripped the whole snapshot, turning typed arrays into plain objects. ceba2e4266 fixes the test only; production code and the signature are unchanged.
- On ceba2e4266: focused viewer tests 44/44 (5 files), scoreboard tests 58/58.
- Identity dry run at 597b33d034 (Holter + advanced_model, 16/16 samples each): normal
matchon every snapshot-adopting reopen; alteredRESTORE MISMATCHon all four.
Known limits (both fail closed: a changed scene never reads match), follow-up #9990:
- F1: the byte hash depends on view alignment (words when 4-aligned, bytes otherwise). It can produce a false
RESTORE MISMATCH, never a false match, and none occurred on the dry run. Until #9990 lands, rule out F1 before treating an identity-passRESTORE MISMATCHas a product difference: rerun once and compare alignment. The fix changes every signature, so it needs its own proof. - F2: reopen verdicts chain only through the plain
browser-coldlane. A plan with only suffixed cold lanes (-settled,-early) readsunverifiable.
Usage for a reopen PR: both sides' builds must contain this commit. A build without the tap reads unverifiable, never a match.
š¤ Generated with Claude Code