Linora

0015. Testing strategy and performance gates

Status: Accepted (2026-11-27). Amended 2026-11-27 (WP-E0, coordinator decision): the perf gate is an interleaved before/after comparison, not a comparison with a stored baseline; see “Amendment” below.

Decision

Amendment (2026-11-27): interleaved perf gate

Context. P0 Bootstrap measured identical code in separate sessions on the reference machine while other agents built and tested in parallel: fps moved by up to ~6% between sessions, and the headless worst-zoom GPU time by 6.1-7.8 ms (the GPU clock follows load). A fixed 3% band against a stored baseline.json therefore fails good changes and can pass bad ones; only an interleaved A/B in one time window separated real effects from noise (docs/perf/baseline.md).

Decision.

  1. fps: the gate builds both trees (production builds, served cross-origin isolated) and runs them interleaved in the same session, at least 5 runs each in ABBA order (slow drift cancels). Each run is a fresh headless page, uncapped (no vsync), that generates the scene, warms up and runs every benchmark once. The gate compares the per-benchmark medians and fails if the after median is more than 5% below the before median.
  2. Worst-zoom GPU (headless): each run also sweeps 11 zoom levels in a fresh vsync-capped headless page; the gate compares the medians of the runs’ worst-zoom GPU times relatively: warn above +10%, fail above +20%.
  3. Absolute GPU budget: worst-zoom GPU <= 3.6 ms is checked in a headed run (tools/bench/run.ts without --headless) at each milestone (end of E0, E1, E2, P3), and the result is recorded in docs/perf/.
  4. docs/perf/baseline.json stays as the P0 record; --compare <file> still prints an absolute comparison for information, never as the gate.

Alternatives. Tighter absolute bands with more runs per session (still exposed to session-to-session drift); means instead of medians (one throttled run moves them); a quiet-machine requirement (not available while waves run in parallel).

Consequences. One gate run takes ~15 minutes for both scenes at 5 runs per tree. A regression is detected relative to the code being replaced, so slow regressions spread over many commits are caught by the headed milestone runs and by comparing milestones (--before <milestone commit>), not by each gate. Command: node tools/bench/run.ts --gate [--before <ref>] [--runs N] [--scenes website,shapes] [--out <file>].

Consequences

No test framework dependency; Playwright is the only test-time install.