Skip to content

fix(design-system): four utility classes name tokens the theme never declares - #187

Merged
sydevs-bot merged 8 commits into
mainfrom
claude/fix-176-dead-tokens
Oct 14, 2026
Merged

sydevs-bot merged 8 commits into
mainfrom
claude/fix-176-dead-tokens

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • font-raleway, text-gray-dark and border-gray-light named no declared token, so each emitted no CSS; two of them were visible, not one.
  • tailwind.config.ts is gone, and a guard now fails a colour utility on a numeric scale, or any font-*, that names a token neither our @theme nor 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 — LeafSvg fills with currentColor, so the ornament took the inherited colour just as the rule did.

Behaviour — what LeafDivider resolves to inside coloured text

 <div role="separator">                              components/atoms/LeafDivider/LeafDivider.tsx
   the rule                                          border-t + border-gray-???
-    rgb(220, 20, 60)  # the inherited text colour: v4 defaults border-color to currentColor
+    rgb(235, 235, 235)  # gray-200, the Border role
   the leaf                                          <LeafSvg fill="currentColor">
-    rgb(220, 20, 60)  # the same inheritance, through the SVG fill
+    rgb(123, 123, 123)  # gray-700, as Svgs.stories.tsx already colours this SVG

HeroQuote's blockquote and the LeafDivider story paragraphs are body copy, so they take 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 sets, and gray-900 measures 7.46:1. At size="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

 layouts/tailwind.css          # @theme: the only theme. @source: three of the scanned paths
-tailwind.config.ts            # loaded by nothing — v4 reads a config only through @config
 tests/guards/
   _source-scan.ts             # + the stylesheet read, so two guards cannot disagree on its path
   design-tokens.test.ts       # unchanged job: DESIGN_SYSTEM.md's tables match @theme
+  theme-utilities.test.ts     # colour-scale and font-* utilities in the @source dirs, specs aside

The guard reads both @theme blocks — ours and tailwindcss/theme.css — because @theme extends the default rather than replacing it. Our --color-gray-50..900 override nine of upstream's ten grey steps and leave gray-950 resolving, 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 like text-slate-77 was 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-light beside the declared error-dark — and the radius and shadow namespaces pass unchecked. docs/rules/tailwind.md and 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 @source dirs, where _source-scan.ts strips 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.

Both first deployed from 2e3a546 at 14:07Z. The two commits since touch tests/guards/ and docs/rules/ only, so neither changes a byte of emitted CSS or rendered markup. Nothing to seed: both previews read published SahajCloud content, and LeafDivider and HeroQuote both have Ladle stories.

Test results

  • Lean gate: ✓ .claude/skills/pr-prep/check.sh — lint (0 errors), tsc --noEmit, 853 tests in 85 files
  • Targeted specs: 26 passed across tests/guards/ (6 new)
  • Build: ✓ pnpm build, and pnpm ladle:build for the browser check below

Manual verification

The ticket's checklist, run rather than eyeballed. Repeat any of it with pnpm build and pnpm ladle:build.

  1. grep -rn 'font-raleway\|gray-dark\|gray-light' --include='*.tsx' components layouts pages returns nothing.
  2. In the built stylesheet, Raleway appears exactly once, as --font-sans: "Raleway", sans-serif, and only .font-sans references it.
  3. Served the Ladle build and forced the text around atoms--leaf-divider to rgb(220, 20, 60). Computed styles: rule rgb(235, 235, 235), leaf rgb(123, 123, 123). Removing the two new classes in the same page returns both to rgb(220, 20, 60) — the pre-fix state, since the undeclared classes emitted nothing at all.
  4. Reintroducing border-gray-light fails the new guard at LeafDivider.tsx:39, by file and line.
  5. Appending border-gray-light to a component spec fails the guard on the old glob and passes on the new one, which is what the spec filter buys.
  6. Against both parsed themes, error-light, grey-700, rounded-pill and shadow-brand are each flagged by nothing — the boundary the docs now state.

Worth a reviewer's eye: whether gray-700 is the ornament colour you want. It matches Svgs.stories.tsx:29, the only other place this SVG is coloured, and keeps the leaf clearly darker than the rule as gray-dark/gray-light intended — but it is a design call, not a derivation.

Notes for reviewer

