Skip to content

refactor(office): map the 364 literal styling sites in features/office onto the tokens (#820) - #945

Merged
thinkclay merged 12 commits into
mainfrom
refactor/820-office-tokens
Oct 2, 2026
Merged

thinkclay merged 12 commits into
mainfrom
refactor/820-office-tokens

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #820. Second item of release 4 (#939), after #819 put the ratchet in place.

364 literal styling sites in packages/scf-core/features/office onto the tokens, one commit per sub-directory. office now holds no literal fontSize, borderRadius or hex colour, and its ceilings leave the ratchet baseline entirely — which is how the ratchet expresses "held at zero".

Before After
fontSize 219 0
borderRadius 118 0
hex 27 0
tree-wide 693 / 637 / 273 575 / 418 / 246

The issue's radius map would have broken 16 things

#820 prescribes radius.lg for everything from 7 to 16. But 16 of the radius sites are circles and pills, where the radius is deliberately half the box:

width: 28, height: 28, borderRadius: 14     ← icon bubble
width: 64, height: 64, borderRadius: 32     ← confirmation badge
height: 6,             borderRadius: 3      ← progress track
width: 8,  height: 8,  borderRadius: 4      ← status dot

Mapping those to 7px turns every avatar, status dot and progress bar in office into a rounded square. They are detected by checking whether the radius is exactly half a width or height in the same style block, and go to borderRadius.max instead, which holds the shape at any size.

I hand-read all 18 the first detector flagged, which is how I found that two of them were false positives — borderRadius={8} on a badge whose only nearby number was an icon's size={16}. Narrowing the rule to width/height only (never a size prop) gives exactly the 16 real ones.

Two other places the issue's instructions don't survive contact:

  • radius.sm is 4, not 2. The issue says "radius.sm (≤3)", which would double every 2px radius. The file even says so: sm: borderRadius.s, // 4 — interface step 1 is xxxs (2).
  • borderRadius.* is the house idiom, not radius.*. packages/ui components use borderRadius.* 122 times against radius.* twice.

The hex pass was not mechanical

27 sites, split three ways:

  • Categorical → a named ramp step. The EEO chart's eight race/ethnicity colours and the four project-status badge pairs are decorative. Every one turned out to be an exact Tailwind value the ramps already carry, so blue[500], indigo[500], violet[500], pink[500], amber[500], emerald[500] and the 100/800 pairs are literal no-ops. The four cool greys have no exact token and go to the nearest zinc step, which holds the hue — the warm gray ramp would have shifted it.
  • Semantic → a theme token. The fill bar and member status dot signal completion, so colors.fg[theme].success / .active / .warning, which is already the idiom three lines away in the same file.
  • Inverse text → and five of these were latent dark-mode bugs. '#fff' over colors.fg[theme].active is white on #3fb5c7 in dark mode: roughly 1.9:1, failing AA. Those become colors.text[theme].quaternary, which flips with the fill. Nobody could see this because dark mode is hard-off until feat(theme): re-enable dark mode behind a dev toggle, add the dark smoke pass, audit the redesign tokens in dark #833. The sixth '#fff' sits on a fixed categorical colour that doesn't flip, so it becomes colors.white rather than the flipping token.

A test-infrastructure bug this surfaced — #944

Using colors.zinc[500], a real token, killed the EEOReportScreen suite on import:

TypeError: Cannot read properties of undefined (reading '500')
 ❯ EEOReportScreen.tsx:80   two_or_more: colors.zinc[500],

vitest.config.ts aliases @scaffald/ui/tokens to a hand-maintained mock that has drifted in both directions: its borderRadius is still the pre-#621 scale (xs 6, s 8, l 12, xl 16 instead of 2 / 4 / 7), and it carries a slate ramp the real tokens don't have — so colors.slate[...] passes every test and is undefined in the app. Added zinc and recorded both divergences in the file; filed #944 to stop hand-maintaining the surface.

Verification

  • scf-core:typecheck clean. The first run failed on @scaffald/sdk exports — that was the stale submodule dist, not this change; green after building it.
  • 1267 tests passing, 0 failures, same count as before the change. Includes the 13 EEOReportScreen tests and the office/applications suites from test(scf-core): 12 office/applications tests fail on main — Lane columns render as raw objects #661.
  • The ratchet holds office at zero, proven rather than assumed — added one fontSize: 13 to office-overview.tsx:
    office — fontSize: 1, held at zero
        1  packages/scf-core/features/office/office-overview.tsx  <- changed in this branch
    
  • pnpm prepush green.

One acceptance box is unticked. The issue asks for before/after captures of /office/applications, /office/ats/metrics and /office/cms/jobs. Those are protected routes needing a signed-in office user, which needs a local Supabase, which needs Docker — and the Docker daemon isn't running on this machine. I have not pretended otherwise. What I attached instead is a token-delta reference rendering the before/after values at real size, and the measured deltas are:

  • Radius is the visible half — 63 of 118 sites get squarer corners, the largest being 27 sites going 16px → 7px. That is the prototype's intent, not a side effect.
  • Type barely moves — nothing shifts by more than 2px; the big clusters are 13 → 12.5 (63 sites) and 12 → 12.5 (50).
  • No circles broken, no size increase beyond +2px.

Happy to run the real captures when Docker is up — say the word and I'll do it before this merges.

🤖 Generated with Claude Code

thinkclay and others added 12 commits October 2, 2026 13:14
72 fontSize and 40 borderRadius literals in office/applications.

Seven of the radius sites are circles and pills, not rounded rectangles:
`width: 28, height: 28, borderRadius: 14` is an icon bubble, and `height: 6,
borderRadius: 3` is a progress bar. Those go to borderRadius.max, which holds
the shape at any size. The issue's map would have sent them to radius.lg (7)
and turned every status dot and avatar in the pipeline into a rounded square.

Co-Authored-By: Claude Opus 5 <[email protected]>
59 fontSize and 10 borderRadius literals, concentrated in two screens.
Three radius sites are circles — the 64x64 confirmation badge in
SelfScheduleScreen was `borderRadius: 32`, which is a circle, not a large
corner radius. It goes to borderRadius.max.

Co-Authored-By: Claude Opus 5 <[email protected]>
43 fontSize and 9 borderRadius literals. The HRIS stat numbers were
`fontSize: 24`, which snaps to fontSize.xl (22).

Co-Authored-By: Claude Opus 5 <[email protected]>
42 fontSize and 7 borderRadius literals, all in EEOReportScreen. Its 10px
chart labels snap up to fontSize.xxs (11), the floor of the scale.

Co-Authored-By: Claude Opus 5 <[email protected]>
25 borderRadius and 2 fontSize literals across 15 files. This is the
directory where the 16px and 12px corners were most common; they become
borderRadius.l (7), which is the visible part of this change.

Co-Authored-By: Claude Opus 5 <[email protected]>
9 borderRadius literals, no type literals — teams was already using the
primitives for text.

Co-Authored-By: Claude Opus 5 <[email protected]>
3 borderRadius literals.

Co-Authored-By: Claude Opus 5 <[email protected]>
2 borderRadius literals.

Co-Authored-By: Claude Opus 5 <[email protected]>
9 borderRadius and 1 fontSize literal across the loose screens. Four of the
radius sites are the CCPA timeline's 8x8 status dots, which are circles and
go to borderRadius.max.

With this, office holds no literal fontSize or borderRadius at all. The 27
hex colours are next and are not mechanical.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ts drift

`@scaffald/ui/tokens` is aliased to this mock for every vitest run, so a token
that exists in packages/ui but not here reads as `undefined` at module scope
and fails the whole suite on import — with a stack that points at the feature
file, not at the mock. Reaching for `colors.zinc[500]`, which is a real token,
is what surfaced it.

Two divergences found while fixing it, both noted in the file:

- `borderRadius` in the mock is the PRE-#621 scale (xs 6, s 8, l 12, xl 16).
  The real interface scale has been 2 / 4 / 7 since the tokens landed. Nothing
  asserts on those values, which is the only reason it has gone unnoticed.
- `slate` exists in the mock and NOT in the real tokens, where the ramp is
  `zinc`. So `colors.slate[...]` passes every test and crashes the app.

Co-Authored-By: Claude Opus 5 <[email protected]>
Not mechanical — each site needed reading, and they split three ways.

**Categorical, so a named ramp step.** EEOReportScreen's eight race/ethnicity
chart colours and ProjectHiringScreen's four status badge pairs are decorative
category colours with no semantic meaning. Every one of them turned out to be
an exact Tailwind value that the ramps already carry, so blue[500],
indigo[500], violet[500], pink[500], amber[500], emerald[500] and the 100/800
badge pairs are literal no-ops. The four cool greys (#64748b, #94a3b8,
#e5e7eb, #374151) have no exact token and go to the nearest zinc step, which
holds the hue; the warm `gray` ramp would have shifted it.

**Semantic, so a theme token.** The project fill bar and the member status dot
signal completion and progress, so they become colors.fg[theme].success /
.active / .warning — which is already the idiom three lines away in the same
file.

**Inverse text, and five of these were latent dark-mode bugs.** `'#fff'` over
`colors.fg[theme].active` is white-on-light-teal in dark mode: fg.dark.active
is #3fb5c7, so the literal was failing AA wherever it sat on a themed fill.
Those five become colors.text[theme].quaternary, which flips with the fill.
Nobody could see this because dark mode is hard-off until #833. The sixth
`'#fff'` sits on a fixed categorical chart colour that does not flip, so it
becomes colors.white rather than the flipping token.

office now holds no literal fontSize, borderRadius or hex colour.

Co-Authored-By: Claude Opus 5 <[email protected]>
The office entries leave the baseline entirely rather than going to 0, which
is how the ratchet expresses "held at zero" — a directory absent from the
ceilings map fails on its first literal. Verified by adding one `fontSize: 13`
to office-overview.tsx:

    office — fontSize: 1, held at zero
        1  packages/scf-core/features/office/office-overview.tsx  <- changed in this branch

Tree-wide: borderRadius 693 -> 575, fontSize 637 -> 418, hex 273 -> 246.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay merged commit 957f0c8 into main Oct 2, 2026
10 checks passed
@thinkclay
thinkclay deleted the refactor/820-office-tokens branch October 2, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(office): map 240 literal font sizes and the radii in features/office onto the tokens

1 participant