diff --git a/heart/dashboard.py b/heart/dashboard.py index cc76c70d..1844c752 100644 --- a/heart/dashboard.py +++ b/heart/dashboard.py @@ -2250,7 +2250,7 @@ def _html_score(board: Board) -> str: def _html_actions(board: Board) -> str: - plans = [("Fix Heart systematically", board.fix_plan or build_fix_plan(board))] + plans = [] if board.stale_plan: plans.append(("Refresh all missing evidence", board.stale_plan)) rows = [] @@ -2351,15 +2351,16 @@ def _render_html(board: Board) -> str: navigation = [ {"href": "#observed-checks", "label": "Observed checks"}, {"href": "#score-heading", "label": "Readiness and score"}, - {"href": "#resusitate-heading", "label": "Resusitate"}, ] + if board.stale_plan: + navigation.append({"href": "#resusitate-heading", "label": "Refresh evidence"}) navigation.extend( {"href": f"#reasons-{severity}", "label": label, "count": sum(b["severity"] == severity for b in board.blockers)} for severity, label in (("red", "Release blockers"), ("yellow", "Warnings"), ("stale", "Evidence gaps")) if any(b["severity"] == severity for b in board.blockers) ) - hero = t_.hero(BOARD_KEY, "Dashboard", _LEDE, navigation=navigation) + hero = t_.hero(BOARD_KEY, "Dashboard", navigation=navigation) # The way back from the Pages board to the repository front door; owner # from the declared config surface (REPO_OWNERS), so the segment drops # out on a tenant whose config does not list this repo. @@ -2367,6 +2368,16 @@ def _render_html(board: Board) -> str: gh_owner = REPO_OWNERS.get(repo_name) github_link = (f' · GitHub Page' if gh_owner else "") + work_links = ([{"label": "Open Heart repository", "href": + f"https://github.com/{gh_owner}/{repo_name}"}] if gh_owner else []) + actions = _html_actions(board) + if board.stale_plan: + actions = ('
' + '

Refresh evidence

' + actions + '
') + 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") return f""" @@ -2375,8 +2386,8 @@ def _render_html(board: Board) -> str: {hero} +{panel}

Observed checks

-

Expand a check to see its entries. Colours describe observations; the release verdict below determines readiness.

{''.join(rows)}

Score

@@ -2393,14 +2404,9 @@ def _render_html(board: Board) -> str:

{len(board.red_reasons)} release blockers · {len(board.yellow_reasons)} warnings · {len(board.stale_reasons)} evidence gaps

-
-

Resusitate

-{_html_actions(board)} -
+{actions} {reasons_html} {_boards_nav_html()} - """ diff --git a/tests/test_dashboard_disclosures.py b/tests/test_dashboard_disclosures.py index 51e0f574..c87596fd 100644 --- a/tests/test_dashboard_disclosures.py +++ b/tests/test_dashboard_disclosures.py @@ -107,8 +107,8 @@ def test_timing_cards_are_inside_category_and_checks_precede_score_actions_gaps( assert list(timing.find(cls='timing-card')) assert all('timing-card' not in n.attrs.get('class', '') for c in checks for n in next(c.find('summary')).find()) - assert (html.index('
') < html.index('Release readiness score:') < - html.index('Fix Heart systematically') < html.index('Evidence gaps (')) + assert (html.index('Fix Heart systematically') < html.index('
') < + html.index('Release readiness score:') < html.index('Evidence gaps (')) assert '[these guys are giving me life]' not in html @@ -132,7 +132,7 @@ def test_score_and_resusitate_sections_keep_breakdown_and_readiness(): ('validation_absent', 15)]] root = Page(dashboard._render_html(board)).root headings = [h.text() for h in root.find('h2')] - assert headings == ['Observed checks', 'Score', 'Resusitate', 'Evidence gaps (3)'] + assert headings == ['Fix Heart systematically', 'Observed checks', 'Score', 'Evidence gaps (3)'] score = next(s for s in root.find('section') if s.attrs.get('aria-labelledby') == 'score-heading') assert '65/100' in score.text() and 'Release readiness: STALE' in score.text() @@ -151,10 +151,16 @@ def test_repair_rows_copy_exact_prompts_without_toggling_prompt_disclosures(): stale_details=[{'key': 'install_unknown'}] if stale else []) board = dashboard.build_board(make_snapshot(), verdict, now=FRESH_NOW) root = Page(dashboard._render_html(board)).root - section = next(s for s in root.find('section') - if s.attrs.get('aria-labelledby') == 'resusitate-heading') + section = (next(s for s in root.find('section') + if s.attrs.get('aria-labelledby') == 'resusitate-heading') + if stale else root) rows = list(section.find(cls='repair-row')) - plans = [board.fix_plan] + ([board.stale_plan] if stale else []) + plans = [board.stale_plan] if stale else [] + panel = next(root.find(cls="orchestration-panel")) + preview = list(panel.find("textarea"))[-1] + assert preview.text().startswith(board.fix_plan["prompt"]) + assert "Work on GitHub:" in preview.text() + assert len(list(panel.find("button"))) == 1 assert len(rows) == len(plans) for row, plan in zip(rows, plans): details = next(row.find('details')) @@ -166,4 +172,4 @@ def test_repair_rows_copy_exact_prompts_without_toggling_prompt_disclosures(): assert button.attrs['data-cmd'] == plan['prompt'] assert next(details.find('pre')).text() == plan['prompt'] assert button.text() == '' and list(button.find('svg')) - assert next(section.find('p')).attrs['aria-live'] == 'polite' + assert any(p.attrs.get('aria-live') == 'polite' for p in section.find('p'))