From 0dc45e02d794217b5b19469b019d973953d6ca84 Mon Sep 17 00:00:00 2001 From: Jammy2211 Date: Sat, 26 Sep 2026 17:27:06 +0100 Subject: [PATCH] =?UTF-8?q?feat(board):=20Gut=20joins=20the=20board=20fami?= =?UTF-8?q?ly=20=E2=80=94=20palette,=20mark,=20ref=5Fname=20parser=20(PyAu?= =?UTF-8?q?toGut#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - board/_theme.py: ORGANS["gut"] sampled off PyAutoGut/logo.png (glow #8ad414 over the #1f3006 olive vignette; ink #3f7a00 = 5.3:1 on #fff, #8fe01a = 11.6:1 on #0d1117) and MARKS["gut"], the lidded bin with speed lines and the ringed-cross void badge. - config/policy.yaml: `gut: PyAutoGut` in `board: boards:` (after hands, in the ruled organ order), so every footer gains the Gut chip. - _hygiene_condemned.py: ref_name(entry) reads the Gut ref name from the `archive-ref` field (never the heading), None for n/a / non-ref entries, batch globs kept for the caller. PyAutoGut's board and void workflow import this parser from a checked-out Brain. - tests: gut palette/contrast/mark, reverse palette-declared check, footer order pins updated; new tests/test_hygiene_condemned.py. Co-Authored-By: Claude Fable 5.1 --- .../conductors/hygiene/_hygiene_condemned.py | 35 ++++++- board/_theme.py | 33 ++++++- config/policy.yaml | 1 + tests/test_board_theme.py | 23 ++++- tests/test_hygiene_condemned.py | 97 +++++++++++++++++++ 5 files changed, 184 insertions(+), 5 deletions(-) create mode 100644 tests/test_hygiene_condemned.py diff --git a/agents/conductors/hygiene/_hygiene_condemned.py b/agents/conductors/hygiene/_hygiene_condemned.py index c775efa2..db91d377 100644 --- a/agents/conductors/hygiene/_hygiene_condemned.py +++ b/agents/conductors/hygiene/_hygiene_condemned.py @@ -5,7 +5,10 @@ the `condemned.md` manifest (the Mind catalog of condemned self-material) and classifies each entry by its transit clock — **due** (sweep-after date reached, ready to void) vs **pending** (still in the transit window, recoverable). It -emits a plan; the actual void is delegated to `pyauto-gut void`. Stdlib only — +emits a plan; the actual void is delegated to `pyauto-gut void`. `ref_name` +maps an entry to the Gut ref it archives to; PyAutoGut's board collector and +its void workflow import this module from a checked-out Brain for the same +parse, so the ledger is read one way everywhere. Stdlib only — the conductor never drags a dependency into the Brain. Usage: @@ -54,6 +57,36 @@ def parse_manifest(text): return entries +# The archive namespace every Gut ref lives under. `ref_name` reads the +# `archive-ref` field — never the `##` heading, which is a human title and +# differs from the ref name (e.g. heading `pyautohands/pre-2023-history`, +# ref `pyautohands-pre-2023-history`). +ARCHIVE_NS = "refs/heads/archive/condemned/" +_REF_RE = re.compile(re.escape(ARCHIVE_NS) + r"([A-Za-z0-9._*][A-Za-z0-9._/*-]*)") + + +def ref_name(entry): + """The Gut ref name `` an entry archives to, or None. + + Reads the first `refs/heads/archive/condemned/` in the entry's + `archive-ref` field, tolerating the backticks, `@ ` and + `on origin` decorations the ledger actually carries. None means + the entry has no Gut ref at all — `n/a` (a merged branch or a committed + deletion whose bytes live in remote history), a local backup path, or no + field. A batch entry that archived many refs under one prefix returns + the glob as written (e.g. `pyautomind-*`); the caller expands it against + the refs it can see. A trailing `.` or `/` (sentence punctuation) is + stripped. + """ + text = (entry.get("archive-ref") or "").strip() + if not text or text.strip("`").lower().startswith("n/a"): + return None + m = _REF_RE.search(text) + if not m: + return None + return m.group(1).rstrip("./") or None + + def _parse_date(s): try: return datetime.date.fromisoformat((s or "").strip()) diff --git a/board/_theme.py b/board/_theme.py index e40d282a..acaf0530 100644 --- a/board/_theme.py +++ b/board/_theme.py @@ -48,8 +48,8 @@ `ORGANS` is the palette table, keyed by the same board names as `config/policy.yaml` `board: boards:` — that mapping is the declared config -surface an adopting fork replaces, so no repo is named here. Five of the six -palettes are sampled from the actual logo files: the mark, the glyph colour +surface an adopting fork replaces, so no repo is named here. Every palette +but the umbrella's is sampled from the actual logo files: the mark, the glyph colour and the wordmark's own tagline, straight off `logo.png` in each organ's repo. The umbrella board has no logo, so its accent and tagline are designed to sit in @@ -105,6 +105,17 @@ "ink_light": "#9a5400", "ink_dark": "#ffa733", "glow": "#ff9201", "hero": ("#372100", "#000000"), }, + # Gut — sampled off PyAutoGut/logo.png: the lime glyph (#8ad414, the + # logo's dominant bright colour) over the dark-olive vignette (#1f3006). + # Lime is far too light to read on white (1.8:1), so the light-scheme ink + # is the same hue taken down to #3f7a00 (5.3:1 on #fff); the dark-scheme + # ink #8fe01a reads at 11.6:1 on #0d1117. + "gut": { + "organ": "Gut", + "tagline": "Delete. Clean. Keep healthy.", + "ink_light": "#3f7a00", "ink_dark": "#8fe01a", "glow": "#8ad414", + "hero": ("#1f3006", "#000000"), + }, # The umbrella is the one board with no logo to sample: the accent and # the tagline are designed to sit in the family rather than read off a # file. Replace both from the logo if that repo ever grows one. @@ -278,6 +289,24 @@ '' ), + # Gut — a lidded bin with ribs, speed lines entering from the left and + # the void badge (a ringed cross) over its lower-right corner, inside a + # closed ring, as on the logo. + "gut": ( + '' + '' + '' + '' + '' + '' + '' + '' + ), # Umbrella — no logo to sample, so the family language (ring, line-art, # node dots) applied to the double helix the board already carried. "organism": ( diff --git a/config/policy.yaml b/config/policy.yaml index e7cd24ec..784e6251 100644 --- a/config/policy.yaml +++ b/config/policy.yaml @@ -171,4 +171,5 @@ board: memory: PyAutoMemory heart: PyAutoHeart hands: PyAutoHands + gut: PyAutoGut organism: PyAutoScientist diff --git a/tests/test_board_theme.py b/tests/test_board_theme.py index 484aef4c..fdef4173 100644 --- a/tests/test_board_theme.py +++ b/tests/test_board_theme.py @@ -203,7 +203,7 @@ def test_board_links_reads_the_declared_family_in_file_order(): # the order `config/policy.yaml` declares — the ruled organ order. links = _theme.board_links("https://example.invalid") assert list(links) == ["brain", "mind", "cortex", "memory", - "heart", "hands", "organism"] + "heart", "hands", "gut", "organism"] assert list(links) == POLICY_BOARDS assert links["cortex"] == "https://example.invalid/PyAutoCortex/" @@ -225,7 +225,8 @@ def test_board_links_renders_the_family_footer_end_to_end(): footer = _theme.boards_footer( _theme.board_links("https://example.invalid", "heart"), "heart") order = re.findall(r'data-organ="(\w+)"', footer) - assert order == ["brain", "mind", "cortex", "memory", "hands", "organism"] + assert order == ["brain", "mind", "cortex", "memory", "hands", "gut", + "organism"] def test_board_links_returns_nothing_when_the_config_is_unreadable(): @@ -314,3 +315,21 @@ def test_a_bare_list_lines_up_with_the_rest_of_the_page(): # The lists that are layout rather than prose keep their own zero. assert re.search(r"\.stats\{[^}]*padding:0", css, re.S) assert re.search(r"\.boards\{[^}]*padding:0", css, re.S) + + +def test_the_gut_board_is_in_the_family_and_readable(): + # PyAutoGut#9: the Gut joined the board family — a palette sampled off its + # logo, a drawn mark, and accents that pass the same contrast bar. + assert "gut" in POLICY_BOARDS + o = _theme.ORGANS["gut"] + assert o["organ"] == "Gut" + assert _contrast(o["ink_light"], "#ffffff") >= 4.5 + assert _contrast(o["ink_dark"], "#0d1117") >= 4.5 + assert "gut" in _theme.MARKS and " + +## team/old-spike +- type: branch +- locator: feature/old-spike +- sweep-after: 2026-08-12 +- archive-ref: refs/heads/archive/condemned/team-old-spike @ 0de4514 + +## history/kept +- type: branch +- locator: master +- sweep-after: never — void only on explicit human request +- archive-ref: `refs/heads/archive/condemned/history-kept` on SomeGut origin (55da101c, 442 commits) + +## purge/datasets +- type: file +- locator: dataset/old +- sweep-after: 2026-08-29 +- archive-ref: n/a — committed deletion; pre-purge SHA `8625a1de` +""" + + +def test_parse_manifest_skips_prose_sections_and_commented_examples(): + entries = hc.parse_manifest(LEDGER) + assert [e["name"] for e in entries] == [ + "team/old-spike", "history/kept", "purge/datasets"] + + +def test_classify_splits_due_pending_and_undated(): + entries = hc.parse_manifest(LEDGER) + due, pending, undated = hc.classify(entries, datetime.date(2026, 8, 20)) + assert [e["name"] for e in due] == ["team/old-spike"] + assert [e["name"] for e in pending] == ["purge/datasets"] + assert [e["name"] for e in undated] == ["history/kept"] + + +def test_ref_name_reads_archive_ref_not_the_heading(): + entries = {e["name"]: e for e in hc.parse_manifest(LEDGER)} + assert hc.ref_name(entries["team/old-spike"]) == "team-old-spike" + assert hc.ref_name(entries["history/kept"]) == "history-kept" + + +def test_ref_name_is_none_for_history_only_entries(): + for text in ("n/a — committed deletion; pre-purge SHA `8625a1de`", + "`n/a` — committed deletion", + "permanent local mirror backups ~/backups/x.git", + ""): + assert hc.ref_name({"archive-ref": text}) is None, text + assert hc.ref_name({}) is None + + +def test_ref_name_tolerates_the_decorations_the_ledger_carries(): + cases = { + "refs/heads/archive/condemned/a-b @ 0de4514": "a-b", + "`refs/heads/archive/condemned/a-b` @ `e6e72cc2`": "a-b", + "refs/heads/archive/condemned/a-b on SomeRepo origin (9dc61c5)": "a-b", + "refs/heads/archive/condemned/team/inference @ c8b6058 (SomeGut)": + "team/inference", + "see refs/heads/archive/condemned/tail-dot.": "tail-dot", + } + for text, want in cases.items(): + assert hc.ref_name({"archive-ref": text}) == want, text + + +def test_ref_name_keeps_a_batch_glob_for_the_caller_to_expand(): + entry = {"archive-ref": "37 refs under `refs/heads/archive/condemned/" + "batch-*` on SomeGut origin — all verified"} + assert hc.ref_name(entry) == "batch-*"