no-mistakes(review): fix duplicate-000 probe capture at assignment boundary

This commit is contained in:
root
2026-09-12 14:23:35 +00:00
parent b1b3b4c010
commit 5f582e2c9c
2 changed files with 27 additions and 5 deletions
+18 -2
View File
@@ -89,7 +89,7 @@ case "$host" in
esac ;;
192.168.68.14)
case "$cmd" in
*"/a2a/"*) printf '%s' "$AZ_A2A_CODE" ;;
*"/a2a/"*) printf '%s' "$AZ_A2A_CODE"; exit "$AZ_A2A_EXIT" ;;
esac ;;
*)
printf 'UNEXPECTED-SSH-HOST %s\n' "$host" >> "$RECORD_DIR/unexpected-ssh" ;;
@@ -121,7 +121,7 @@ def _write_exec(path: pathlib.Path, body: str) -> None:
def _run_monitor(tmp_path, *, tanko_svc="active", tanko_http="200",
az_a2a_code="401"):
az_a2a_code="401", az_a2a_exit=0):
"""Run the shipped monitor in a sandbox; return (proc, record_dir, log_path).
Only the LOG constant is rewritten (to keep the run inside the worktree).
@@ -150,6 +150,7 @@ def _run_monitor(tmp_path, *, tanko_svc="active", tanko_http="200",
"TANKO_SVC": tanko_svc,
"TANKO_HTTP": tanko_http,
"AZ_A2A_CODE": az_a2a_code,
"AZ_A2A_EXIT": str(az_a2a_exit),
"PI_HTTP": "200",
"PI_BODY": CONNECTED_FIXTURE.read_text(),
"SERVER_HTTP": "200",
@@ -221,6 +222,21 @@ def test_unexpected_a2a_status_is_an_issue_not_healthy(tmp_path):
assert "kagentz A2A server answered HTTP 500" in proc.stdout
def test_a2a_connection_failure_is_down_not_unexpected(tmp_path):
# curl prints the http_code before failing, so the ssh stub exits non-zero
# with "000" on stdout — exercising the real outage path.
proc, record, log_path = _run_monitor(tmp_path, az_a2a_code="000",
az_a2a_exit=7)
assert proc.returncode == 0, proc.stderr
log = log_path.read_text()
assert "kagentz: ❌ A2A down (HTTP 000)" in log
assert "kagentz: ✅ A2A alive" not in log
assert "unexpected" not in log
assert "Result: 🔴 1 issue(s) found" in log
assert "kagentz A2A server DOWN (connection failed)" in proc.stdout
# ── scripts/daily-infra-report.py: behavioral digest checks ──────────
@pytest.fixture(scope="module")