Component: `scripts/screenshot-when-kde-plasma-host/`. Host-side harness only;
no device change.
The guard exists so a black capture is never read as evidence that the guest
rendered black. It could not fire, and the cost was immediate: a whole driven
boot of a solidly black window was captured seven times, measured "max=255
mean=63.7673 colors=30" each time, passed as good frames, and used to judge a
six-application rail sweep that reported `ok` for every leg.
Two independent faults, and fixing either alone still passes a black frame.
**It measured alpha.** `%[fx:maxima]` and `%[fx:mean]` are taken over every
enabled channel, and spectacle writes RGBA with fully opaque alpha. On a black
frame that is max=255 and mean=63.75 — which is 255/4, three zeroes and an
opaque alpha, and the give-away that it was never looking at the picture.
`-alpha off` makes both numbers describe what is on screen; the same capture
then reads max=22, mean=0.024.
**max is the wrong statistic even with alpha off.** A black *window* capture is
not uniformly black: the corners are rounded and anti-aliased against the
desktop behind them, so max=22 is still over the max<=8 threshold and would have
passed a second time. Its 717 non-black pixels out of 920 320 are all corner
artifacts.
So there is now a second arm on `mean`, threshold 0.5. The margin is wide in
both directions: the black capture is 0.024, twenty times below; a composited
desktop measures 94-99, two hundred times above; and the darkest frame worth
keeping — a macOS boot screen, black but for the Apple logo — is around 1.0 by
that logo's area and brightness alone. The two arms report separately, because
"nothing bright anywhere" and "black but for a handful of edge pixels" are
different failures and the message should say which.
The die message now also names the device as a possible cause. It listed only
capture-path explanations, and this week the cause was the device: guest RAM was
being gathered as garbage through a truncated host-pointer import.
Verified against three real captures: the archived black boot (max=22
mean=0.0244) is refused by the new arm; a live composited Ventura desktop
(max=255 mean=98.9) passes end to end through the real script; `bash -n` clean.
Not verified: no synthetic frame near the 0.5 boundary was constructed, so the
threshold's headroom is argued from the three measurements above rather than
bisected.
Co-Authored-By: Claude <noreply@anthropic.com>