From 4be1ed2fdb75f95aeb75b0812e219217242466fb Mon Sep 17 00:00:00 2001 From: "Mark E. DeYoung" <1854350+mark-e-deyoung@users.noreply.github.com> Date: Thu, 26 Nov 2026 04:12:19 +0100 Subject: [PATCH] test(mvp): qualify live human dashboard and agent API before and after real workload recreation --- scripts/ci/qualify-mvp-windows-workloads.sh | 56 +++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/scripts/ci/qualify-mvp-windows-workloads.sh b/scripts/ci/qualify-mvp-windows-workloads.sh index 1a9c721a..37583453 100644 --- a/scripts/ci/qualify-mvp-windows-workloads.sh +++ b/scripts/ci/qualify-mvp-windows-workloads.sh @@ -69,7 +69,62 @@ wait_health() { done return 1 } +# Live HTTP delivery across the actual runtime boundary, without TestClient. +# Fixed local destination, bounded reads, no redirects, no raw output. +verify_live_interfaces() { + python3 - <<'PY' +import json +import os +import urllib.error +import urllib.request + +class NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, *args, **kwargs): + return None + +opener = urllib.request.build_opener( + urllib.request.ProxyHandler({}), NoRedirect() +) +token = os.environ["WINEBOT_API_TOKEN"] +def request(path, authenticated=True): + headers = {"X-API-Key": token} if authenticated else {} + req = urllib.request.Request("http://127.0.0.1:8000" + path, headers=headers) + with opener.open(req, timeout=15) as response: + data = response.read(2 * 1024 * 1024 + 1) + assert len(data) <= 2 * 1024 * 1024 + return data, response.headers + +try: + try: + request("/handshake", False) + except urllib.error.HTTPError as err: + assert err.code == 401 + else: + raise AssertionError("missing authentication refusal") + _, health_headers = request("/health") + raw, headers = request("/handshake") + handshake = json.loads(raw) + version = json.loads(request("/version")[0]) + assert handshake["status"] == "ready" + assert handshake["api_version"] == version["api_version"] + assert handshake["build_version"] == version["version"] + assert handshake["schema_versions"]["artifact"] == version["artifact_schema_version"] + assert handshake["schema_versions"]["event"] == version["event_schema_version"] + assert headers["X-WineBot-API-Version"] == handshake["api_version"] + assert headers["X-Request-ID"] and health_headers["X-Request-ID"] + assert isinstance(handshake["capabilities"], list) and handshake["capabilities"] + html, ui_headers = request("/ui/", False) + assert ui_headers.get_content_type() == "text/html" + assert b"