✨ 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>
This commit is contained in:
Anees IqbalandClaude committed 2026-08-03 03:08:39 +03:00
1 parent abce32f947
commit 9e3969b0ef
5 files changed
+502

No files matched your search

+26
View File
@@ -745,6 +745,32 @@ one where a rate is available at all. For the other thirteen the occurrence rate
is not measured, and "the counts are stable across boots" is a statement about
distinct instances only.
### A Performance Commit Is Not Verified Until Its Pixels Are
**A performance commit does not land until `scripts/visual-gate/visual-gate.sh`
passes on a live boot of the pathway it touches, and the commit body says which
pathway and quotes the verdict line.**
This is a rule rather than a suggestion because the alternative has already been
paid for. A branch of 59 commits — 21 of them code-changing, +7687/−820 across 38
files, about seven hours — was reset off wholesale because it had introduced
graphical glitches. Every one of those commits was verified: clippy, unit tests,
the feature matrix, 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.
The three probes below already answer that question and had done so for weeks.
None of them gated anything, which is the entire defect. `visual-gate` runs all
three on a settled guest, applies the six silent-loss counters over its own byte
window of the fail log, and exits non-zero on any of it. Its README has the
counter table and the two things it is not.
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". The
suspect commit on that branch did exactly that, honestly, in its own body. The
failure was that nobody treated the admission as blocking.
### A Screenshot Cannot Say Who Dropped The Pixels
Several open goals are reported as screenshots: web content whose background
+107
View File
@@ -0,0 +1,107 @@
# 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.**
```sh
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.
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
# counter-budget.sh — read the six silent-loss classes out of one window of the
# fail log.
#
# Split out of `visual-gate.sh` so it can be tested against synthetic log text
# without a live boot. A parser that silently matches nothing reads exactly like
# a clean run, which is the failure mode this whole gate exists to remove.
#
# scripts/visual-gate/counter-budget.sh WINDOW_LOG
#
# Prints one `name<TAB>count` line per class, in a fixed order. Exits 0 when
# every class read zero, 1 when any did not, 2 when the file cannot be read.
#
# Three classes are line families, keyed on the prefix their emitter writes at
# the start of a line. Three are `note_store_route` counts, which arrive as
# `key=value` fields on a `store_routes` line — that line is emitted once per
# per-second window, so a class has to be summed across every such line in the
# window rather than read off the last one.
set -euo pipefail
export LC_ALL=C
[ $# -eq 1 ] || { echo "counter-budget: usage: counter-budget.sh WINDOW_LOG" >&2; exit 2; }
WINDOW="$1"
[ -r "$WINDOW" ] || { echo "counter-budget: cannot read $WINDOW" >&2; exit 2; }
# `deferred_flush_lost` — a guest render this device dropped. Always a real loss.
# `mapping_page_drift` — the page list changed under an armed window.
# `THRASH present_action_starvation` — one class spelled as two words; zero
# across the whole accumulated log to date, so a first occurrence is a result.
LINE_CLASSES=(
'deferred_flush_lost|deferred_flush_lost '
'mapping_page_drift|mapping_page_drift '
'present_action_starvation|THRASH present_action_starvation '
)
# `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.
# `tdc_overflow` — the census target map overflowed and re-seeded. Only
# meaningful when the census probe is on, and it cannot fire when it is off.
ROUTE_CLASSES=(gw_audit_unsound render_flush_over_guest_write tdc_overflow)
hot=0
for entry in "${LINE_CLASSES[@]}"; do
name=${entry%%|*}
prefix=${entry#*|}
n=$(grep -c -- "^$prefix" "$WINDOW" || true)
printf '%s\t%s\n' "$name" "$n"
[ "$n" -eq 0 ] || hot=1
done
for name in "${ROUTE_CLASSES[@]}"; do
n=$(awk -v key="$name" '
/^store_routes /{
for (i = 2; i <= NF; i++) {
split($i, kv, "=")
if (kv[1] == key) total += kv[2]
}
}
END { print total + 0 }' "$WINDOW")
printf '%s\t%s\n' "$name" "$n"
[ "$n" -eq 0 ] || hot=1
done
exit "$hot"
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env bash
# self-test.sh — does the counter budget actually read the log?
#
# The gate's whole value is that a silent loss stops being silent. A parser that
# matches nothing prints the same six zeros a clean boot does, so "the gate
# passed" would mean nothing and there would be no way to tell from the output.
# These cases fail without the parser and pass with it.
#
# The log text below is quoted from the emitters, not invented:
# `runtime::storage_flush` writes `deferred_flush_lost kind=...`,
# `runtime::mapper` writes `mapping_page_drift mid=...`, `runtime::drain` writes
# `THRASH present_action_starvation reason=...`, and `note_store_route` counts
# arrive as `key=value` fields on the `store_routes` line that same module
# formats once per per-second window.
#
# scripts/visual-gate/self-test.sh
#
# Exits 0 when every case holds, 1 on the first that does not. No guest, no
# QEMU, no GPU.
set -uo pipefail
export LC_ALL=C
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUDGET="$SCRIPT_DIR/counter-budget.sh"
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
fails=0
check() { # check NAME EXPECTED_EXIT EXPECTED_GREP <<< log text
local name="$1" want_rc="$2" want="$3" log="$WORK/case.log"
cat >"$log"
local out rc
out=$("$BUDGET" "$log")
rc=$?
if [ "$rc" != "$want_rc" ]; then
echo "self-test: FAIL $name — exit $rc, wanted $want_rc" >&2
echo "$out" | sed 's/^/self-test: /' >&2
fails=$((fails + 1))
return
fi
if ! echo "$out" | grep -q -- "$want"; then
echo "self-test: FAIL $name — output has no '$want'" >&2
echo "$out" | sed 's/^/self-test: /' >&2
fails=$((fails + 1))
return
fi
echo "self-test: ok $name"
}
# A window with nothing wrong in it is the working state, and it has to be
# distinguishable from a window the parser could not read.
check 'a clean window passes' 0 'deferred_flush_lost 0' <<'EOF'
drain_duty duty=0.001 draws=0 flushes=0
store_routes mapw_fence_flush=288 gvaw_fence_flush=432 gw_vouched=40
window_publish fresh=34 same_key=9
EOF
check 'a dropped render fails' 1 'deferred_flush_lost 1' <<'EOF'
drain_duty duty=0.97 draws=2270 flushes=523
deferred_flush_lost kind=gva reason=no_backend gva=0x7f0000 1920x1080 trigger=fence
EOF
check 'page drift under an armed window fails' 1 'mapping_page_drift 2' <<'EOF'
mapping_page_drift mid=11 task=3 reason=task_inactive pages=2048
mapping_page_drift mid=12 task=3 page=7/2048 gva=0x1000 reason=moved
EOF
check 'present starvation fails' 1 'present_action_starvation 1' <<'EOF'
THRASH present_action_starvation reason=pending_frames_cap ch=0 head=4 tail=9 unpainted=8 episode=1
EOF
# The route classes are the ones a naive parser gets wrong: they are fields on a
# shared line, not lines of their own.
check 'an unsound witness fails' 1 'gw_audit_unsound 3' <<'EOF'
store_routes gw_audit_unsound=3 gw_vouched=40 mapw_fence_flush=288
EOF
check 'route counts sum across windows' 1 'tdc_overflow 5' <<'EOF'
store_routes tdc_overflow=2 tdc_frames=1200
store_routes tdc_overflow=3 tdc_frames=1811
EOF
check 'the writeback ordering repair breaking fails' 1 'render_flush_over_guest_write 1' <<'EOF'
store_routes mapw_fence_flush=288 render_flush_over_guest_write=1
EOF
# A route name that is a prefix of another must not be counted for it, or a
# class could read hot because an unrelated counter shares its opening letters.
check 'a longer field name is not this class' 0 'tdc_overflow 0' <<'EOF'
store_routes tdc_overflow_reseeds=7 tdc_frames=1200
EOF
# The same shape on the line side: `deferred_flush_lost_probe` is not
# `deferred_flush_lost`, and a substring match anywhere in a line is not either.
check 'a line family matches its own prefix only' 0 'deferred_flush_lost 0' <<'EOF'
deferred_flush_lost_probe kind=gva gva=0x1000
readback_split note=deferred_flush_lost was considered
EOF
# Every class is reported on every run, so a reader can tell "this class read
# zero" from "this class is no longer parsed".
n=$("$BUDGET" /dev/null | wc -l)
if [ "$n" = 6 ]; then
echo "self-test: ok all six classes are reported"
else
echo "self-test: FAIL only $n classes reported, wanted 6" >&2
fails=$((fails + 1))
fi
if [ "$fails" = 0 ]; then
echo "self-test: PASS"
exit 0
fi
echo "self-test: FAIL — $fails case(s)" >&2
exit 1
+187
View File
@@ -0,0 +1,187 @@
#!/usr/bin/env bash
# visual-gate.sh — did this build lose any pixels?
#
# 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, so a branch of performance commits was once reset off wholesale
# after the glitches showed up later: every commit had been verified, and the
# question was never asked.
#
# Three probes already answer it, each of them a two-observation instrument —
# the guest declares what it believes it drew, the host measures the frame at
# exactly those places. That is what separates "the guest declined to draw it"
# from "this device lost it", which is the distinction a screenshot cannot make.
# What was missing is that none of them gated anything.
#
# This is the one entry point. It runs all three, applies a counter budget over
# the six silent-loss classes for its own window of the fail log, and exits
# non-zero if any part failed.
#
# scripts/visual-gate/visual-gate.sh [--quick] [--keep DIR] [--host GUEST]
#
# 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.
#
# A green `--quick` is not a phase sign-off. See the README.
set -euo pipefail
export LC_ALL=C
QUICK=0
KEEP=""
GUEST="${GUEST:-macos-vm}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
FAILLOG="${REIMS_VGPU_FAIL_LOG:-/tmp/reims-vgpu-fail.log}"
# A probe on an unsettled guest measures the guest's own startup work. One such
# run read 12.2 fps with the device idle at `duty=0.001` — the desktop was not
# compositing yet. sshd answers well before that, so the port being open is not
# the signal; the 1-minute load average is.
SETTLE_LOAD="${SETTLE_LOAD:-1.0}"
SETTLE_TIMEOUT="${SETTLE_TIMEOUT:-420}"
while [ $# -gt 0 ]; do
case "$1" in
--quick) QUICK=1; shift ;;
--keep) KEEP="$2"; shift 2 ;;
--host) GUEST="$2"; shift 2 ;;
-h|--help) sed -n '2,25p' "${BASH_SOURCE[0]}" | sed 's/^# \?//'; exit 0 ;;
*) echo "visual-gate: unknown argument $1" >&2; exit 2 ;;
esac
done
export GUEST
WORK="${KEEP:-$(mktemp -d)}"
mkdir -p "$WORK"
[ -n "$KEEP" ] || trap 'rm -rf "$WORK"' EXIT
say() { echo "visual-gate: $*"; }
if [ "$QUICK" = 1 ]; then
WEB_N=5; WALL_N=3; MODAL_N=3; MODE=quick
else
WEB_N=20; WALL_N=10; MODAL_N=10; MODE=full
fi
# ---------------------------------------------------------------- settle wait
qemu_alive() { pgrep -f 'qemu-system-x86_6[4]' >/dev/null 2>&1; }
qemu_alive || { say "no QEMU running — boot the pathway first" >&2; exit 2; }
say "waiting for the guest to settle (1-minute load under $SETTLE_LOAD, up to ${SETTLE_TIMEOUT}s)"
settled=0
deadline=$((SECONDS + SETTLE_TIMEOUT))
while [ "$SECONDS" -lt "$deadline" ]; do
qemu_alive || { say "QEMU exited while waiting for the guest" >&2; exit 2; }
# macOS `uptime` ends with "load averages: 1.23 1.45 1.67"; the 1-minute
# figure is the first of the three, which is $(NF-2).
load=$(ssh -o ConnectTimeout=8 -o BatchMode=yes "$GUEST" uptime 2>/dev/null \
| awk '{print $(NF-2)}' | tr -d ',')
if [ -n "$load" ] && awk -v l="$load" -v t="$SETTLE_LOAD" 'BEGIN{exit !(l+0 < t+0)}'; then
say "guest settled at load $load"
settled=1
break
fi
sleep 10
done
[ "$settled" = 1 ] || { say "guest never settled (last load '${load:-unreachable}')" >&2; exit 2; }
# The power state is not a verdict input — the gate answers correct-or-not, and
# frame rate is bimodal here regardless. It is recorded because a log read later
# beside a performance number needs to say which state it was taken in.
if command -v nvidia-smi >/dev/null 2>&1; then
say "host GPU $(nvidia-smi --query-gpu=clocks.sm,clocks.max.sm,utilization.gpu,pstate \
--format=csv,noheader 2>/dev/null | head -1)"
fi
# ------------------------------------------------------------------- probes
# The fail log is bounded by byte offset rather than by timestamp: the device's
# own `t=` clock does not correlate with this shell's, and the accumulated log
# spans builds. Marked before the first probe so the window is exactly the
# frames this gate drove.
OFF=0
[ -f "$FAILLOG" ] && OFF=$(stat -c %s "$FAILLOG")
# Every probe runs even when an earlier one fails: which probe fails is the
# diagnostic. `set -e` is off for exactly these three lines.
run_probe() {
local name="$1" log="$WORK/$name.log"; shift
say "running $name"
set +e
"$@" >"$log" 2>&1
local rc=$?
set -e
# The probes' own verdict is their last non-empty line.
local verdict
verdict=$(grep -v '^[[:space:]]*$' "$log" | tail -1)
printf '%s\t%s\t%s\n' "$name" "$rc" "$verdict" >>"$WORK/verdicts"
say " $name exit=$rc: $verdict"
}
: >"$WORK/verdicts"
# --keep is passed down only when this gate was asked to keep, so a failing run
# leaves every probe's frames and decode records beside its own log.
keep_arg() { [ -n "$KEEP" ] && printf -- '--keep\n%s\n' "$WORK/$1"; }
mapfile -t k < <(keep_arg web-content)
run_probe web-content "$REPO_ROOT/scripts/web-content-probe/web-content-probe.sh" \
-n "$WEB_N" "${k[@]}"
mapfile -t k < <(keep_arg wallpaper)
run_probe wallpaper "$REPO_ROOT/scripts/wallpaper-probe/wallpaper-probe.sh" \
-n "$WALL_N" "${k[@]}"
mapfile -t k < <(keep_arg modal-button)
run_probe modal-button "$REPO_ROOT/scripts/modal-button-probe/modal-button-probe.sh" \
-n "$MODAL_N" --host "$GUEST" "${k[@]}"
qemu_alive || { say "QEMU exited during the probes — no verdict" >&2; exit 2; }
# ------------------------------------------------------------ counter budget
WINDOW="$WORK/window.log"
if [ -f "$FAILLOG" ]; then
tail -c "+$((OFF + 1))" "$FAILLOG" >"$WINDOW"
else
: >"$WINDOW"
fi
# The six silent-loss classes. Any non-zero reading over the gate's own window
# is a gate failure, not a note. Two of them are standing alarms that read zero
# across the whole accumulated log to date — a zero is the working state, and a
# first occurrence is the result.
#
# The parsing lives in its own script so `self-test.sh` can exercise it against
# synthetic log text without a boot: a parser that matches nothing prints the
# same six zeros a clean run does.
set +e
"$SCRIPT_DIR/counter-budget.sh" "$WINDOW" >"$WORK/counters"
budget_rc=$?
set -e
[ "$budget_rc" -le 1 ] || { say "counter budget could not read its window" >&2; exit 2; }
# --------------------------------------------------------------- the verdict
probe_fails=$(awk -F'\t' '$2 == 1' "$WORK/verdicts" | wc -l)
probe_setup=$(awk -F'\t' '$2 != 0 && $2 != 1' "$WORK/verdicts" | wc -l)
hot=$(awk -F'\t' '$2 > 0 {printf "%s=%s ", $1, $2}' "$WORK/counters")
hot=${hot% }
bytes=$(stat -c %s "$WINDOW")
summary="$MODE mode, $(awk -F'\t' '$2 == 0' "$WORK/verdicts" | wc -l)/3 probes green"
summary="$summary, counters over ${bytes} B of fail log: ${hot:-all zero}"
if [ "$probe_setup" -gt 0 ]; then
say "SETUP-FAILED — $summary"
awk -F'\t' '$2 != 0 && $2 != 1 {printf "visual-gate: %s exit=%s: %s\n", $1, $2, $3}' "$WORK/verdicts"
exit 2
fi
if [ "$probe_fails" -gt 0 ] || [ -n "$hot" ]; then
say "FAIL — $summary"
awk -F'\t' '$2 == 1 {printf "visual-gate: %s: %s\n", $1, $3}' "$WORK/verdicts"
exit 1
fi
say "PASS — $summary"
exit 0