Skip to content

The agent that grows with you

test+docs: trim doctor exit-status tests to two invariants; document the exit code

teknium1661d73f06b65
diff --git a/tests/hermes_cli/test_doctor_exit_status.py b/tests/hermes_cli/test_doctor_exit_status.py
index d083ac1be7c..54f40468f7d 100644
--- a/tests/hermes_cli/test_doctor_exit_status.py
+++ b/tests/hermes_cli/test_doctor_exit_status.py
@@ -1,4 +1,4 @@
-"""Doctor's exit status must agree with its unresolved findings."""
+"""Regression for #117276: ``hermes doctor``'s exit status must agree with its unresolved findings."""
from types import SimpleNamespace
import pytest
@@ -28,42 +28,6 @@ def test_doctor_command_reports_remaining_findings(monkeypatch, capsys, issues,
assert issue in output
-def test_doctor_preserves_check_exception(monkeypatch):
- import hermes_cli.doctor as doctor
- from hermes_cli.main import cmd_doctor
-
- def broken(_fix):
- raise RuntimeError("check failed")
-
- monkeypatch.setattr(doctor, "DOCTOR_CHECKS", ((None, broken),))
- with pytest.raises(RuntimeError, match="check failed"):
- cmd_doctor(SimpleNamespace(fix=False, ack=None, live=False))
-
-
-def test_doctor_ack_keeps_success_fast_path(monkeypatch):
- import hermes_cli.doctor as doctor
- from hermes_cli.main import cmd_doctor
-
- acknowledged = []
- monkeypatch.setattr(doctor, "_ack_advisory", acknowledged.append)
- assert cmd_doctor(SimpleNamespace(ack="example")) is None
- assert acknowledged == ["example"]
-
-
-def test_live_findings_affect_exit_status(monkeypatch):
- import hermes_cli.doctor as doctor
- import hermes_cli.doctor_live as live
- from hermes_cli.main import cmd_doctor
-
- def probe(args, issues):
- assert args.live is True
- issues.append("live route unavailable")
-
- monkeypatch.setattr(doctor, "DOCTOR_CHECKS", ())
- monkeypatch.setattr(live, "maybe_run_live_checks", probe)
- assert cmd_doctor(SimpleNamespace(fix=False, ack=None, live=True)) == 1
-
-
@pytest.mark.parametrize("unresolved", [False, True])
def test_doctor_cli_process_status_matches_summary(unresolved):
import subprocess
diff --git a/website/docs/reference/cli-commands.md b/website/docs/reference/cli-commands.md
index ff2c9a1d468..9abb5aa28cf 100644
--- a/website/docs/reference/cli-commands.md
+++ b/website/docs/reference/cli-commands.md
@@ -969,6 +969,8 @@ hermes doctor [--fix]
|--------|-------------|
| `--fix` | Attempt automatic repairs where possible. |
+Exit status: `0` when the report lists no unresolved problems, `1` when at least one remains (including problems `--fix` could not repair), so a health gate or CI step can trust `hermes doctor` as a check.
+
The **API Connectivity** section includes an `IPv6 route` check: it opens one short (2 s) IPv6 TCP connection to a known dual-stack host. A route that is advertised but only times out (a blackholed IPv6 prefix) is reported as a warning naming the remedy, `network.force_ipv4: true`. Having no IPv6 route at all is healthy and reported as OK; the check is skipped when `force_ipv4` is already set.
Custom-endpoint config checks (both warn-only; `--fix` does not rewrite them):