Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions heart/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2377,13 +2377,8 @@ def _render_html(board: Board) -> str:
if any(b["severity"] == severity for b in board.blockers)
)
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.
repo_name = PAGES_URL.rstrip("/").rsplit("/", 1)[-1]
gh_owner = REPO_OWNERS.get(repo_name)
github_link = (f' · <a href="https://github.com/{gh_owner}/{repo_name}'
'/blob/main/README.md">GitHub Page</a>' 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)
Expand All @@ -2393,7 +2388,7 @@ 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, 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))
Expand All @@ -2420,7 +2415,7 @@ def _render_html(board: Board) -> str:
<span>Monitoring: {(board.monitoring or {}).get("status", "unknown").upper()}</span>
<span class="muted">Release readiness: {word}</span></p>
<p class="muted">snapshot {_html.escape(board.ts)} ·
{age} · <a href="dashboard.md">markdown version</a>{github_link}</p>
{age} · <a href="dashboard.md">markdown version</a></p>
{stale_html}
<p class="vantage">{_html.escape(board.vantage)} ·
{_html.escape(board.devbox_observed or ('no dev-box observation attached' if board.vantage == 'cloud snapshot' else 'observed on this dev box'))}</p>
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def test_html_is_self_contained():
# it as an icon), so assert the href survives rather than the label text.
assert 'href="dashboard.md"' in out
gh_owner = dashboard.REPO_OWNERS["PyAutoHeart"]
assert (f'<a href="https://github.com/{gh_owner}/PyAutoHeart/blob/main/'
'README.md">GitHub Page</a>') in out
assert f'<a href="https://github.com/{gh_owner}/PyAutoHeart">PyAutoHeart</a>' in out
assert 'GitHub Page</a>' not in out
# No external ASSETS (renders anywhere, loads nothing remote): no src=, no
# <link>, no fetches. Inline <script> is allowed — the one-tap 📋 copy
# buttons need the clipboard API — and outbound <a href> links are
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dashboard_disclosures.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ 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('Fix Heart systematically') < html.index('<div class="board">') <
assert (html.index('Copy check-in prompt') < html.index('<div class="board">') <
html.index('Release readiness score:') < html.index('Evidence gaps ('))
assert '[these guys are giving me life]' not in html

Expand Down
2 changes: 1 addition & 1 deletion tests/test_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_html_all_tiers_complete_disclosure_and_safe_fallback():
assert 'role="status" aria-live="polite"' in html
assert 'class="prompt-fallback repair"' in html
assert "[these guys are giving me life]" not in html
assert html.index("Fix Heart systematically") < html.index("Release blockers (12)")
assert html.index("Copy check-in prompt") < html.index("Release blockers (12)")


def test_numeric_emphasis_is_built_from_fields_and_escapes_subjects():
Expand Down
Loading