test(web): read crosscheck pages with the clock paused
Merged
OK
13d ago+38+38+01234567890123456789-7-7-0123456789
The web crosscheck sometimes failed on benchmark: stale-dom with getByRole button "Decoy" / "Tap me": ours match, theirs no match (seen on #1552, gone on rerun). It was a race in the harness, not a regression in the engine.
stale-domremounts every row on a 1ssetInterval. The crosscheck tags the engine's elements, reads Chrome's AX tree, and then asks Playwright, all on the live page. When a tick landed between those reads, Playwright was asked about tagged buttons that had already been detached.- Reproduced at random tick phase under 8x CPU throttle: 8/40 runs on main, the same at
HEAD~4(before #1546-#1551). None of those merges caused it. - Fix:
openCheckPage(packages/web/tests/crosscheck/crosscheck.ts) installs Playwright's clock paused before any document loads. Timers never fire, so the engine and both oracles read the same document. React and Next.js still hydrate (their scheduler usesMessageChannel), andexpected.txtis unchanged. - No retries or margins. Pausing the clock mid-page can't target "now" (
pauseAtthrows on a past time), and CDP virtual time stalled Playwright calls, so the clock is paused from the start. - Coverage cost: the reviewer diffed all 42 scenarios. Only
overlay-trapchanged, losing a close button that a 500ms timeout reveals and that was only checked when the timeout beatnetworkidle. - New fixture
list rebuilt every millisecondguards the race. AGENTS.md notes that content revealed by a timer is never read.
Verified
Ran it locally: yes
stale-domthroughcrossCheck40 times, random phase, 8x CPU throttle:
| main | this branch |
|---|---|
8/40 runs report the two getByRole misses | 0/40, same 9 nodes compared |
- New fixture with the clock install removed: fails with
chrome unknown/missingon the rebuilt buttons. With it: passes. - Full crosscheck against a local benchmark (
CROSSCHECK_BENCHMARK_URL): 19/19 passed,expected.txtuntouched.