diff --git a/tools/minimal_cli_smoke.py b/tools/minimal_cli_smoke.py index 27661f48..b48e531b 100644 --- a/tools/minimal_cli_smoke.py +++ b/tools/minimal_cli_smoke.py @@ -81,11 +81,15 @@ def smoke() -> dict: with tempfile.TemporaryDirectory(prefix="strata-minimal-cli-") as directory: missing = str(Path(directory) / "missing-config.json") - serve = _record(_run(str(ROOT / "strata.py"), "serve", "--profile", missing, - "--offline", "--output", "jsonl"), 5) - if (serve.get("event") != "failed" or serve.get("exit_code") != 5 or - "cannot read run config" not in (serve.get("error") or {}).get("message", "")): - raise RuntimeError("missing run config did not fail before server startup") + # serve needs the API server's packages; without them strata.py stops in its + # preflight (exit 5, a plain message, nothing installed) before reading the config. + serve = _run(str(ROOT / "strata.py"), "serve", "--profile", missing, + "--offline", "--output", "jsonl") + if (serve.returncode != 5 or serve.stdout.strip() or + "missing packages the API server needs" not in serve.stderr or + "never install anything" not in serve.stderr): + raise RuntimeError(f"serve without server packages did not stop in the preflight: " + f"exit {serve.returncode}, stderr {serve.stderr.strip()!r}") code = _record(_run(str(ROOT / "strata.py"), "code", "run", "--prompt-file", str(Path(directory) / "missing-prompt.txt"), "--policy", "review", "--output", "jsonl"), 5) @@ -98,7 +102,7 @@ def smoke() -> dict: "platform": platform.platform(), "python": platform.python_version(), "optional_packages_visible": {"rich": False, "textual": False}, "commands": ["--help", "status --json", "monitor --once --output json", - "serve --offline --output jsonl (missing config)", + "serve --offline --output jsonl (server packages absent: preflight exit 5)", "code run --output jsonl (missing harness)"], "telemetry_gets": len(paths), "non_gets": 0, "actual_engine_started": False, "passed": True} diff --git a/tools/minimal_server_smoke.py b/tools/minimal_server_smoke.py index 81780639..b4bebcd3 100644 --- a/tools/minimal_server_smoke.py +++ b/tools/minimal_server_smoke.py @@ -40,14 +40,16 @@ def smoke() -> dict: result = subprocess.run([sys.executable, "-m", "unittest", TEST_MODULE], cwd=ROOT, capture_output=True, text=True, timeout=240, check=False) summary = result.stdout + result.stderr - count = re.search(r"Ran (\d+) tests in [0-9.]+s\s+OK\s*$", summary) - passed = result.returncode == 0 and count is not None and int(count[1]) >= MIN_TESTS + # Windows-only tests skip on POSIX, so unittest ends "OK (skipped=N)", not a bare "OK". + count = re.search(r"Ran (\d+) tests in [0-9.]+s\s+OK(?: \(skipped=(\d+)\))?\s*$", summary) + executed = int(count[1]) - int(count[2] or 0) if count else 0 + passed = result.returncode == 0 and count is not None and executed >= MIN_TESTS return {"schema_version": 1, "scope": "source_checkout_fake_engine_runtime_only", "platform": platform.platform(), "python": platform.python_version(), "requirements_sha256": hashlib.sha256((ROOT / "requirements.txt").read_bytes()).hexdigest(), "optional_packages_visible": {name: visible[name] for name in ("rich", "textual")}, "server_packages_visible": {name: visible[name] for name in ("numpy", "jinja2", "requests")}, - "test_module": TEST_MODULE, "tests_run": int(count[1]) if count else None, + "test_module": TEST_MODULE, "tests_run": executed if count else None, "duration_s": round(time.monotonic() - started, 2), "test_exit_code": result.returncode, "actual_gpu_engine": False, "passed": bool(passed), "test_summary": summary[-1000:]} diff --git a/tools/portable_monitor_smoke.py b/tools/portable_monitor_smoke.py index 5f6f42ad..fc72bd2e 100644 --- a/tools/portable_monitor_smoke.py +++ b/tools/portable_monitor_smoke.py @@ -117,7 +117,7 @@ def _server() -> tuple[ThreadingHTTPServer, list[str], threading.Event]: "topology": {"mode": "single", "selected_devices": []}, "rates": {"output_tokens_server_counter": 0}, "devices": [], "quality": {"telemetry": "available"}, - }).encode() if not malformed.is_set() else b"[" * 1100 + b"0" + b"]" * 1100 + }).encode() if not malformed.is_set() else b"[" * 100000 + b"0" + b"]" * 100000 self.send_response(200) self.send_header("Content-Type", "application/json") self.send_header("Content-Length", str(len(body)))