sk851 Claude Opus 4.7 (1M context) commited on
Commit
af6b61b
·
1 Parent(s): 95c4644

fix(scripts): point package_smoke at /health.json + drop service-name check

Browse files

The CI smoke was hitting ``/health`` and ``json.loads``-ing the response.
After the multi-component status page took over the ``/health`` route
the response is now HTML, so the JSON parse failed every retry until
the timeout fired with the misleading
``Expecting value: line 1 column 1 (char 0)``.

Switch the probe to ``/health.json`` (same data, JSON-shaped) and
update the assertions: status is now an enum across
``{ok, degraded, down}``, the old ``service`` field is gone, and we
verify the expected component keys (agent/telegram/signals) are
present instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/package_smoke.py +13 -5
scripts/package_smoke.py CHANGED
@@ -1,5 +1,3 @@
1
- from __future__ import annotations
2
-
3
  import json
4
  import socket
5
  import subprocess
@@ -30,7 +28,11 @@ def _fetch_json(url: str) -> dict:
30
 
31
 
32
  def _wait_for_server(proc: subprocess.Popen, port: int, timeout_seconds: float = 20.0) -> tuple[dict, str]:
33
- health_url = f"http://127.0.0.1:{port}/health"
 
 
 
 
34
  dashboard_url = f"http://127.0.0.1:{port}/dashboard"
35
  deadline = time.time() + timeout_seconds
36
  last_error: Exception | None = None
@@ -72,8 +74,14 @@ def main() -> int:
72
 
73
  try:
74
  health, dashboard_html = _wait_for_server(proc, port)
75
- _require(health.get("status") == "ok", f"Unexpected /health payload: {health}")
76
- _require(health.get("service") == "terrafin-interface", f"Unexpected service name: {health}")
 
 
 
 
 
 
77
  _require("TerraFin" in dashboard_html, "Dashboard HTML did not include TerraFin branding.")
78
  _require('<div id="root"></div>' in dashboard_html, "Dashboard page did not serve the SPA shell.")
79
  finally:
 
 
 
1
  import json
2
  import socket
3
  import subprocess
 
28
 
29
 
30
  def _wait_for_server(proc: subprocess.Popen, port: int, timeout_seconds: float = 20.0) -> tuple[dict, str]:
31
+ # ``/health`` now serves the multi-component HTML status page; the JSON
32
+ # variant lives at ``/health.json``. Hitting the HTML URL with
33
+ # ``json.loads`` is what produced the legacy "Expecting value" smoke
34
+ # failure — keep this commented anchor in case the URL drifts again.
35
+ health_url = f"http://127.0.0.1:{port}/health.json"
36
  dashboard_url = f"http://127.0.0.1:{port}/dashboard"
37
  deadline = time.time() + timeout_seconds
38
  last_error: Exception | None = None
 
74
 
75
  try:
76
  health, dashboard_html = _wait_for_server(proc, port)
77
+ _require(
78
+ health.get("status") in {"ok", "degraded", "down"},
79
+ f"Unexpected /health.json payload: {health}",
80
+ )
81
+ _require(
82
+ isinstance(health.get("components"), dict) and {"agent", "telegram", "signals"} <= set(health["components"]),
83
+ f"/health.json missing expected components: {health}",
84
+ )
85
  _require("TerraFin" in dashboard_html, "Dashboard HTML did not include TerraFin branding.")
86
  _require('<div id="root"></div>' in dashboard_html, "Dashboard page did not serve the SPA shell.")
87
  finally: