Files
reims-vgpu/scripts/visual-gate/README.md
T
Anees IqbalandClaude 9e3969b0ef ✨ The probes that could have caught the reset now gate the commit that would cause it
Performance work on this device has been verified against clippy, unit tests,
the feature matrix and device-side counters. None of those can see a rendering
regression. A branch of 59 commits — 21 code-changing, +7687/-820 across 38
files — was reset off wholesale because it had introduced graphical glitches,
and every one of those commits had been verified. The instruments were
performance instruments because the work was performance work, so the defect was
invisible by construction. Nothing lied; the right question was never asked.

Three probes already ask it. Each is a two-observation instrument — the guest
declares what it believes it drew and where, the host measures its own capture
at exactly those places — which is what separates "the guest declined to draw
it" from "this device lost it". None of them gated anything. That is the defect
this fixes.

`scripts/visual-gate/visual-gate.sh` is one entry point:

- It refuses to start on an unsettled guest. sshd answers well before the
  desktop composites, and one probe run in that window read 12.2 fps with the
  device idle at `duty=0.001`. It polls `uptime` for a 1-minute load average
  under SETTLE_LOAD (1.0) up to SETTLE_TIMEOUT (420 s), and aborts if QEMU stops
  matching, so a boot that died early cannot read as a clean run.
- It runs all three probes even when an earlier one fails. Which probe fails is
  the diagnostic.
- It marks the fail log by byte offset before the first probe and applies the
  six silent-loss classes over its own window only, never the accumulated log,
  which spans builds. Byte offset rather than timestamp because the device's
  `t=` clock does not correlate with the shell's — the same bound
  `window-drag-probe` uses.
- One verdict line; exit 0 clean, 1 regression, 2 setup failure.

`--quick` cuts the trials to 5/3/3 for iteration; the README says a green
`--quick` is not a phase sign-off, and that a change whose failure mode needs a
second frame to appear wants the full gate run twice on one boot.

The counter parsing is its own script so it can be tested without a boot. That
split is the point: a parser that matches nothing prints the same six zeros a
clean run does, so a green gate would mean nothing and its output could not say
which. AGENTS.md carries the rule itself, next to the section on what a
screenshot cannot say.

Component: `scripts/`, x86/PCI and arm64 pathways alike; no Rust and no device
behavior.

Tests: `scripts/visual-gate/self-test.sh`, 10 cases over synthetic log text
quoted from the emitters, no guest or GPU needed. Mutation-checked twice:
dropping the `^` anchor on the line families fails exactly the
"matches its own prefix only" case, and matching route fields by prefix instead
of exactly fails exactly the "a longer field name is not this class" case.
`bash -n` clean on all three scripts. The gate's own refusal path was exercised
with no QEMU running and reported it.

Not verified: no live boot yet, so the gate has never run its three probes
end to end. That is the next step and it is what establishes the green baseline
at this HEAD before any Phase A change.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-03 03:08:39 +03:00

5.6 KiB

visual-gate

A performance commit does not land until this passes on a live boot of the pathway it touches, and the commit body says which pathway and quotes the verdict line.

scripts/visual-gate/visual-gate.sh                    # full, for phase sign-off
scripts/visual-gate/visual-gate.sh --quick            # fewer trials, for iteration
scripts/visual-gate/visual-gate.sh --keep /tmp/vg     # keep every probe's frames
scripts/visual-gate/self-test.sh                      # the parser's own tests, no boot

Exits 0 when every probe passed and every silent-loss counter read zero, 1 on any regression, 2 on a setup failure — a guest that never settled, a probe that could not run, or a QEMU that died under it.

Why it exists

A branch of 59 commits was once reset off wholesale because it had introduced graphical glitches. Every one of the 21 code-changing commits on it had been verified — against clippy, unit tests, the feature matrix, and device-side performance counters. The work was performance work, so the instruments it was checked with were performance instruments, and a rendering regression was invisible by construction. Nothing lied; the right question was never asked.

Three probes existed the whole time that ask exactly that question. None of them gated anything. This is the entry point that makes them gate.

What it runs

Each probe is a two-observation instrument: the guest declares what it believes it drew and where, and the host measures its own capture at exactly those places. That is what separates the guest declined to draw it from this device lost it — the distinction a screenshot cannot make, and the reason staring at images never resolved it.

probe what the guest declares trials, full trials, --quick
web-content-probe a palette and the screen rects that carry it 20 captures 5
wallpaper-probe a 64-bar aperiodic barcode wallpaper the probe itself supplied 10 trials 3
modal-button-probe the accessibility hierarchy's buttons and their rects 10 trials 3

All three run even when an earlier one fails. Which probe fails is the diagnostic, and a gate that stops at the first one throws that away.

Read each probe's own README before quoting its result. In particular modal-button-probe summons the log-out modal, not the Control-Power one a bug report may name, and web-content-probe has twice produced a worthless result — once from a stressor clipped away by contain: strict, once from a macOS sheet dimming every region to exactly half.

The counter budget

Probes see what they drive. The other half of a silent loss is the device saying so in the fail log and nobody reading it, so the gate marks the log by byte offset before the first probe and applies six classes over its own window only — never the accumulated log, which spans builds.

counter meaning
deferred_flush_lost a guest render this device dropped. Always a real loss
gw_audit_unsound the gather witness refuted itself; a stale image is being served
render_flush_over_guest_write documented as expected-never; if it fires the writeback ordering repair has broken
mapping_page_drift the page list changed under an armed window
THRASH present_action_starvation zero across the whole accumulated log to date; a first occurrence is a real change
tdc_overflow census target map overflowed and re-seeded — only meaningful when the census probe is on

Any non-zero reading is a gate failure, not a note. Two of these are standing alarms that currently read zero; a zero is the working state, so do not delete them for being constant.

counter-budget.sh does the parsing and self-test.sh tests it against synthetic log text with no guest, no QEMU and no GPU. That split is deliberate: a parser that matches nothing prints the same six zeros a clean run does, so without those cases a green gate would mean nothing and there would be no way to tell from its output. The cases are mutation-checked — dropping the ^ anchor on the line families, or matching route fields by prefix instead of exactly, each fails exactly one case.

What it refuses to do

It will not start on an unsettled guest. sshd answers well before the desktop composites, and a probe started in that window measures the guest's own startup work. One such run read 12.2 fps with the device idle at duty=0.001. The gate polls ssh macos-vm uptime for a 1-minute load average under SETTLE_LOAD (1.0) for up to SETTLE_TIMEOUT (420 s) and exits 2 rather than guess. It also aborts if QEMU stops matching, so a boot that died early is never mistaken for a clean run.

Two things this is not

Not a frame-rate check. Frame rate is bimodal here — ~59 and ~118 with nothing between, both on one unchanged binary within one boot — so a rAF figure cannot support a claim in either direction. This gate answers correct or not. The device-side counters answer fast or not.

Not proof of absence. The probes bound the classes they drive. A green gate means "no regression this instrument can see", and a green --quick is not a phase sign-off. For a change whose failure mode needs a second frame to appear — a stale tile the next frame declines to rewrite, say — run the full gate twice on one boot.

If a change cannot be gated because it only manifests under a workload no probe drives, say so explicitly in the commit body under "Not verified". An honest admission is what the reset branch's suspect commit already did; the failure was that nobody treated the admission as blocking.