Repository navigation
fix(design-system): four utility classes name tokens the theme never declares - #187
Conversation
…r declared `font-raleway`, `text-gray-dark` and `border-gray-light` name no token in `layouts/tailwind.css`, so Tailwind emitted no rule for any of them. Two of the three changed what a visitor saw. `border-gray-light` sits on `LeafDivider`'s `border-t`, and v4 changed the default border colour from `gray-200` to `currentColor`, so the divider line drew in the inherited text colour. It is now `border-gray-200` — the Border role in `DESIGN_SYSTEM.md`, the colour its own documented pattern in `docs/rules/design-system.md` already shows, and what 52 other rules use. `text-gray-dark` was visible too, which the ticket did not expect: `LeafSvg` fills with `currentColor`, so the ornament took the inherited colour as well. The leaf is now `text-gray-700`, matching the only other place the same SVG is coloured (`Svgs.stories.tsx:29`), and staying clearly darker than the line as `gray-dark`/`gray-light` intended. `HeroQuote`'s blockquote and the `LeafDivider` story paragraphs are body copy, so they take `text-gray-900` rather than the `gray-700` of the Body text role. `gray-700` measures 4.23:1 on white, under the 4.5:1 that DESIGN_SYSTEM.md's accessibility table requires; `gray-900` measures 7.46:1. `HeroQuote` at `size="md"` renders at 16-18px, so the large-text 3:1 allowance does not cover it. #179 proposes the same move for the role itself. `font-raleway` is the one no-op: `--font-sans` is Raleway and v4's preflight already applies it to `html`, so `font-sans` restates the default rather than changing it. Kept over deleting the class so each call site still states the family it means. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4
`tailwind.config.ts` was dead in full, not only in the `theme.extend` block its own JSDoc admitted to. Tailwind v4 reads a config file only through an `@config` directive; `grep -rn '@config'` finds none here, and nothing imported the file, so its `content` array scanned nothing either. Its JSDoc claimed it "only sets content paths", which was the misreading the file itself created: the scan set is the `@source` lines in `layouts/tailwind.css`. Five docs described it, and all five now describe the stylesheet instead. `docs/rules/tailwind.md` drops the deleted path from its `paths:` frontmatter, so the rule still loads on `layouts/*.css`. The `@config` requirement stays in both guides — it is what stops the next reader adding a config file back and expecting it to be read. `DESIGN_SYSTEM.md`'s typography table also listed `font-raleway` beside `font-sans` as if both resolved. Only `font-sans` ever did. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4
The four dead classes this ticket removed survived a year because nothing could see them: a utility naming an undeclared token compiles to no CSS, and neither the build, the linter nor the suite says a word. A grep closes them once; it does not stop the fifth. `tests/guards/theme-utilities.test.ts` reads the `@source` lines and the `@theme` block out of `layouts/tailwind.css`, so it covers exactly what Tailwind covers and needs no second copy of either list. Colours are matched by scale rather than by utility prefix — `gray-dark` names a declared scale and an undeclared step — which is what lets one check cover `text-`, `border-`, `ring-offset-` and whatever comes next without an allowlist to keep current. Fonts need a closed allowlist instead, since `font-` spans families, weights and `stretch-`, so the set is the declared `--font-*` and `--font-weight-*` tokens plus Tailwind's own. The detector is exported and exercised on a fixture carrying all three removed classes, so the tree scan cannot pass by matching nothing. Reintroducing `border-gray-light` fails it at `LeafDivider.tsx:39`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4
…as ours The guard rejected `text-gray-950`, which renders. `@theme` extends Tailwind's default theme rather than replacing it, so our `--color-gray-50`..`900` override nine of upstream's ten grey steps and leave `gray-950` resolving from `tailwindcss/theme.css`. Compiling `text-gray-950 text-red-500 text-gray-dark` through the v4 CLI emits rules for the first two and nothing for the third. So the declared set is both `@theme` blocks, read with one parser. That also retires the hand-written list of Tailwind's own families and weights, which a version bump would have turned into a false positive with nothing pointing at the cause, and closes the opposite hole: the 26 upstream scales are now checked too, where before a typo in `text-slate-77` was invisible. Zero offences across the 319 files in the scan set. `findDeadUtilities` takes one hoisted alternation over the scales instead of a fresh regex per scale per file, and the stylesheet read moves to `_source-scan.ts` so this guard and `design-tokens.test.ts` cannot disagree about where the theme lives. Nothing in the file spells a working utility outright any more. Tailwind's automatic source detection reads `tests/` too, so the fixtures were compiling `.bg-teal-500\/80` and `.border-gray-200\!` into the CSS every page loads. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4
Deleting `tailwind.config.ts` left the same explanation written out in three files. `docs/rules/tailwind.md` is the path-scoped rule and keeps it; `DESIGN_SYSTEM.md` and the stylesheet header keep the one sentence a reader acts on and point there. Two of the three also said the `@source` lines are the scan set. They are not. `@import "tailwindcss"` detects sources from the project root as well, and `@source` adds to that set rather than replacing it — which is how a fixture in `tests/` compiled `.bg-teal-500\/80` into the CSS every page loads, and how an example in this rule compiled `.text-gray-950`. Hence the odd-looking habit of spelling an example utility without its prefix. #186 weighs narrowing the set with `source(none)`; the measurement is there. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4
Deploying wemeditate-design with
|
| Latest commit: |
38aad9a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f9f28d42.wm-design.pages.dev |
| Branch Preview URL: | https://claude-fix-176-dead-tokens.wm-design.pages.dev |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 38aad9a | Commit Preview URL Branch Preview URL |
Oct 13 2026, 03:41 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The fix is the size of #176: five font-raleway sites, four grey sites, one dead config deleted, five docs corrected. Nothing is smuggled in.
The one thing the ticket did not ask for is theme-utilities.test.ts, 132 lines of permanent guard. The measured harm earns it — four classes compiled to nothing and two were visible. #186's docs half rides along at docs/rules/tailwind.md:21-25, docs-only, so fine.
No contract surface is touched. The gray-700 leaf is the one open design call, and the body flags it as one.
Findings
- should-fix — PR body
## Preview, no inline thread fits. It says both builds stayedin_progressand published no alias. Both check runs concludedsuccessat 14:07Z, the Cloudflare bot posted the Ladle alias at 14:07:06Z, and both smoke jobs passed against discovered previews. The body also citesin_progress at 14:29Z, after its own 14:06:05Z creation. Fill in https://claude-fix-176-dead-tokens.wm-design.pages.dev — that page is where thegray-700call gets judged. - should-fix —
docs/rules/tailwind.md:27claims the guard catches any undeclared token. It catches two families. - consider —
theme-utilities.test.ts:118scans*.test.ts(x), which the sibling helper strips on purpose.
What was checked
- #176 against the diff, file by file, 15 files.
- The live Ladle alias. In the built CSS,
gray-darkandgray-lightare absent,ralewayappears once as--font-sans, and all three replacement utilities emit. - Both guard files whole, against
layouts/tailwind.css. HeroQuote's only caller,blockConverters.tsx:178. Pinninggray-900is safe.LeafDivideralready hard-codesbg-white, so the block was white-background-only before this PR.- A scale-prefix grep over
components pages layouts. The four dead classes are its only hits.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The guard globbed every `.ts(x)` under the `@source` dirs, so the 42 specs there were in scope while `_source-scan.ts` strips specs for every other guard. A spec testing #176's bug spells a dead class in a fixture on purpose, and that fixture failed the guard — proved by appending `border-gray-light` to a component spec, which fails on the old glob and passes on the new one. Stories stay in scope. That divergence is deliberate and now the only one. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DpjWvVqNjEd6ihiQuZfCeA
The guard was described as catching any utility that names an undeclared token. It checks two families: a colour token on a scale with numeric steps, and `font-*`. Measured against both themes, `error-light`, `grey-700`, `rounded-pill` and `shadow-brand` are all flagged by nothing. The wide claim read as coverage the next reader would rely on. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DpjWvVqNjEd6ihiQuZfCeA
|
All three findings adopted. Pushed
Widening the reach joined #186 as Part 2 — five classes that emit no CSS and are flagged by nothing. Lean gate green: lint, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#188 landed the surface-token refactor, which rewrote the one line this branch also changed: `Splash`'s `<h1>`. Both sides are kept. This branch replaced the dead `font-raleway` with `font-sans`; `main` replaced the `${textColor}` prop with the `text-fg` surface token and deleted the prop, so taking either side alone would drop a fix or leave an undefined variable. The className is now a plain string, since nothing is interpolated into it any more. Every other file auto-merged. `@theme inline`, which #188 adds for the surface tokens, needs no change to the new utility guard: it declares no token on a numeric scale, and the guard already reads the whole stylesheet rather than one `@theme` block. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D5B9zSNF2QsmUZVE9oT5Wx
|
Merged The new utility guard needed no change for #188's Lean gate green on the merge head — lint 0 errors, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
font-raleway,text-gray-darkandborder-gray-lightnamed no declared token, so each emitted no CSS; two of them were visible, not one.tailwind.config.tsis gone, and a guard now fails a colour utility on a numeric scale, or anyfont-*, that names a token neither our@themenor Tailwind's declares.Change outline
The ticket expected one visible class. Measured in Chromium against the built stylesheet, with the surrounding text forced to crimson, both colour classes were visible —
LeafSvgfills withcurrentColor, so the ornament took the inherited colour just as the rule did.Behaviour — what
LeafDividerresolves to inside coloured textHeroQuote's blockquote and theLeafDividerstory paragraphs are body copy, so they takegray-900rather than thegray-700of the Body text role:gray-700measures 4.23:1 on white, under the 4.5:1 thatDESIGN_SYSTEM.md's accessibility table sets, andgray-900measures 7.46:1. Atsize="md"the quote renders at 16–18px, so the large-text 3:1 allowance does not cover it. #179 proposes the same move for the role itself.Files — where the theme is defined, and what holds utilities to it
The guard reads both
@themeblocks — ours andtailwindcss/theme.css— because@themeextends the default rather than replacing it. Our--color-gray-50..900override nine of upstream's ten grey steps and leavegray-950resolving, so checking against ours alone rejected a utility that renders. Reading both also means no hand-copied list of Tailwind's defaults to rot on a version bump, and the 26 upstream scales get checked too, where a typo liketext-slate-77was previously invisible.Its reach is two families, not every utility: a colour token on a scale with numeric steps, and
font-*. A token off such a scale —error-lightbeside the declarederror-dark— and theradiusandshadownamespaces pass unchecked.docs/rules/tailwind.mdand the guard's header both name that boundary, so neither reads as coverage it does not give.Specs are out of its file list. The glob took the 42
*.test.ts(x)files under the@sourcedirs, where_source-scan.tsstrips specs for every other guard — so a spec whose fixture spells a dead class, the obvious way to test this bug, failed the guard. Stories stay in scope, and are now the only deliberate divergence from that helper.Preview
Both branch aliases follow this branch's head and answer 200.
atoms--leaf-dividerand theHeroQuotestories are where thegray-700call gets judgedBoth first deployed from
2e3a546at 14:07Z. The two commits since touchtests/guards/anddocs/rules/only, so neither changes a byte of emitted CSS or rendered markup. Nothing to seed: both previews read published SahajCloud content, andLeafDividerandHeroQuoteboth have Ladle stories.Test results
.claude/skills/pr-prep/check.sh— lint (0 errors),tsc --noEmit, 853 tests in 85 filestests/guards/(6 new)pnpm build, andpnpm ladle:buildfor the browser check belowManual verification
The ticket's checklist, run rather than eyeballed. Repeat any of it with
pnpm buildandpnpm ladle:build.grep -rn 'font-raleway\|gray-dark\|gray-light' --include='*.tsx' components layouts pagesreturns nothing.--font-sans: "Raleway", sans-serif, and only.font-sansreferences it.atoms--leaf-dividertorgb(220, 20, 60). Computed styles: rulergb(235, 235, 235), leafrgb(123, 123, 123). Removing the two new classes in the same page returns both torgb(220, 20, 60)— the pre-fix state, since the undeclared classes emitted nothing at all.border-gray-lightfails the new guard atLeafDivider.tsx:39, by file and line.border-gray-lightto a component spec fails the guard on the old glob and passes on the new one, which is what the spec filter buys.error-light,grey-700,rounded-pillandshadow-brandare each flagged by nothing — the boundary the docs now state.Worth a reviewer's eye: whether
gray-700is the ornament colour you want. It matchesSvgs.stories.tsx:29, the only other place this SVG is coloured, and keeps the leaf clearly darker than the rule asgray-dark/gray-lightintended — but it is a design call, not a derivation.Notes for reviewer
font-sansis a no-op, deliberately. v4's preflight already pointshtmlat--font-sans, so the five replaced classes restate the default rather than changing it. A reviewer suggested deleting them instead. Kept, becausefont-sansis a declared utility that states the family a call site means and survives a change to--default-font-family, wherefont-ralewaystated nothing at all.Filed on the way: #186.
@sourceis not the whole scan set —@import "tailwindcss"also detects sources from the project root, so a class-shaped string intests/or in a Markdown file ships its CSS. Two docs said otherwise and now say what happens. Not folded in here:source(none)changes what the build emits, and silently dropping CSS is a different risk from deleting a file nothing reads. Measured at ~1.5 KB unminified.Why the guard keeps its own file list.
sourceFiles()in_source-scan.tsstrips stories as well as specs, and two of this ticket's four call sites were stories, which Ladle renders. So the guard globs for itself and strips specs only.Detail
Why not declare the missing tokens instead.
--font-ralewaywould be a second spelling of--font-sans.gray-darkandgray-lighthave no value anywhere in the repo's history — not in the deleted config, whose gray ran 50–900 — so declaring them means inventing two hexes outside the numeric scaledocs/rules/design-system.mdrequires.tailwind.config.tswas dead in full, not only in thetheme.extendblock its own JSDoc admitted to. No@configdirective exists anywhere, and nothing imported the file, so itscontentarray scanned nothing either. Five docs described it; all five now describe the stylesheet, and the@configrequirement stays in both guides as the thing that stops the next reader adding one back.The guard's own fixtures are assembled from fragments so the scanner finds no new candidate in them. Before that, the test file was compiling
.bg-teal-500\/80and.border-gray-200\!into production CSS, and an example indocs/rules/tailwind.mdwas compiling.text-gray-950.Widening the guard is not folded in here. A namespace-by-namespace check needs a rule per namespace —
radius,shadowandtexteach take bare keywords as well as tokens, and--color-bg-warmmakesbglook like a colour family — so it is a design question, not a typo fix. It joined #186 as Part 2 rather than growing inside #176.Review passes run:
/simplifyacross four lenses (reuse, simplification, efficiency, altitude) and the comment lint./security-reviewskipped — no path matchessecurityReview.triggerPattern.pr-review-toolkitis not installed here.Closes #176
🤖 Generated with Claude Code
https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4