fix(design): the health value stops being the only boxed thing on the row (#852)

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) <noreply@anthropic.com>
This commit is contained in:
CatoandClaude Opus 5 authored and GitHub committed 2026-09-22 10:38:06 -07:00
1 parent 0f62687a9d
commit 91eeb2cddc
4 files changed
+62 -17

No files matched your search

+39 -15
View File
@@ -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`,
);
});
+19
View File
@@ -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;
}
+3 -1
View File
@@ -230,7 +230,9 @@ export function HealthScoreBar({
<button
type="button"
onClick={() => setOpen((v) => !v)}
className="ui-health-chip ui-health-chip-interactive"
className={`ui-health-chip ui-health-chip-interactive${
compact ? " ui-health-chip-compact" : ""
}`}
aria-expanded={open}
aria-label={`Health ${score} of ${health.max}${missing > 0 ? `, ${missing} outstanding` : ""} — show the breakdown`}
>
+1 -1
View File
@@ -38,7 +38,7 @@ export function ScrollAffordance({
aria-hidden
className="pointer-events-none absolute inset-y-0 right-0 z-10 flex items-center pr-1 text-text-tertiary sm:hidden"
>
<ChevronRight className="h-4 w-4 drop-shadow-[0_0_4px_var(--surface-page)]" />
<ChevronRight className="ui-scroll-affordance-glyph h-4 w-4" />
</span>
)}
</div>