font-sans is a no-op, deliberately. v4's preflight already points html at --font-sans, so the five replaced classes restate the default rather than changing it. A reviewer suggested deleting them instead. Kept, because font-sans is a declared utility that states the family a call site means and survives a change to --default-font-family, where font-raleway stated nothing at all.

Filed on the way: #186. @source is not the whole scan set — @import "tailwindcss" also detects sources from the project root, so a class-shaped string in tests/ 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.ts strips 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-raleway would be a second spelling of --font-sans. gray-dark and gray-light have 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 scale docs/rules/design-system.md requires.

tailwind.config.ts was dead in full, not only in the theme.extend block its own JSDoc admitted to. No @config directive exists anywhere, and nothing imported the file, so its content array scanned nothing either. Five docs described it; all five now describe the stylesheet, and the @config requirement 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\/80 and .border-gray-200\! into production CSS, and an example in docs/rules/tailwind.md was compiling .text-gray-950.

Widening the guard is not folded in here. A namespace-by-namespace check needs a rule per namespace — radius, shadow and text each take bare keywords as well as tokens, and --color-bg-warm makes bg look 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: /simplify across four lenses (reuse, simplification, efficiency, altitude) and the comment lint. /security-review skipped — no path matches securityReview.triggerPattern. pr-review-toolkit is not installed here.

Closes #176

🤖 Generated with Claude Code

https://claude.ai/code/session_01EieCB4i12q5W2NV9zKtPB4

…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
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying wemeditate-design with  Cloudflare Pages  Cloudflare Pages

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

View logs

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 13, 2026
@sydevs-bot

sydevs-bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 15:32Z resolve-conflicts · attempt 1 · session · done
  • 15:32Z resolve-conflicts · attempt 1 · session
  • 14:18Z address-review · attempt 1 · session · done
  • 14:18Z address-review · attempt 1 · session
  • 14:08Z review-pr · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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 sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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 stayed in_progress and published no alias. Both check runs concluded success at 14:07Z, the Cloudflare bot posted the Ladle alias at 14:07:06Z, and both smoke jobs passed against discovered previews. The body also cites in_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 the gray-700 call gets judged.
  • should-fix — docs/rules/tailwind.md:27 claims the guard catches any undeclared token. It catches two families.
  • consider — theme-utilities.test.ts:118 scans *.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-dark and gray-light are absent, raleway appears 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. Pinning gray-900 is safe. LeafDivider already hard-codes bg-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

Comment thread docs/rules/tailwind.md Resolved
Comment thread tests/guards/theme-utilities.test.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 13, 2026
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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

All three findings adopted. Pushed 108ad28.

  • ## Preview — both aliases were live at 14:07Z. The body now links them and both answer 200. The old section cited in_progress at 14:29Z, after this PR's own 14:06Z creation; reporting that, not explaining it.
  • tailwind.md:27 — 108ad28. The doc, the guard's header and findDeadUtilities's JSDoc now name the two families and say the rest is unwatched.
  • theme-utilities.test.ts:118 — 613b081. The glob strips .test.ts(x): 42 specs out, stories in.

Widening the reach joined #186 as Part 2 — five classes that emit no CSS and are flagged by nothing.

Lean gate green: lint, tsc --noEmit, 853 tests in 85 files.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 13, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 13, 2026 14:33
@sydevs-bot
sydevs-bot requested a review from Ardnived October 13, 2026 14:33
@sydevs-bot
sydevs-bot enabled auto-merge October 13, 2026 14:33
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed awaiting labels Oct 13, 2026
#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
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main in. One conflict, in Splash's <h1>: #188 deleted the textColor prop this branch's line interpolated, so neither side stood alone — taking this branch's would have left an undefined variable. Kept both halves, font-sans from here and text-fg from #188.

The new utility guard needed no change for #188's @theme inline block: it declares no token on a numeric scale, and the guard reads the whole stylesheet rather than one @theme block.

Lean gate green on the merge head — lint 0 errors, tsc clean, 873 tests in 88 files. The test counts and preview notes above predate the merge.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 13, 2026
@sydevs-bot sydevs-bot moved this from Revising to Approved in SYDevelopers Technical Roadmap Oct 14, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 8209bed Oct 14, 2026
25 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-176-dead-tokens branch October 14, 2026 16:13
@sydevs-bot sydevs-bot moved this from Approved to Done in SYDevelopers Technical Roadmap Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(components): four utility classes name tokens the theme never declares

3 participants