From a475732587e004bebcd0234ba7b77a14c4ea5001 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 27 Jul 2026 20:05:25 +0200 Subject: [PATCH] test(render): fail the offline pixel gate on stray camera input The offline capture window is minimised but still focusable, so a scroll or key press from whoever is at the keyboard can move the camera mid-capture. That yields two screenshots of the same scene from different camera positions and an enormous, entirely spurious pixel difference - which happened during slice V4b and was correctly discarded rather than interpreted. The gate now detects camera-affecting input in the client log and exits 2, so a perturbed run cannot be mistaken for a rendering regression in either direction. Co-Authored-By: Claude Fable 5 --- tools/run-offline-pixel-gate.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/run-offline-pixel-gate.ps1 b/tools/run-offline-pixel-gate.ps1 index 75e80f1c..0345b982 100644 --- a/tools/run-offline-pixel-gate.ps1 +++ b/tools/run-offline-pixel-gate.ps1 @@ -161,6 +161,22 @@ finally { $captures = Get-ChildItem (Join-Path $Out 'screenshots') -Filter *.png Write-Step "captured $($captures.Count) screenshot(s) into $Out" +# The offline window is minimised but still focusable, so a stray scroll or key +# press from whoever is at the keyboard can move the camera mid-capture. That +# produces two screenshots of the same scene from different camera positions — +# a huge, entirely spurious pixel difference. This actually happened during +# slice V4b. Detect it and fail loudly rather than let a comparison be +# interpreted as a rendering regression. +$cameraInput = Select-String -Path $log -Pattern 'ScrollUp|ScrollDown|ZoomIn|ZoomOut|CameraZoom' ` + -CaseSensitive -ErrorAction SilentlyContinue +if ($cameraInput) { + Write-Host '' + Write-Host '[pixel-gate] ABORTED: camera-affecting input reached the capture window.' -ForegroundColor Red + Write-Host ' The capture is not comparable. Re-run without touching the machine.' -ForegroundColor Red + $cameraInput | Select-Object -First 5 | ForEach-Object { Write-Host " $($_.Line)" -ForegroundColor Red } + exit 2 +} + # --- 4. Compare against the baseline ----------------------------------------- if (-not $Baseline) { Write-Step 'no baseline supplied; capture only'