From 8e1cc009a2b4e9af62071029cdf0e508f04cd34e Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Wed, 7 Oct 2026 08:54:01 +0100 Subject: [PATCH] feat: adopt shared dashboard freshness footer --- scripts/organism_board.py | 8 +++++++- tests/test_organism_board.py | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/organism_board.py b/scripts/organism_board.py index dcc471f..ae1eaa5 100644 --- a/scripts/organism_board.py +++ b/scripts/organism_board.py @@ -260,7 +260,13 @@ def _render_html(snapshot: dict) -> str: if snapshot.get("owner") and b.get("repo") ] panel = t.orchestration_panel("scientist", "", "", CHECKIN_PROMPT, - organ="scientist", work_links=work_links) + organ="scientist", work_links=work_links, + refreshed_at=(snapshot.get("generated") + if snapshot.get("boards") and all(row.get("headline") is not None + for row in snapshot["boards"]) + else None), + refresh_url=(f"https://github.com/{snapshot['owner']}/PyAutoScientist/actions/workflows/organism_board.yml" + if snapshot.get("owner") else None)) word = heart_word(snapshot) rows = [] for b in snapshot.get("boards") or []: diff --git a/tests/test_organism_board.py b/tests/test_organism_board.py index fb9db4d..67faffc 100644 --- a/tests/test_organism_board.py +++ b/tests/test_organism_board.py @@ -22,6 +22,7 @@ def test_theme_finds_grouped_brain_from_outer_workspace(tmp_path, monkeypatch): brain_board.mkdir(parents=True) (brain_board / "_theme.py").write_text("GROUPED_THEME = True\n") monkeypatch.setenv("PYAUTO_ROOT", str(tmp_path)) + monkeypatch.delenv("PYAUTO_BRAIN", raising=False) monkeypatch.setattr(ob, "HOME", tmp_path / "PyAutoScientist") monkeypatch.delitem(sys.modules, "_theme", raising=False) monkeypatch.setattr(sys, "path", sys.path.copy()) @@ -133,3 +134,21 @@ def test_panel_links_each_work_owner_and_preserves_doors(): assert f'https://github.com/SomeOrg/{row["repo"]}' in rendered assert rendered.count("copy the door command") == len(snap["boards"]) assert rendered.index('data-orchestration-panel') < rendered.index("class='organ'") + + +def test_panel_refresh_uses_router_capture(monkeypatch): + theme = ob.theme() + calls = [] + monkeypatch.setattr(theme, "orchestration_panel", lambda *a, **kw: calls.append(kw) or "") + snap = _snap() + snap["boards"][2]["headline"] = "Release information collected" + ob.render(snap, "html") + assert calls[0]["refreshed_at"] == snap["generated"] + assert calls[0]["refresh_url"] == "https://github.com/SomeOrg/PyAutoScientist/actions/workflows/organism_board.yml" + + snap["boards"][2]["headline"] = None + ob.render(snap, "html") + assert calls[-1]["refreshed_at"] is None + snap["boards"] = [] + ob.render(snap, "html") + assert calls[-1]["refreshed_at"] is None