From 91eeb2cddce2376b1cc2d36ca9df452e643ff9cf Mon Sep 17 00:00:00 2001 From: Cato <41178744+catomean@users.noreply.github.com> Date: Tue, 22 Sep 2026 10:38:06 -0700 Subject: [PATCH] fix(design): the health value stops being the only boxed thing on the row (#852) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looked at the rebuilt list on production. The rail lines up — one row height (64px, was 71/79/81) and the run column dead level at 0px spread — but the health value still sat in a bordered pill, and it was the ONLY boxed thing there. Two of the principles I had just written, broken by my own change: · Principle 3, space separates and boxes are a last resort. · Principle 2, emphasis belongs to alarms — that pill pulled the eye harder than the flag count beside it, which is the one thing on the row that is actually an alarm. It also kept 8px of column jitter, because a pill's width follows its text ("7/10" vs "10/10"). Plain tabular text, full cell width, right-aligned: the column edge is exact and the number is as quiet as the date beside it. Still a button, still opens the breakdown. THE GATE WAS STRICTER THAN THE SPEC, which is its own kind of wrong. CLAUDE.md's four-layer architecture already rules on arbitrary values: colour and typography never, one-off LAYOUT constraints explicitly permitted. My gate treated both alike, so it would have blocked work the documented policy allows — and a gate that contradicts the spec it claims to enforce is one people learn to route around. Split in two: colour/typography is zero-tolerance, layout is ratcheted at 16. That split immediately found a real pre-existing violation the blanket version had buried: `drop-shadow-[0_0_4px_var(--surface-page)]` in scroll-affordance, which the spec names explicitly as forbidden. Named as `.ui-scroll-affordance-glyph` rather than excused — a visual decision belongs in globals.css even when its value is already a token. Co-authored-by: Claude Opus 5 (1M context) --- scripts/test/design-principles.ts | 54 ++++++++++++++++++------- src/app/globals.css | 19 +++++++++ src/components/projects/HealthScore.tsx | 4 +- src/components/ui/scroll-affordance.tsx | 2 +- 4 files changed, 62 insertions(+), 17 deletions(-) diff --git a/scripts/test/design-principles.ts b/scripts/test/design-principles.ts index a0f0d31c3..7b104b9b7 100644 --- a/scripts/test/design-principles.ts +++ b/scripts/test/design-principles.ts @@ -52,9 +52,17 @@ function walk(dir: string, out: string[] = []): string[] { } /** - * Arbitrary Tailwind values in component markup: `text-[13px]`, `min-h-[4.25rem]`, - * `w-[247px]`. Each one is a decision made outside the design system, which is - * how a system becomes a suggestion. + * Arbitrary Tailwind values in component markup. + * + * CLAUDE.md's four-layer spec already rules on these, and this gate follows it + * rather than inventing a stricter one: COLOUR and TYPOGRAPHY arbitraries are + * never allowed (there is a token; use it), while LAYOUT arbitraries are + * explicitly PERMITTED for one-off constraints with no semantic meaning and are + * therefore ratcheted rather than banned. + * + * An earlier version treated both alike. That was stricter than the documented + * policy, and a gate contradicting the spec it claims to enforce is one people + * learn to route around. * * BASELINE, not zero. SIXTEEN existed when this gate was written — an earlier * count of "nine" came from a narrower pattern that missed z-, max-w- and @@ -63,9 +71,13 @@ function walk(dir: string, out: string[] = []): string[] { * would mean a sweeping refactor in the same change that introduces the rule, * and a gate nobody can pass gets deleted. */ -const ARBITRARY_BASELINE = 16; -const ARBITRARY = - /\b(?:text|min-h|max-h|h|w|min-w|max-w|gap|p[xytrbl]?|m[xytrbl]?|top|left|right|bottom|z)-\[[^\]]+\]/g; +const LAYOUT_ARBITRARY_BASELINE = 16; +/** Layout only — permitted by the four-layer spec, held at its current count. */ +const LAYOUT_ARBITRARY = + /\b(?:min-h|max-h|h|w|min-w|max-w|gap|p[xytrbl]?|m[xytrbl]?|top|left|right|bottom|z)-\[[^\]]+\]/g; +/** Colour and typography — never permitted, at any count. */ +const VISUAL_ARBITRARY = + /\b(?:text|bg|border|shadow|ring|fill|stroke)-\[(?:#|rgb|hsl|oklch|\d)[^\]]*\]/g; console.log("design-principles:"); @@ -87,27 +99,39 @@ check("THE GRAMMAR EXISTS: principles are stated in globals.css", () => { } }); -check("PRINCIPLE 7: arbitrary values never increase", () => { +check("PRINCIPLE 7: no arbitrary COLOUR or TYPOGRAPHY, at any count", () => { + const files = walk(join(ROOT, "src/components")); + const offenders: string[] = []; + for (const file of files) { + const hits = readFileSync(file, "utf8").match(VISUAL_ARBITRARY) ?? []; + if (hits.length > 0) offenders.push(`${file.replace(ROOT + "/", "")}: ${hits.join(", ")}`); + } + assert( + offenders.length === 0, + `a colour or size was typed instead of using a token:\n ${offenders.join("\n ")}`, + ); +}); + +check("PRINCIPLE 7: one-off LAYOUT values are held, never grown", () => { const files = walk(join(ROOT, "src/components")); const offenders: string[] = []; let count = 0; for (const file of files) { - const hits = readFileSync(file, "utf8").match(ARBITRARY) ?? []; + const hits = readFileSync(file, "utf8").match(LAYOUT_ARBITRARY) ?? []; if (hits.length > 0) { count += hits.length; offenders.push(`${file.replace(ROOT + "/", "")}: ${hits.join(", ")}`); } } assert( - count <= ARBITRARY_BASELINE, - `arbitrary values rose to ${count} (baseline ${ARBITRARY_BASELINE}). ` + - `Add the value to globals.css and name it instead:\n ${offenders.join("\n ")}`, + count <= LAYOUT_ARBITRARY_BASELINE, + `one-off layout values rose to ${count} (baseline ${LAYOUT_ARBITRARY_BASELINE}). ` + + `The spec permits these for constraints with no semantic meaning — but if it ` + + `recurs, name it in globals.css:\n ${offenders.join("\n ")}`, ); - // Ratchet: when the count falls, the baseline must come down with it, or the - // gate quietly re-permits what was just cleaned up. assert( - count >= ARBITRARY_BASELINE - 2 || count === 0, - `arbitrary values fell to ${count} — lower ARBITRARY_BASELINE to ${count} in this file so the ground gained is held`, + count >= LAYOUT_ARBITRARY_BASELINE - 2 || count === 0, + `layout arbitraries fell to ${count} — lower LAYOUT_ARBITRARY_BASELINE to ${count} so the ground gained is held`, ); }); diff --git a/src/app/globals.css b/src/app/globals.css index e3435aecd..72f9715df 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -3096,6 +3096,25 @@ .ui-health-chip-interactive { @apply transition-colors hover:border-border-default hover:bg-surface-raised; } + /* In a LIST the chip is not a chip. + Principle 3 (space separates, boxes are a last resort) and principle 2 + (emphasis belongs to alarms): a bordered pill on every row was the only + boxed thing in the rail, so it pulled the eye harder than the flag count + beside it — the one thing on the page that is actually an alarm. It also + kept 8px of column jitter, because a pill's width follows its text. + Plain tabular text, full cell width, right-aligned: the column edge is + then exact and the number is as quiet as the date next to it. It is still + a button and still opens the breakdown. */ + /* The scroll-affordance chevron sits ON content, so it needs a halo in the + page colour to stay legible over text. Named here because CLAUDE.md's + four-layer spec forbids `shadow-[var(--*)]` in JSX: a visual decision + belongs in this file even when its value is already a token. */ + .ui-scroll-affordance-glyph { + filter: drop-shadow(0 0 4px var(--surface-page)); + } + .ui-health-chip-compact { + @apply w-full justify-end rounded-none border-0 bg-transparent px-0 py-0 hover:bg-transparent; + } .ui-health-label { @apply text-micro font-semibold uppercase tracking-caps text-text-tertiary; } diff --git a/src/components/projects/HealthScore.tsx b/src/components/projects/HealthScore.tsx index 9154d746b..5ea3f8df4 100644 --- a/src/components/projects/HealthScore.tsx +++ b/src/components/projects/HealthScore.tsx @@ -230,7 +230,9 @@ export function HealthScoreBar({