From 233ed7260286ac9c58e2500d7ec547074adf20ef Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:00:44 +0200 Subject: [PATCH 01/16] fix(wininspect): discover verified PortableApps nested executable layout --- api/core/wininspect.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/api/core/wininspect.py b/api/core/wininspect.py index 0bc039d9..20ec59c3 100644 --- a/api/core/wininspect.py +++ b/api/core/wininspect.py @@ -83,11 +83,23 @@ def timeout_seconds() -> float: return max(0.1, min(value, 30.0)) +WININSPECT_DEFAULT_DIR = "/opt/winebot/windows-tools/WinSpy" +WININSPECT_REQUIRED_FILES = ("wininspectd.exe", "wininspect.exe") + + def tool_dir() -> Path: - return Path( - os.getenv("WINEBOT_WININSPECT_DIR", "/opt/winebot/windows-tools/WinSpy").strip() - or "/opt/winebot/windows-tools/WinSpy" - ) + """Locate a complete WinInspect installation without mixing layouts. + + WinInspect Portable v0.4.4 stages its binaries under App/WinInspect, + whereas older installations use a flat directory. An explicit + WINEBOT_WININSPECT_DIR may point to either layout. Fail closed if neither + contains both required executables; never scan other installed programs. + """ + root = Path(os.getenv("WINEBOT_WININSPECT_DIR", "").strip() or WININSPECT_DEFAULT_DIR) + for candidate in (root, root / "App" / "WinInspect"): + if all((candidate / name).is_file() for name in WININSPECT_REQUIRED_FILES): + return candidate + return root def daemon_exe() -> Path: From 64b4aab455afa00274d3097248f321e53e7fa9f6 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:01:09 +0200 Subject: [PATCH 02/16] test(wininspect): cover nested/legacy layouts and fail-closed incomplete installs --- tests/test_wininspect_portable_layout.py | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/test_wininspect_portable_layout.py diff --git a/tests/test_wininspect_portable_layout.py b/tests/test_wininspect_portable_layout.py new file mode 100644 index 00000000..6322028e --- /dev/null +++ b/tests/test_wininspect_portable_layout.py @@ -0,0 +1,74 @@ +"""WinInspect PortableApps/legacy executable discovery, synthetic only.""" + +from pathlib import Path + +from api.core import wininspect + + +def _binaries(directory: Path, *filenames: str) -> None: + directory.mkdir(parents=True, exist_ok=True) + for name in filenames: + (directory / name).write_bytes(b"synthetic executable placeholder") + + +def test_portable_v044_nested_layout(monkeypatch, tmp_path): + root = tmp_path / "WinSpy" + nested = root / "App" / "WinInspect" + _binaries(nested, "wininspectd.exe", "wininspect.exe", "wininspect-gui.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.tool_dir() == nested + assert wininspect.daemon_exe() == nested / "wininspectd.exe" + assert wininspect.cli_exe() == nested / "wininspect.exe" + assert wininspect.gui_exe() == nested / "wininspect-gui.exe" + assert wininspect.installed() is True + + +def test_flat_legacy_layout_has_priority(monkeypatch, tmp_path): + root = tmp_path / "WinSpy" + _binaries(root, "wininspectd.exe", "wininspect.exe") + _binaries(root / "App" / "WinInspect", "wininspectd.exe", "wininspect.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.tool_dir() == root + assert wininspect.installed() is True + + +def test_explicit_nested_directory(monkeypatch, tmp_path): + nested = tmp_path / "Portable" / "App" / "WinInspect" + _binaries(nested, "wininspectd.exe", "wininspect.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(nested)) + assert wininspect.tool_dir() == nested + assert wininspect.installed() is True + + +def test_incomplete_install_cannot_mix_executables(monkeypatch, tmp_path): + root = tmp_path / "WinSpy" + _binaries(root, "wininspectd.exe") + _binaries(root / "App" / "WinInspect", "wininspect.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.tool_dir() == root + assert wininspect.installed() is False + + +def test_unrelated_neighbor_directory_not_scanned(monkeypatch, tmp_path): + root = tmp_path / "WinSpy" + _binaries(tmp_path / "OtherTool", "wininspectd.exe", "wininspect.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.tool_dir() == root + assert wininspect.installed() is False + + +def test_missing_custom_root_does_not_fallback_to_default(monkeypatch, tmp_path): + root = tmp_path / "custom-missing" + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.tool_dir() == root + assert wininspect.installed() is False + + +def test_nested_without_optional_gui_still_installed(monkeypatch, tmp_path): + root = tmp_path / "WinSpy" + nested = root / "App" / "WinInspect" + _binaries(nested, "wininspectd.exe", "wininspect.exe") + monkeypatch.setenv("WINEBOT_WININSPECT_DIR", str(root)) + assert wininspect.installed() is True + assert wininspect.gui_exe() == nested / "wininspect-gui.exe" + assert wininspect.gui_exe().is_file() is False From 9a32b4063772c03a21c561021751834a1bb78599 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:01:23 +0200 Subject: [PATCH 03/16] test(ci): include WinInspect executable-layout regression suite in normal unit lane --- scripts/ci/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index 572871e1..a106e1cf 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -22,4 +22,5 @@ pytest \ tests/test_diag_bundle.py \ tests/test_auto_view.py \ tests/test_ui_dashboard.py \ - tests/test_ui_accessibility.py + tests/test_ui_accessibility.py \ + tests/test_wininspect_portable_layout.py From d7e5608c4b6f3f59dcb6a10632e9f25c0197fd3f Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:02:25 +0200 Subject: [PATCH 04/16] docs(rdte): durable staged WineBot Windows UX/CV/game execution and gates --- ...ne-ui-three-audience-execution-20261023.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/rdte-wine-ui-three-audience-execution-20261023.md diff --git a/docs/rdte-wine-ui-three-audience-execution-20261023.md b/docs/rdte-wine-ui-three-audience-execution-20261023.md new file mode 100644 index 00000000..71a0aa6a --- /dev/null +++ b/docs/rdte-wine-ui-three-audience-execution-20261023.md @@ -0,0 +1,54 @@ +# WineBot Windows application qualification work plan — 2026-10-23 + +**Execution authority:** WineBot project draft PRs, security `SemperSupra/agent-dispatch-private#515` and project/portfolio handoff `SemperSupra/agent-dispatch-private#107`. This is a staged DLE (**Durable, Legible, Executable**) plan, not authorization to merge, publish, or bypass controls. + +## Observed baseline + +- Real WineBot `intent-rel` in disposable Linux CI under Xvfb/Wine: Notepad, Wine File Manager, Wine Configuration, Registry Editor all **launched with visible X11 windows and window-only screenshots** in the synthetic 96/144 DPI trials. RDTE #131: [run 39994111643](https://github.com/SemperSupra/WineBot/actions/runs/39994111643), [run 39995188180](https://github.com/SemperSupra/WineBot/actions/runs/39995188180). +- 144 DPI grayscale materially improves classic-menu/dialog legibility but may clip content in fixed-size file-manager/registry windows. At 144 DPI ClearType did not produce an observed static-font improvement under Xvfb; grayscale is the validated deterministic screenshot baseline. +- Authenticated `GET /windows` succeeds during Notepad; `GET /wininspect/capabilities` and `GET /wininspect/windows` were unavailable. Container diagnostic: WinInspect enabled but expected **flat-root** `wininspectd.exe` and `wininspect.exe` missing. Release `v0.4.4` build script stages binaries under **`App/WinInspect/`**; WineBot unzips its verified package under `/opt/winebot/windows-tools/WinSpy`. Last runtime evidence: [run 39997099944](https://github.com/SemperSupra/WineBot/actions/runs/39997099944). +- Production main still pins missing WinInspect `v0.4.0`; distinct draft **#124** fixes the verified package download to `v0.4.4`. Draft **#125** suppresses automatic BuildKit uploads, **#127** minimizes public conformance reports/console payloads, **#129** distinguishes source from tested checkout. All remain separate and gated. Legacy v1 conformance **54 pass / 8 fail / 9 skip** remains red under **#123** contract-policy review. + +## Dependency-aware execution + +### READY A — exact executable path and semantic startup, independent of graphics research + +1. Preserve flat-install compatibility, discover the **complete** nested `App/WinInspect` directory when both daemon and CLI are present; honor explicit env path and fail closed for incomplete or unrelated tool directories. +2. Add positive/negative synthetic path tests and include them in normal unit lane (prior `test_wininspect.py` is not run by the default unit script and has stale protocol assertions; fix those independently). +3. Qualify with a **disposable public** WineBot release-intent image using the previously verified, unmerged safe image/build composition from closed #130. Do not merge security drafts just to test. +4. Launch synthetic Notepad, probe `/windows`, `/health/wininspect`, `/wininspect/capabilities`, and `/wininspect/windows` via read-only authenticated API calls, record **booleans + count classes + allowlisted component versions only**. Never upload full WinInspect responses, screenshot root or runtime process/host paths. +5. Distinguish installation, daemon readiness, transport, protocol negotiation and semantic window results. A successful build is not a semantic acceptance. Record first failure and next minimal correction; maintain draft until reviewed. + +### READY B — independent CPU software 3D / gaming + +- [Draft renderer PR #132](https://github.com/SemperSupra/WineBot/pull/132): qualification of CPU LLVMpipe GLX and Lavapipe Vulkan, SwiftShader only when a pinned ICD is explicitly admitted. Do not promote generic GPU acceleration, CV-training quality or Direct3D parity from renderer smoke. +- [Draft game PR #133](https://github.com/SemperSupra/WineBot/pull/133): bounded Windows OpenTTD 15.3/OpenGFX 8.0 executable launch. Require actual visible window; input, FPS, save/readback, screenshot correctness and sustained game performance are subsequent gates. +- Keep both branches independently qualified, record exact run/source/pinned input checksums, avoid duplicate runners/parallel execution on the same authority branch. + +### READY C — visual and audience UX specification + +- **Human:** readable `144 DPI` default candidate with DPI-aware window placement/minimum client sizes, clearly described active app/focus and observer/control holder, responsive dashboard, visible safety controls and no untrusted state optimism. +- **Assistive technology:** keyboard focus/labels and real Wine/WinInspect semantic tree to assistive clients. Do not equate successful X11 screenshot with assistive technology acceptance. +- **Automation:** pinned profile (`DPI`, resolution, smoothing, window geometry), typed application lifecycle and stable operation receipts with deterministic output hash. +- **Agents:** observe (WinInspect/Win32 and X11) → bounded plan → broker-authorized action → independent readback → durable receipt. Distinguish Linux X11 ID vs Windows HWND and note provider capability limitations. Preserve revoked/denied actions as such. +- Add *orthogonal* visual profile selector in a separately reviewed PR after experiments; don't silently mutate use-case/performance profiles. + +### WAITING D — brokered transactional WinBot app UX + +After WinInspect observation and actor/lease admission: Notepad **broker-mediated** launch, locate editor, input synthetic data, save, content readback and crop/hash verification; then File Manager navigation and Paint-like canvas case. Confirm correct lease epoch/generation, idempotency key, human handback/STOP_NOW, and independent input outcome. No direct Wine shell/xdotool or raw Python mutation may count as this gate. + +### WAITING E — CV / held-out capture training + +Private `desktop-ui-cv` draft #44's schema/validator qualifies synthetic manifests locally. Requires independent candidate inventory digest, dated pre-capture checkpoint witness, private image/data custody, explicit human review and qualified target model before actual capture/model fine-tuning. No private GitHub Actions minutes or model/cloud data spill by default. + +### WAITING F — production/release + +Independent security #515 review/approval of #125/#127/#129, packaging #124, #123 v1/vNext conformance semantics; changes must be requalified after merge ordering. Keep all experimental PRs draft/unmerged and preserve first failures, worktrees and immutable receipts. Do not prune branches or archive until source history/worktree/consumer gates are satisfied. + +## Version and proof fields required on every new app qualification run + +`source_sha`, `tested_checkout_sha`, image digest if available, image base tag, actual `wine --version`, package versions for Xvfb/Openbox/Mesa/GLX/Vulkan when probed, WinInspect release and API protocol outcome, `WINE_DPI`, smoothing, `DISPLAY` class (not host address), screenshot digest/size if publication admitted, app name+free-license provenance and exact read-only/interaction outcome. + +Public logs/artifacts may include **only software/version and safe abstract status fields**. Do not disclose hostname, hardware, CPU/GPU model, device configuration, username, IP, local paths or actual runtime window titles. Hold raw evidence job-local/private as appropriate. + +**Next baton:** execute A with exact-head local unit tests and combined public CI runtime probe; in parallel reconcile B terminal workflows and record first failures. Leave D/E/F blocked until their independently owned gates pass. From 22fd577c015d83037189b5dbed7c168c7bf101f3 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:21:00 +0200 Subject: [PATCH 05/16] fix(wininspect): force loopback-only daemon and read-only startup --- api/core/wininspect.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/core/wininspect.py b/api/core/wininspect.py index 20ec59c3..34c529a5 100644 --- a/api/core/wininspect.py +++ b/api/core/wininspect.py @@ -184,7 +184,16 @@ def ensure_daemon(start: bool = True) -> dict[str, Any]: log_file = open(_log_path(), "ab") try: proc = subprocess.Popen( - ["wine", str(daemon_exe())], + [ + "wine", str(daemon_exe()), + "--no-config", + "--bind", DEFAULT_HOST, + "--ipv4", + "--port", str(port()), + "--no-discovery", + "--headless", + "--read-only", + ], stdout=log_file, stderr=subprocess.STDOUT, start_new_session=True, From 0f808239f04ef1cb8e0d176dcc788ad25440515e Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:21:36 +0200 Subject: [PATCH 06/16] test(wininspect): prevent nonlocal listening and unauthorized mutation at daemon start --- tests/test_wininspect_loopback.py | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/test_wininspect_loopback.py diff --git a/tests/test_wininspect_loopback.py b/tests/test_wininspect_loopback.py new file mode 100644 index 00000000..bbca690a --- /dev/null +++ b/tests/test_wininspect_loopback.py @@ -0,0 +1,56 @@ +"""WinInspect daemon must be local-only and non-mutating until broker-qualified.""" + +from unittest.mock import MagicMock, patch + +from api.core import wininspect as wi + + +def test_daemon_spawn_is_explicit_loopback_and_read_only(tmp_path): + proc = MagicMock() + proc.pid = 1234 + proc.poll.return_value = None + with ( + patch.object(wi, "enabled", return_value=True), + patch.object(wi, "installed", return_value=True), + patch.object(wi, "_tcp_ready", side_effect=[False, False, True]), + patch.object(wi, "_log_path", return_value=str(tmp_path / "local-daemon.log")), + patch.object(wi, "manage_process"), + patch.object(wi.subprocess, "Popen", return_value=proc) as spawn, + ): + result = wi.ensure_daemon(start=True) + assert result["running"] is True + assert result["started"] is True + args = spawn.call_args.args[0] + assert args[:2] == ["wine", str(wi.daemon_exe())] + for flag in ("--no-config", "--ipv4", "--no-discovery", "--headless", "--read-only"): + assert flag in args + assert args[args.index("--bind") + 1] == "127.0.0.1" + assert args[args.index("--port") + 1] == str(wi.port()) + assert "0.0.0.0" not in args + assert "::" not in args + assert spawn.call_args.kwargs["start_new_session"] is True + + +def test_not_installed_never_attempts_process_spawn(): + with ( + patch.object(wi, "enabled", return_value=True), + patch.object(wi, "installed", return_value=False), + patch.object(wi.subprocess, "Popen") as spawn, + ): + result = wi.ensure_daemon(start=True) + assert result["installed"] is False + assert result["running"] is False + spawn.assert_not_called() + + +def test_read_only_state_probe_never_spawns_daemon(): + with ( + patch.object(wi, "enabled", return_value=True), + patch.object(wi, "installed", return_value=True), + patch.object(wi, "_tcp_ready", return_value=False), + patch.object(wi, "_process_running", return_value=False), + patch.object(wi.subprocess, "Popen") as spawn, + ): + result = wi.ensure_daemon(start=False) + assert result["running"] is False + spawn.assert_not_called() From 8e86ad281790054426d88f2f7e262d5700aef196 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:22:00 +0200 Subject: [PATCH 07/16] test(ci): run WinInspect loopback startup regression in standard test lane --- scripts/ci/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index a106e1cf..66f0a8e6 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -23,4 +23,5 @@ pytest \ tests/test_auto_view.py \ tests/test_ui_dashboard.py \ tests/test_ui_accessibility.py \ - tests/test_wininspect_portable_layout.py + tests/test_wininspect_portable_layout.py \ + tests/test_wininspect_loopback.py From 83f2b34d9e263b486346dbba84580fde44299822 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:22:25 +0200 Subject: [PATCH 08/16] fix(wininspect): disable mDNS as well as UDP discovery for local daemon --- api/core/wininspect.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/core/wininspect.py b/api/core/wininspect.py index 34c529a5..5e661026 100644 --- a/api/core/wininspect.py +++ b/api/core/wininspect.py @@ -191,6 +191,7 @@ def ensure_daemon(start: bool = True) -> dict[str, Any]: "--ipv4", "--port", str(port()), "--no-discovery", + "--no-mdns", "--headless", "--read-only", ], From b3e9cc7ef5c0c4b79a94d5dd64586c20c8ff19d2 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:22:31 +0200 Subject: [PATCH 09/16] test(wininspect): assert both discovery channels disabled --- tests/test_wininspect_loopback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_wininspect_loopback.py b/tests/test_wininspect_loopback.py index bbca690a..3774be5d 100644 --- a/tests/test_wininspect_loopback.py +++ b/tests/test_wininspect_loopback.py @@ -22,7 +22,7 @@ def test_daemon_spawn_is_explicit_loopback_and_read_only(tmp_path): assert result["started"] is True args = spawn.call_args.args[0] assert args[:2] == ["wine", str(wi.daemon_exe())] - for flag in ("--no-config", "--ipv4", "--no-discovery", "--headless", "--read-only"): + for flag in ("--no-config", "--ipv4", "--no-discovery", "--no-mdns", "--headless", "--read-only"): assert flag in args assert args[args.index("--bind") + 1] == "127.0.0.1" assert args[args.index("--port") + 1] == str(wi.port()) From 9f73cf504b225aa354c9f0405463fb7f04a77b51 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:32:25 +0200 Subject: [PATCH 10/16] fix(wininspect): use upstream v0.3.0 RPC wire protocol for v0.4.4 release --- api/core/wininspect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/core/wininspect.py b/api/core/wininspect.py index 5e661026..be928edc 100644 --- a/api/core/wininspect.py +++ b/api/core/wininspect.py @@ -15,6 +15,8 @@ DEFAULT_HOST = "127.0.0.1" DEFAULT_PORT = 1985 DEFAULT_TIMEOUT_SECONDS = 3.0 +# WinInspect v0.4.4 release uses the v0.3.0 wire protocol (types.hpp). +WININSPECT_PROTOCOL_VERSION = "0.3.0" MAX_MESSAGE_SIZE = 10 * 1024 * 1024 READ_ONLY_METHODS = { "daemon.health", @@ -298,8 +300,8 @@ def request(method: str, params: dict[str, Any] | None = None) -> dict[str, Any] "id": request_id, "method": method, "params": { - "protocol_version": "0.4.0", **(params or {}), + "protocol_version": WININSPECT_PROTOCOL_VERSION, }, } with socket.create_connection((host(), port()), timeout=timeout_seconds()) as sock: From b23e4dda347069674c87d8bffb398937b349d3cd Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:32:42 +0200 Subject: [PATCH 11/16] test(wininspect): require v0.3.0 RPC and prevent version override --- tests/test_wininspect_rpc_version.py | 81 ++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 tests/test_wininspect_rpc_version.py diff --git a/tests/test_wininspect_rpc_version.py b/tests/test_wininspect_rpc_version.py new file mode 100644 index 00000000..16079103 --- /dev/null +++ b/tests/test_wininspect_rpc_version.py @@ -0,0 +1,81 @@ +"""Pinned WinInspect v0.4.4 RPC protocol compatibility, synthetic-only.""" + +import json +import struct +from unittest.mock import patch + +import pytest + +from api.core import wininspect + + +class FakeSocket: + def __init__(self, responses): + self.recv_bytes = bytearray() + self.sent = bytearray() + for response in responses: + raw = json.dumps(response).encode("utf-8") + self.recv_bytes.extend(struct.pack("!I", len(raw)) + raw) + + def recv(self, length): + chunk = self.recv_bytes[:length] + del self.recv_bytes[:length] + return bytes(chunk) + + def sendall(self, data): + self.sent.extend(data) + + def settimeout(self, _timeout): + pass + + def __enter__(self): + return self + + def __exit__(self, *_args): + return False + + +def _invoke(response, params=None): + sock = FakeSocket([{"type": "hello", "version": "0.3.0"}, response]) + with ( + patch.object(wininspect, "ensure_daemon", return_value={"running": True}), + patch.object(wininspect.uuid, "uuid4") as uid, + patch.object(wininspect.socket, "create_connection", return_value=sock), + ): + uid.return_value.hex = "abc123456789abcdef" + if response["ok"]: + outcome = wininspect.request("daemon.capabilities", params) + else: + with pytest.raises(wininspect.WinInspectError, match="expected 0.3.0"): + wininspect.request("daemon.capabilities", params) + outcome = None + length = struct.unpack("!I", sock.sent[:4])[0] + return outcome, json.loads(sock.sent[4:4 + length]) + + +def test_release_v044_uses_rpc_v030_in_params(): + result, wire = _invoke({ + "id": "winebot-abc123456789", "ok": True, + "result": {"features": {"ui": True}}, + }) + assert wininspect.WININSPECT_PROTOCOL_VERSION == "0.3.0" + assert wire["params"]["protocol_version"] == "0.3.0" + assert "protocol_version" not in {k: v for k, v in wire.items() if k != "params"} + assert result["result"]["features"]["ui"] is True + + +def test_rpc_version_cannot_be_overridden_by_caller_params(): + _, wire = _invoke({ + "id": "winebot-abc123456789", "ok": True, + "result": {}, + }, {"protocol_version": "0.4.0", "title_regex": "synthetic"}) + assert wire["params"]["protocol_version"] == "0.3.0" + assert wire["params"]["title_regex"] == "synthetic" + + +def test_server_version_error_fails_closed(): + _, wire = _invoke({ + "id": "winebot-abc123456789", "ok": False, + "error": {"code": "E_PROTOCOL_VERSION", "message": "expected 0.3.0, got 0.4.0"}, + }) + assert wire["params"]["protocol_version"] == "0.3.0" From 4cd84793bfa64efd3e157de0ef3325fcb4c4cb8e Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:32:53 +0200 Subject: [PATCH 12/16] test(ci): enforce WinInspect wire-version tests in standard unit lane --- scripts/ci/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index 66f0a8e6..d2f81dde 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -24,4 +24,5 @@ pytest \ tests/test_ui_dashboard.py \ tests/test_ui_accessibility.py \ tests/test_wininspect_portable_layout.py \ - tests/test_wininspect_loopback.py + tests/test_wininspect_loopback.py \ + tests/test_wininspect_rpc_version.py From 8376f163b4e0972ceabbb6142c50bc67f297cec7 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:48:28 +0200 Subject: [PATCH 13/16] security(wininspect): redact upstream hello identity from RPC correlation errors --- api/core/wininspect.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/core/wininspect.py b/api/core/wininspect.py index be928edc..b7a37c06 100644 --- a/api/core/wininspect.py +++ b/api/core/wininspect.py @@ -311,9 +311,9 @@ def request(method: str, params: dict[str, Any] | None = None) -> dict[str, Any] response = _read_frame(sock) if response.get("id") != request_id: - raise WinInspectError( - f"unexpected WinInspect response id: {response.get('id')!r}; hello={hello!r}" - ) + # WinInspect's hello may carry host identity/hostname/UUID. Never copy + # that untrusted payload into API-visible errors or public CI logs. + raise WinInspectError("WinInspect response correlation failed") if not response.get("ok"): error = response.get("error") or {} raise WinInspectError(str(error.get("message") or error or "WinInspect request failed")) From bfd431cdb648dc3f99353d571469ea15fdfb2e3f Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:48:42 +0200 Subject: [PATCH 14/16] test(security): fail closed without echoing WinInspect daemon identity on mismatch --- tests/test_wininspect_error_redaction.py | 59 ++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/test_wininspect_error_redaction.py diff --git a/tests/test_wininspect_error_redaction.py b/tests/test_wininspect_error_redaction.py new file mode 100644 index 00000000..76649b55 --- /dev/null +++ b/tests/test_wininspect_error_redaction.py @@ -0,0 +1,59 @@ +"""WinInspect correlation diagnostics must not disclose daemon hello identity.""" + +import json +import struct +from unittest.mock import patch + +import pytest + +from api.core import wininspect as wi + + +class Socket: + def __init__(self, response): + hello = { + "type": "hello", "version": "0.3.0", + "hostname": "SYNTHETIC_HOST_NEVER_ECHO", + "name": "SYNTHETIC_PERSON_NEVER_ECHO", + "uuid": "SYNTHETIC_UUID_NEVER_ECHO", + } + self.incoming = bytearray() + for item in (hello, response): + raw = json.dumps(item).encode() + self.incoming.extend(struct.pack("!I", len(raw)) + raw) + + def recv(self, size): + value = bytes(self.incoming[:size]) + del self.incoming[:size] + return value + + def settimeout(self, timeout): + pass + + def sendall(self, value): + pass + + def __enter__(self): + return self + + def __exit__(self, *args): + return False + + +@pytest.mark.parametrize("bad_reply", [ + {"ok": True, "result": {"capabilities": {}}, "id": ""}, + {"ok": True, "result": {}, "id": "different-request"}, + {"ok": False, "error": {"message": "should not bypass ID check"}}, +]) +def test_mismatched_correlation_refuses_without_hello_disclosure(bad_reply): + sock = Socket(bad_reply) + with ( + patch.object(wi, "ensure_daemon", return_value={"running": True}), + patch.object(wi.socket, "create_connection", return_value=sock), + ): + with pytest.raises(wi.WinInspectError) as error: + wi.request("daemon.capabilities") + assert str(error.value) == "WinInspect response correlation failed" + for token in ("SYNTHETIC_HOST", "SYNTHETIC_PERSON", "SYNTHETIC_UUID", + "different-request"): + assert token not in str(error.value) From efb69db7b348b727e4a97093109cc02c6b41d245 Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:48:54 +0200 Subject: [PATCH 15/16] test(ci): include WinInspect RPC error identity-minimization regression --- scripts/ci/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test.sh b/scripts/ci/test.sh index d2f81dde..554a9edf 100755 --- a/scripts/ci/test.sh +++ b/scripts/ci/test.sh @@ -25,4 +25,5 @@ pytest \ tests/test_ui_accessibility.py \ tests/test_wininspect_portable_layout.py \ tests/test_wininspect_loopback.py \ - tests/test_wininspect_rpc_version.py + tests/test_wininspect_rpc_version.py \ + tests/test_wininspect_error_redaction.py From 832d8399fb8d5eeb0e64bb1916dca494e8d6635f Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:08:48 +0100 Subject: [PATCH 16/16] ci(wininspect): install exact pinned runtime deps for RPC safety regression --- .github/workflows/wininspect-error-redaction.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wininspect-error-redaction.yml b/.github/workflows/wininspect-error-redaction.yml index 1cf927fa..394178c3 100644 --- a/.github/workflows/wininspect-error-redaction.yml +++ b/.github/workflows/wininspect-error-redaction.yml @@ -17,7 +17,7 @@ jobs: with: persist-credentials: false - name: Install pinned public-only test runner - run: python3 -m pip install --disable-pip-version-check pytest==8.4.2 + run: python3 -m pip install --disable-pip-version-check -r requirements/requirements-rel.txt pytest==8.4.2 - name: Execute synthetic strict-correlation negative tests run: | set -euo pipefail