Repository navigation
Description
Problem
An oracle for DOM code must run in jsdom today, so its driver supplies the
browser facts that jsdom lacks: layout, scroll positions, the targets where
scroll events fire, ResizeObserver notifications, and computed styles. When
the driver's stand-in and production rest on the same wrong belief about the
browser, the oracle passes, and only a human or a real browser finds the bug.
We hit this three times in one pull request (react-headroom):
- The stand-in notified a
ResizeObserveron any size change. Chrome notifies
a content-box observer only when the content box changes, so a header that
changes only its padding kept a stale height. - The stand-in decided that a body with
overflow-y: autoscrolls itself.
Withhtml { overflow-y: scroll } body { overflow-x: hidden }, Chrome
computes the body'soverflow-yasauto, but the body grows with its
content and the page scrolls. - The stand-in gave a body the viewport's height. In Chrome, a body that does
not scroll itself grows with the page.
We checked each fact by hand in headless Chrome. An oracle that runs in
Chrome would have checked them on every run.
What stops it at 4749f61
oraclePropertyimportsnode:async_hooks(AsyncLocalStoragefor probe
windows),node:fs(appendFileSync) andnode:util(inspect,
isDeepStrictEqual,types). In Vitest browser mode the test file fails
to import:AsyncLocalStorage is not a constructor.- The gap check's setup file (
oracle-gaps/capture-setup.mjs) reads its run
state fromprocess.env.ORACLE_GAPS_STATEwithreadFileSync. In browser
mode, setup files run in the page.
Request
- Let
oraclePropertyanduseOracleClockrun in Vitest browser mode, for
example with a browser-safe entry that replacesAsyncLocalStorage,fs
andutilwith browser equivalents or leaves those features out. - Let
oracle-gapsrun an oracle in browser mode, or document that it cannot,
and recommend a pattern: for example, an oracle that runs in Chrome for its
laws, and the same oracle in jsdom for the gap check.
Workaround we considered
Keep the oracle in Node and drive a Chrome page through Playwright: the
driver sends each history to the page, which runs it against a bundle of
production and returns the observations. This needs a page bundle, a
page-side clock in place of useOracleClock, and two copies of the driver
environment. The gap check still cannot mutate the code in the page.
Activity
KyleAMathews commentedon Nov 12, 2026
Triage: this is a valid gap. A stand-in for a browser fact and the production code can rest on the same wrong belief, and only a real browser can check that fact. We will add browser support in two phases.
What blocks browser mode at cc7bf09
All the Node-only code is in
src/oracle-property.ts, plus oneappendFileSyncinsrc/oracle-replay-witness.ts.AsyncLocalStorageisDeepStrictEqualtypes.isProxytypes.isMap,isSet,isNativeErrorinstanceofandObject.prototype.toStringchecksinspectappendFileSync,process.env.ORACLE_MANIFEST,process.stdout.writecommandsfrom@vitest/browser/context), which run on the Node sidePlan
Phase 1:
oraclePropertyanduseOracleClockrun in Vitest browser mode.browserexport condition, so Node behavior does not change.Phase 2:
oracle-gapsmutates code that runs in the page. Vitest browser mode serves the test file and the production code through Vite, and the gap CLI already instruments code through Vite. So mutants can reach the page. The run state and the captured observations then go through browser commands instead offsandprocess.env. Phase 2 needs a design of its own, which comes first.Until then
page.clockcan take the place ofuseOracleClockin the page. Send the whole history to a runner in the page, rather than making one round trip per step.This comment was written by Isaac.