From 4b02cbcefdedf4ffe390581d77303a58671b49d3 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 7 Oct 2026 08:53:54 +0100 Subject: [PATCH] feat: adopt shared dashboard freshness footer --- heart/dashboard.py | 8 +++++++- tests/test_dashboard.py | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/heart/dashboard.py b/heart/dashboard.py index a0e3406b..de3f2e98 100644 --- a/heart/dashboard.py +++ b/heart/dashboard.py @@ -298,6 +298,8 @@ class Board: penalties: list[dict] | None = None vantage: str = "local snapshot" devbox_observed: str | None = None + # Capture time only; verdict evidence timestamps cannot establish a refresh. + refreshed_at: str | None = None # --- verdict/state → glyph & colour maps ------------------------------------ @@ -1114,6 +1116,7 @@ def build_board( verdict=v, score=score, ts=ts, + refreshed_at=snapshot.get("ts"), age_seconds=age, stale=stale, red_reasons=red, @@ -2390,7 +2393,10 @@ def _render_html(board: Board) -> str: panel = t_.orchestration_panel( "heart", "Fix Heart systematically", "", (board.fix_plan or build_fix_plan(board))["prompt"], - work_links=work_links, copy_label="Fix Heart systematically", organ="heart") + work_links=work_links, copy_label="Fix Heart systematically", organ="heart", + refreshed_at=board.refreshed_at, + refresh_url=(f"https://github.com/{gh_owner}/{repo_name}/actions/workflows/heart-health.yml" + if gh_owner else None)) return f""" diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index 3cb8dd85..41473430 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -1836,3 +1836,16 @@ def test_cloud_test_run_renders_failed_counts_and_no_invented_zeros(): section = next(s for s in board.sections if s.key == "test_run") assert "counts not ingested" in section.summary assert "0p" not in section.summary + + +def test_panel_refresh_never_substitutes_verdict_evidence_date(monkeypatch): + theme = dashboard.theme() + calls = [] + monkeypatch.setattr(theme, "orchestration_panel", lambda *a, **kw: calls.append(kw) or "") + snap = make_snapshot() + dashboard.render(snap, make_verdict(), fmt="html", now=FRESH_NOW) + assert calls[-1]["refreshed_at"] == snap["ts"] + assert calls[-1]["refresh_url"].endswith("/actions/workflows/heart-health.yml") + snap.pop("ts") + dashboard.render(snap, make_verdict(), fmt="html", now=FRESH_NOW) + assert calls[-1]["refreshed_at"] is None