Replace the separate KDE and macOS helpers with one capture-app based path. Capture at native resolution, validate the PNG, and cap output at 720p or optional 1440p while preserving strict window selection and black-frame refusal.
Update probes and documentation to use the unified helper.
Validated with bash syntax checks, Python parsing, diff checks, and a live KDE capture at 3840x2290 downsampled to 1207x720.
Component: scripts/ — the guest-facing probes (wallpaper, modal-button,
window-drag) and the new scripts/lib/guest-display.sh they share.
`system_profiler SPDisplaysDataType | grep Resolution:` was how three probes
learned the desktop's size. On the macos-12 rail that report names the GPU and
**no display at all** — no `Displays:` section, no `Resolution:` line — so all
three exited 2 before doing anything, and `visual-gate --quick` reported
SETUP-FAILED with 0/3 probes green on a rail whose desktop, Dock and menu bar
were up and rendering. The same call has been observed hanging indefinitely on
macos-11, which an unattended harness cannot tell from a wedged boot.
`guest_display_size` asks with `screencapture` plus `sips` instead. Both ship
with every macOS, neither needs root, and the answer is the stronger form of
the question a two-observation probe is asking: not what the guest's
configuration claims the display is, but how many pixels its compositor just
produced. Verified on the macos-12 rail — 1920x1080, where system_profiler
returned nothing — and the wallpaper probe now reaches its trials there.
Second failure on the same rail, same cause class: `osascript -e 'tell
application "System Events" ...'` over ssh hangs forever when the session has
not been granted Automation access, because the consent prompt is raised on the
guest's own desktop and nobody answers it. Every System Events call in every
probe hung there. `guest_osa` bounds them host-side at 15 s (GUEST_OSA_TIMEOUT),
which is the difference between a probe that reports "this rail cannot be
scripted" and one that stalls a sweep. The bound does not kill the remote
osascript; it only stops us waiting on it.
Tests: no Rust change. `bash -n` clean on all four files. Verified live against
the macos-12 rail: the size read returns 1920x1080 where the old one returned
nothing.
Not verified: the macos-11, 14, 15 and 26 rails, and the arm64 pathway. The
Automation-consent gap on macos-12 is a guest provisioning matter and is not
fixed here — the probes now report it quickly instead of hanging on it.
Component: `scripts/modal-button-probe/`. New host-side probe, no crate changes.
Verified against a live x86/PCI guest.
Goal 9 is "the logout window sometimes shows no sleep, shutdown and restart
buttons, more likely when dark mode is on", and no session has been able to act
on it because the report is a screenshot observation. A screenshot cannot say
whether the guest declined to draw the buttons or whether this device lost them
on the way to the screen — different bugs with different owners, and staring at
the image separates them no better on the tenth look than the first. That is a
"Measure Before Fixing" gap, not a missing fix.
The probe takes two independent observations of the same frame:
- **Intent** — the guest's accessibility API, asked directly what buttons
`loginwindow`'s window has and at what rectangles. That reads the guest's own
view hierarchy, upstream of anything this project touches.
- **Result** — the host capture of the QEMU window, measured at exactly those
rectangles.
A button the guest declares and the frame does not show is a compositing loss
here. A button the guest never declares is not ours. The probe says which, per
button, per trial, and exits 1 on any declared-but-undrawn button.
Two things it deliberately does not assume. The point-to-pixel scale is read off
the capture and the guest's reported display size rather than hardcoded, because
the capture is downscaled to fit 720p and a guest at another resolution would
otherwise shift every rectangle silently. And the background reference is the
flattest of 25 patches tiled over the modal, not a named corner and not a fixed
sigma — the dialog is mostly its own fill, so the flattest patch is background
whatever the appearance, which is what lets one rule cover dark and light.
No tuned threshold, and the commit records why one is not needed: measured live,
buttons read sigma 0.055-0.104 against a background of 0.0008-0.0012 in both
appearances — 45x to 130x. Any factor between 2 and 40 decides the same cases, so
naming one would invent precision the data does not have. A bare `>` it is.
Scope stated in the README rather than implied: it summons the **log-out** modal
(`Log Out` / `Cancel`), which can be raised from a script and dismissed without
acting on it. The dialog in the bug report is the Control-Power one, which has no
scriptable trigger that does not risk executing the action. Both are windows of
the same `loginwindow` process through the same compositing path, so this is a
proxy for that dialog and not the dialog itself. It also cannot describe a button
drawn in the *wrong* place — only that nothing was drawn where the guest said the
button is — so `--keep` retains every frame.
Verification: run live at `-n 2` and `-n 20`, alternating appearance. Every
declared button drawn in every trial so far, i.e. no reproduction yet — the probe
is the instrument, not the result.
Also carries one negative result worth not re-deriving. The `present_unbacked
reason=present_backing_never_stored ... gen=0 carried=resident` family (54 lines
on a driven boot) looked like a lost Store, on the strength of a `type4 pages
sid=N` line at the same timestamp. That is dead: type4 is a sampling packet, not
a store, so the temporal correlation is coincidence, and the gate's own
`carried=resident` arm routes these to the census channel rather than the failure
one precisely because a resident carries the pixels. A guest presenting a
freshly-created mapping before drawing into it is expected control flow. Do not
re-open it on this signal.
Not verified: the probe has not yet caught a failing trial, so it has proved
nothing about goal 9 except that the common case is sound. Nothing here touches
the arm64 or Metal pathways.
Co-Authored-By: Claude <noreply@anthropic.com>