diff --git a/autohands/board.py b/autohands/board.py index c1f21f6d..4f390f85 100644 --- a/autohands/board.py +++ b/autohands/board.py @@ -548,8 +548,10 @@ def _render_html(snapshot: dict) -> str: f"render:

") heart = _heart_board_url(snapshot) hero = t_.hero(BOARD_KEY, "Dashboard", _LEDE, navigation=[ - {"href": "#libraries", "label": "Libraries"}, - {"href": "#release-train", "label": "Release train"}, + {"href": "#libraries", "label": "Libraries", + "count": len(snapshot["libraries"]) if snapshot.get("libraries") is not None and not snapshot.get("errors") else None}, + {"href": "#release-train", "label": "Release train", + "count": len(snapshot["train"][:TRAIN_RUNS_SHOWN]) if snapshot.get("train") is not None and not snapshot.get("errors") else None}, ]) # The way back from the Pages board to the repository front door; owner # and repo come from the snapshot (the git remote), so nothing is @@ -566,7 +568,7 @@ def _render_html(snapshot: dict) -> str: github_link = (f' · GitHub Page' if gh_owner and gh_repo else "") - return f""" + return t_.section_layout(f""" PyAutoHands Dashboard @@ -590,7 +592,7 @@ def _render_html(snapshot: dict) -> str: APIs · generated {_html.escape(str(snapshot.get('generated') or '?'))}. -""" +""") def badge_endpoint(snapshot: dict) -> dict: diff --git a/tests/test_board.py b/tests/test_board.py index a1abae84..f0894e55 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -325,7 +325,7 @@ def test_orchestration_panel_uses_executor_remote_and_preserves_actions(): assert html_module.unescape(preview) == ( board.CHECKIN_PROMPT.format(owner=SNAP["owner"]) + "\n\nWork on GitHub:\n" "- SomeHands: https://github.com/SomeOrg/SomeHands") - assert page.index('class="board-nav"') < page.index('id="orchestration-hands"') + assert page.index('class="board-nav"') > page.index('id="orchestration-hands"') assert page.index('id="orchestration-hands"') < page.index('

') assert board.theme().prompt_heading("hands", heading_id="orchestration-hands-heading") in page for _, payload in board.ACTION_CHIPS: @@ -351,3 +351,10 @@ def test_panel_refresh_uses_capture_not_release_time(monkeypatch): board.render({**SNAP, "errors": ["release collection unavailable"]}, "html") assert calls[-1]["refreshed_at"] is None + + +def test_failed_collection_does_not_claim_zero_items_in_section_counts(): + snapshot = dict(SNAP, libraries=[], train=[], errors=['Collection unavailable']) + page = board._render_html(snapshot) + nav = re.search(r'