From 4343bb05d6eb23cbe3006b4b170dafef0115a037 Mon Sep 17 00:00:00 2001 From: UnbreakableMJ Date: Tue, 15 Sep 2026 23:40:39 +0300 Subject: [PATCH] =?UTF-8?q?fix(palette):=20add=20the=20missing=20=C2=A711.?= =?UTF-8?q?4.1=20reference=20keys,=20and=20gate=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The three palettes added at v2.08 shipped without a `reference` key. §11.4.1 requires one on every palette, and both the Standard and the skills already printed reference names for all three — so the palettes looked complete everywhere a person reads and were empty in the only place a program reads. It surfaced when a script that regenerates the branding showcase from the TOML raised KeyError: 'reference'. Nine CI gates let it through, and the reason is worth recording: every one of them asks about colour values — do the ratios re-derive, does a name map to two hexes, has a hex been restated outside the source. `reference` is the one required key that is not a colour, so nothing was looking at it. check-token-names.py now fails when any palette lacks a reference. It already parsed [palettes.*] for the collision check, so the cost is one pass and the gate keeps its name: it is the file's structural check. Tested both directions — passes on the fixed file, fails with a readable diagnostic when a reference is removed. Co-Authored-By: Claude Opus 5 --- .github/check-token-names.py | 19 ++++++++++++++++++- steelbore-color-palette/assets/steelbore.toml | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/check-token-names.py b/.github/check-token-names.py index e4871d6..e632139 100644 --- a/.github/check-token-names.py +++ b/.github/check-token-names.py @@ -56,9 +56,26 @@ def main() -> int: value.upper(), [] ).append(slug) + # §11.4.1 — every palette carries a reference name, and the TOML is where it + # lives. The Standard and the skills both print these names in prose, so a + # palette without one looks complete everywhere a reader looks and is empty + # in the only place a program reads. Three palettes shipped that way at + # v2.08 and nine gates let it through, because every other check asks about + # values and this is the one required key that is not a colour. + missing = sorted(s for s, p in palettes.items() if not p.get("reference")) + if missing: + for slug in missing: + print(f"`[palettes.{slug}]` has no `reference` key (§11.4.1).", file=sys.stderr) + print( + " Every palette carries a reference name for prose; the slug stays the\n" + " machine identifier. Add `reference = \"-color-palette\"`.", + file=sys.stderr, + ) + return 1 + collisions = {name: v for name, v in seen.items() if len(v) > 1} if not collisions: - print(f"token names OK ({len(seen)} distinct names across {len(palettes)} palettes)") + print(f"token names OK ({len(seen)} distinct names across {len(palettes)} palettes; all carry a reference)") return 0 for name, by_hex in sorted(collisions.items()): diff --git a/steelbore-color-palette/assets/steelbore.toml b/steelbore-color-palette/assets/steelbore.toml index 0ff13a4..997e4b5 100644 --- a/steelbore-color-palette/assets/steelbore.toml +++ b/steelbore-color-palette/assets/steelbore.toml @@ -800,6 +800,7 @@ border = "11.79:1" # still keeps Hot Pink above 4.5:1 on it (4.72:1) — pinker fails the floor. # ------------------------------------------------------------------------- [palettes.steelbore-blackpinkpanther] +reference = "blackpinkpanther-color-palette" "Runway Black" = "#000000" "Backlit Rose" = "#2E0020" "Backstage Black" = "#18000E" @@ -897,6 +898,7 @@ border = "8.31:1" # For a neutral-text reading of the same colours, see steelbore-greenalt. # ------------------------------------------------------------------------- [palettes.steelbore-green] +reference = "green-color-palette" "Vampire Black" = "#0D0208" "Rain Shadow" = "#08180C" "Royal Black" = "#030303" @@ -992,6 +994,7 @@ border = "7.87:1" # canvas, surfaces and status tones; a project picks one, never both (§11.4). # ------------------------------------------------------------------------- [palettes.steelbore-greenalt] +reference = "greenalt-color-palette" "Vampire Black" = "#0D0208" "Rain Shadow" = "#08180C" "Royal Black" = "#030303"