# Validation lab

[Run the hosted demo](https://sergrdz.pages.dev/demos/validation/) · [Watch the browser recording](https://sergrdz.pages.dev/demos/validation/walkthrough.mp4)

The silent recording is 13.5 seconds long, rounded to 14 seconds in the portfolio. It captures the actual browser tour with the original frame timing and a short final hold. Optional English captions describe each fixture; the cases below provide the text equivalent.

A standalone, dependency-free browser demo with **synthetic fixtures / offline replay**. Open this directory through a static web server and select a scenario, then **Run check**. The **12-second tour** runs all three cases. Reset clears the selected case; selecting another tab or running a manual check cancels the tour.

The demo makes no API calls, uses no browser storage, and contains no account data, positions, balances, keys, local repository paths, or real trade records. Every displayed value is calculated from the small invented fixture in `demo.js`. JavaScript modules require an HTTP server; opening the HTML directly with `file://` may block the script.

## Cases and limits

1. **Future-event leakage.** A decision at 2 seconds can use the events at 0.5, 1.2 and 1.9 seconds. Appending a buy at 4 seconds cannot change its two known buys. The demo checks both event visibility and feature invariance. It does not certify a production pipeline's timestamp accuracy or train/test isolation.
2. **Undefined model AUC.** The illustrative minimum is 0.55. A guard based only on `score < minimum` accidentally permits NaN because that comparison returns false. The guarded condition requires `Number.isFinite(score) && score >= minimum`. Rejecting an invalid score does not establish that an accepted model is useful, calibrated, or profitable.
3. **Same-bar stop sequencing.** Invented units: entry 100, existing stop 95, high 110, low 94, breakeven trigger 108. The conservative replay honors the existing stop and returns -1 risk unit (R). Moving the stop first would produce 0 R by assuming a favorable event order. OHLC data cannot establish the actual intrabar sequence; this is an explicit simulation convention, not proof of observed execution. The tiny fixture omits spreads, fees, slippage, tick data and other execution rules.

There are three deterministic assertions per case. The check indicators are calculated from expected and observed values, not hard-coded success messages. The wider engineering project's historical test totals are deliberately not presented as a live counter or as tests executed by this demo.

## Inspecting the code

`demo.js` exports `fixtures` and `evaluateScenario(id)`. The IDs are `leakage`, `auc`, and `sequence`. The module's UI initialization is guarded so its assertions can also be inspected in a JavaScript runtime without a browser DOM.

`demo.css` contains the responsive layout. Tab controls support Left/Right, Home and End; buttons support ordinary keyboard activation. Results have a polite live region, visible focus indicators and expected/observed text. Decorative animations honor the reduced-motion preference. The tour pauses when the page becomes hidden.

The backlink targets `/`. All page assets are relative to this directory, with no build step or third-party dependency.
