← Commit history

selftest T10: a foreground of 0 (nothing focused) is INCONCLUSIVE, not a pass — the guard must not bank a vacuous result

John Lauer ·e5fd22bcd6 ·2mo ago ·parent dd8da30
1 file changed +5−2
tools/selftest.sh+5−2
@@ -138,8 +138,11 @@ FG_BEFORE=$(timeout 60 $CLI shell_execute '{"command":"powershell -NoProfile -Co timeout 120 $CLI pup_dashboard '{}' >/dev/null 2>&1 sleep 6 FG_AFTER=$(timeout 60 $CLI shell_execute '{"command":"powershell -NoProfile -Command \"Add-Type -Name FGB -Namespace W -MemberDefinition '"'"'[DllImport(\\\"user32.dll\\\")] public static extern IntPtr GetForegroundWindow();'"'"'; [W.FGB]::GetForegroundWindow()\"","reason":"selftest T10: foreground window after the cold dashboard launch"}' 2>&1 | J "(d.get('stdout') or '').strip()")-if [ -n "$FG_BEFORE" ] && [ "$FG_BEFORE" = "$FG_AFTER" ]; then ok "cold pup_dashboard did NOT steal focus (foreground hwnd $FG_BEFORE unchanged)"-elif [ -z "$FG_BEFORE" ]; then bad "T10 could not read the foreground window — check did not run"+# hwnd 0 means NOTHING was focused, so "unchanged" proves nothing — that is a vacuous pass, the+# same class of lie this harness keeps having to unlearn. Say so instead of banking it.+if [ "$FG_BEFORE" = "0" ] || [ -z "$FG_BEFORE" ]; then+  bad "T10 INCONCLUSIVE: no window held focus before the launch (hwnd '${FG_BEFORE:-empty}'), so a steal could not be detected — raise a window and re-run"+elif [ "$FG_BEFORE" = "$FG_AFTER" ]; then ok "cold pup_dashboard did NOT steal focus (foreground hwnd $FG_BEFORE unchanged)" else bad "FOREGROUND STOLEN by a cold pup_dashboard (#56 regressed): $FG_BEFORE -> $FG_AFTER"; fi timeout 60 $CLI pup_close_window '{"sessionId":"st-fg"}' >/dev/null 2>&1 timeout 60 $CLI pup_close_window '{"sessionId":"pup-dashboard"}' >/dev/null 2>&1