diff --git a/scripts/board.py b/scripts/board.py index 805ffb1..0da891e 100644 --- a/scripts/board.py +++ b/scripts/board.py @@ -568,7 +568,16 @@ def _repo_url(snapshot: dict) -> str: # The one-tap board family — the cross-board footer nav every board carries, -# each board skipping its own entry. Owner comes from the snapshot. +# 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. Owner still comes from the snapshot. BOARD_FAMILY = (("mind", "PyAutoMind"), ("brain", "PyAutoBrain"), ("heart", "PyAutoHeart"), ("hands", "PyAutoHands"), ("organism", "PyAutoScientist")) @@ -576,13 +585,17 @@ def _repo_url(snapshot: dict) -> str: def _boards_nav(snapshot: dict) -> 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 its owner and which page it is).""" owner = str(snapshot.get("owner") or "").lower() if not owner: return "" - links = {key: f"https://{owner}.github.io/{repo}/" - for key, repo in BOARD_FAMILY} - return theme().boards_footer(links, BOARD_KEY) + t_ = theme() + base = f"https://{owner}.github.io" + 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) def _read_prompt(snapshot: dict, section: str) -> str: diff --git a/tests/test_board.py b/tests/test_board.py index 3bdb1f4..4eeaa22 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -232,6 +232,58 @@ def test_live_repo_statuses_are_schema_valid(): assert seen <= {"stub", "drafted", "reviewed"}, f"schema-invalid statuses: {seen}" +# The canonical board family, in the order `PyAutoBrain/config/policy.yaml` +# declares it. This board is `memory`, so its own chip never appears. +FAMILY_WITHOUT_MEMORY = ["brain", "mind", "cortex", "heart", "hands", "organism"] + + +def _footer(tmp_path) -> str: + # The synthetic tree has no git remote, so `collect` finds no owner and + # the footer (rightly) renders empty. Name a fake one — this file carries + # no instance facts. + snap = board.collect(_tree(tmp_path)) + snap["owner"] = "SomeOrg" + html = board.render(snap, "html") + return re.search(r'