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>
modal-button-probe
Asks whether a guest modal's buttons actually reach the screen, and — when they do not — which side dropped them.
Why it exists
The bug it was written for is "the logout window sometimes shows no sleep, shutdown and restart buttons, more likely when dark mode is on". That report is a screenshot observation, and a screenshot on its own cannot say whether the guest declined to draw the buttons or whether this device lost them on the way to the screen. Those are different bugs with different owners, and no amount of staring at the image separates them.
Two independent observations of the same frame do:
- Intent — the guest's accessibility API, asked directly what buttons
loginwindow's window has and at what rectangles. This reads the guest's own view hierarchy, upstream of anything this project touches. - Result — the host-side 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 a guest-side absence and not ours. The probe prints which, per button, per trial.
Usage
scripts/modal-button-probe/modal-button-probe.sh [-n TRIALS] [--appearance dark|light|alternate] [--keep DIR]
Needs a running guest reachable as macos-vm over SSH and a host QEMU window
the KDE screenshot script can capture. --keep DIR retains the PNG and the
accessibility dump of every trial, which is what you want the moment a trial
fails.
Exit codes: 0 every declared button was drawn, 1 at least one trial found a
declared-but-undrawn button, 2 setup failure (no guest, no window, the modal
never appeared).
How the verdict is reached
Each button's rectangle is converted from guest points to capture pixels using the scale read off the capture and the guest's reported display size — neither is assumed, because the capture is downscaled to fit 720p and a guest at another resolution would otherwise shift every rectangle silently.
The rectangle's greyscale standard deviation is then compared against a background reference taken from the same frame: the modal is tiled with patches and the flattest one is used. The dialog is mostly its own fill, so the flattest patch is background — whatever the appearance and whatever the layout, and without naming a corner that some dialog happens to put an icon in. A drawn button has an edge and a label and varies more; a missing one leaves the fill.
There is no tuned threshold. Measured on the guest's logout modal, buttons read
sigma 0.055–0.104 against a background of 0.0008–0.0012 in both dark and light —
45x to 130x separation — so a bare > and any factor up to about 40 decide the
same cases.
What it does not cover
It summons the log-out modal (Log Out / Cancel), because that one can be
raised from a script and dismissed again without acting on it. The dialog named
in the bug report is the Control-Power one (Sleep / Restart / Shut Down /
Cancel), which has no scriptable trigger that does not risk executing the
action. Both are windows of the same loginwindow process and go through the
same compositing path, so this is a proxy for that dialog and not the dialog
itself. Say "the logout modal" when reporting a result from it.
It also cannot see a button that is drawn in the wrong place: it only asks
whether something was drawn where the guest said the button is. A button
rendered 200 px away would read as MISSING at its declared rectangle, which is
the correct verdict for "the user cannot click it" but does not describe what
happened. Keep the frame (--keep) and look.