Skip to content

The agent that grows with you

test(update): pin dashboard runtime-outcome reconciliation for hermes-dashboard* units

Brooklyn Nicholson967a94b4fb17
diff --git a/tests/hermes_cli/test_restart_plan_reconciliation.py b/tests/hermes_cli/test_restart_plan_reconciliation.py
index 8a4d91bcd70..c47b613e937 100644
--- a/tests/hermes_cli/test_restart_plan_reconciliation.py
+++ b/tests/hermes_cli/test_restart_plan_reconciliation.py
@@ -207,6 +207,44 @@ def _serve(profile: str, pid: int, kind: str = "serve") -> RuntimeRecord:
)
+def test_systemd_dashboard_runtime_reconciles_restarted_via_its_unit():
+ """#125297: the fleet unit pass restarts ``hermes-dashboard{,-<profile>}``, so the
+ receipt's runtime_outcomes row must credit it as ``restarted`` — not leave the
+ dashboard ``deferred`` while the update still reports success."""
+ outcomes = match_runtime_outcomes(
+ _plan(_dash_unit_runtime("default", 700), _dash_unit_runtime("work", 701)),
+ restarted_services=["hermes-dashboard", "user/hermes-dashboard-work"],
+ relaunched_profiles=[], externally_supervised_profiles=[],
+ killed_pids=set(), failed_units=[],
+ )
+ by_pid = {o["pid"]: o["outcome"] for o in outcomes}
+ assert by_pid == {700: "restarted", 701: "restarted"}
+ assert report_unaccounted_runtimes(outcomes) is False
+
+
+def test_systemd_dashboard_runtime_without_unit_restart_stays_unaccounted():
+ """The tripwire side: no ``hermes-dashboard*`` restart in the bookkeeping means
+ the row escalates (exit 1), never a silent ``deferred`` on a success receipt."""
+ outcomes = match_runtime_outcomes(
+ _plan(_dash_unit_runtime("default", 700), _rt("default", 100, supervisor="systemd")),
+ restarted_services=["hermes-gateway"], relaunched_profiles=[],
+ externally_supervised_profiles=[], killed_pids=set(), failed_units=[],
+ )
+ by_pid = {o["pid"]: o["outcome"] for o in outcomes}
+ assert by_pid == {100: "restarted", 700: "unaccounted"}
+ assert report_unaccounted_runtimes(outcomes) is True
+
+
+def _dash_unit_runtime(profile: str, pid: int) -> RuntimeRecord:
+ return RuntimeRecord(
+ kind="dashboard",
+ profile=profile,
+ pid=pid,
+ supervisor="systemd",
+ restart_via=_restart_mechanism("systemd", profile),
+ )
+
+
def test_serve_never_borrows_relaunched_or_external_gateway_profile():
"""Sibling site of #100479: the relaunched_profiles / external-supervisor
bookkeeping is gateway vocabulary too. A manual gateway relaunch under
diff --git a/tests/hermes_cli/test_update_serve_generation_recovery.py b/tests/hermes_cli/test_update_serve_generation_recovery.py
index 5dc1486af34..ef99c8c0e1e 100644
--- a/tests/hermes_cli/test_update_serve_generation_recovery.py
+++ b/tests/hermes_cli/test_update_serve_generation_recovery.py
@@ -487,6 +487,19 @@ def test_dashboard_unit_is_restarted_and_verified_by_the_serve_pass(linux_system
}
+def test_default_profile_dashboard_unit_is_restarted_by_the_serve_pass(linux_systemctl):
+ """#125297: the unprofiled ``hermes-dashboard.service`` — the exact unit from the
+ report's receipts — is enumerated and restarted alongside serve units."""
+ fake = _Systemctl(
+ listed=["hermes-dashboard.service"],
+ active={"hermes-dashboard.service": True},
+ main_pids={"hermes-dashboard.service": 9},
+ )
+ out = recovery.restart_serve_units(run=fake, sleep=lambda _: None)
+ assert fake.restarted == ["hermes-dashboard.service"]
+ assert out == {"verified": ["user/hermes-dashboard"], "failed": []}
+
+
def test_no_systemctl_means_no_serve_pass(monkeypatch):
monkeypatch.setattr(recovery.shutil, "which", lambda name: None)