diff --git a/heart/dashboard.py b/heart/dashboard.py index ceda7397..7bc8f71d 100644 --- a/heart/dashboard.py +++ b/heart/dashboard.py @@ -193,8 +193,17 @@ def theme(): "— check PyAutoBrain out beside this repo or set PYAUTO_BRAIN") # The one-tap board family — the cross-board footer nav every board carries, -# each board skipping its own entry. The base comes from PAGES_URL so the -# owner is named exactly once in this file. +# each board skipping its own entry. +# +# Membership and order are NOT decided here: they live once, in the Brain's +# `config/policy.yaml` `board: boards:`, and `_theme.board_links` is the read. +# This file used to keep its own tuple, written before the Cortex had a board +# — so this footer was short a chip and out of the family's order, and nothing +# noticed. The tuple below survives only as the fallback for an older +# PyAutoBrain checkout whose theme predates the helper; it is deliberately the +# old list, because a fallback that guessed at the current one would drift the +# same way. The base comes from PAGES_URL so the owner is named exactly once +# in this file. BOARD_FAMILY = (("mind", "PyAutoMind"), ("brain", "PyAutoBrain"), ("hands", "PyAutoHands"), ("memory", "PyAutoMemory"), ("organism", "PyAutoScientist")) @@ -202,10 +211,14 @@ def theme(): def _boards_nav_html() -> str: """The cross-board footer — one chip per sibling, each in its own organ's - colour (the theme owns the chip palette; this board owns the URLs).""" + colour (the theme owns the chip palette AND the family's membership; this + board owns only which page it is).""" + t_ = theme() base = PAGES_URL.rsplit("/", 2)[0] - links = {key: f"{base}/{repo}/" for key, repo in BOARD_FAMILY} - return theme().boards_footer(links, BOARD_KEY) + links = getattr(t_, "board_links", None) + links = (links(base, BOARD_KEY) if links else + {key: f"{base}/{repo}/" for key, repo in BOARD_FAMILY}) + return t_.boards_footer(links, BOARD_KEY) # v2: sections gained links/action/observed_ago; the board gained structured # `blockers` ({text, severity, repo, repo_url, run_url, prompt}). Additive. diff --git a/tests/test_dashboard.py b/tests/test_dashboard.py index 4a3cdec5..aadbf8b5 100644 --- a/tests/test_dashboard.py +++ b/tests/test_dashboard.py @@ -849,6 +849,52 @@ def test_html_wears_the_shared_family_theme(): assert "#58a6ff" not in out # the old hard-coded GitHub blue +# The canonical board family, in the order `PyAutoBrain/config/policy.yaml` +# declares it. This board is `heart`, so its own chip never appears. +FAMILY_WITHOUT_HEART = ["brain", "mind", "cortex", "memory", "hands", "organism"] + + +def test_the_family_footer_carries_the_cortex_in_the_canonical_order(): + """The footer's membership is the Brain's config, not a tuple in here. + + It used to be a tuple in here — written before the Cortex had a board — + so this page linked five siblings in an ad-hoc order and silently missed + the sixth. Reading `_theme.board_links` means adding a board to + `config/policy.yaml` lights it in every footer at once. + """ + out = dashboard.render(_failing_snapshot(), make_verdict("red", 45), + fmt="html", now=FRESH_NOW) + footer = re.search(r'