Skip to content

fix: site-tokens - Clean font family names and add the accent and monospace roles - #4014

Merged
ZaredRogers merged 55 commits into
fix/git-2760-site-tokens-content-widthfrom
fix/git-2761-site-tokens-font-roles
Nov 11, 2026
Merged

ZaredRogers merged 55 commits into
fix/git-2760-site-tokens-content-widthfrom
fix/git-2761-site-tokens-font-roles

Conversation

@ZaredRogers

Copy link
Copy Markdown
Contributor

Bugfix Pull Request

This repository enforces changelog, release, and label automation for all PRs and issues.
See the organisation-wide Automation Governance & Release Strategy for required rules.

Linked issues

Fixes #4007

Linear: GIT-2761

Context

Reproduction

  • Steps: 1) Run the proposer on the live TSP site. 2) Read the fonts line of the report.
  • Expected vs Actual: Expected heading Moret, body Argesta Display, plus accent and monospace. Got "headings moret, body argesta_displayregular" and no other roles.

Root Cause

  • The crawler kept only the first raw family name, and the proposer produced just heading and body strings.

Fix Summary

  • The crawler also records the full computed font stack.
  • Names are cleaned: weight and style suffixes dropped (regular, bold, italic), underscores to spaces, lower-case words title-cased. The stack stays exact.
  • All four roles are output (heading, body, accent, monospace) as Figma variables Font-Families/Primary, Secondary, Tertiary and Monospace, each with the exact CSS stack in its description.
  • accent comes from a third family when the site uses one, else it defaults to the heading font (flagged for the reviewer). monospace is live when a monospace stack is used, else the system stack. The report marks each role live or default.
  • figma-to-block-theme uses a CSS stack: line in the variable description as the fontFamily when its first family matches the value.
  • target-structure.md, proposal-review.md and tokens-typography.md updated.

Verification

  • Tests added/updated to cover the bug: name cleaning, live and default roles, report, export variables, mapper stack; site-to-design-tokens 103 and figma-to-block-theme 56 Jest tests pass, coverage above thresholds, tsc --noEmit clean for both, ESLint no errors
  • Manual verification: fixtures only, not run on the live site
  • Negative/edge cases checked: no stack in the crawl, no fonts at all, a stack that belongs to another mode's font is ignored

Risk & Rollback

  • Risk level: Low to medium. typography.families in proposal.json changes from strings to objects, so old proposal files need a re-run.
  • Rollback plan: Revert this PR.

Changelog

Added

Changed

Fixed

  • Site Tokens Font Roles — site-to-design-tokens cleans font names (argesta_displayregular becomes Argesta Display), keeps the exact CSS stack, and outputs the heading, body, accent and monospace roles, marking each as live or default. figma-to-block-theme uses the stack. (#4007)

Removed


Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Accessibility checklist completed (where relevant):
    • Semantic HTML and heading order verified
    • Keyboard navigation and visible focus states verified
    • ARIA used only where needed
    • Contrast and non-colour cues reviewed (WCAG 2.1 AA or higher)
  • Docs/readme/changelog updated (if user-facing)
  • Security checklist completed (where relevant):
    • Untrusted input validated and sanitised
    • Output escaped for its rendering context
    • Privileged actions enforce nonce and capability checks
    • No secrets/sensitive data introduced; OWASP risks reviewed
  • Code/design reviews approved
  • CI green; linked issues closed; release notes prepared (if shipping)

🤖 Generated with Claude Code

Names drop weight and style suffixes, turn underscores into spaces and are
title-cased; the exact CSS stack is kept in the variable description. The
proposal now has heading, body, accent and monospace, each marked live or
default. figma-to-block-theme uses a declared stack as the fontFamily.

Fixes GIT-2761

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ZaredRogers
ZaredRogers requested review from a team and ashleyshaw as code owners November 9, 2026 12:30
@ZaredRogers
ZaredRogers requested a review from krugazul November 9, 2026 12:30
@linear-code

linear-code Bot commented Nov 9, 2026

Copy link
Copy Markdown

GIT-2761

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 12042ff and abacdf5.

Files selected for processing: 25

  • CHANGELOG.md
  • package.json
  • skills/figma-to-block-theme/SKILL.md
  • skills/figma-to-block-theme/references/tokens-spacing.md
  • skills/figma-to-block-theme/references/tokens-typography.md
  • skills/figma-to-block-theme/scripts/__tests__/figma-variables-to-theme-json.test.ts
  • skills/figma-to-block-theme/scripts/figma-variables-to-theme-json.ts
  • skills/site-to-design-tokens/SKILL.md
  • skills/site-to-design-tokens/references/crawling.md
  • skills/site-to-design-tokens/references/proposal-review.md
  • skills/site-to-design-tokens/references/target-structure.md
  • skills/site-to-design-tokens/scripts/__tests__/crawl-site-styles.test.ts
  • skills/site-to-design-tokens/scripts/__tests__/fixtures.ts
  • skills/site-to-design-tokens/scripts/__tests__/propose-tokens.test.ts
  • skills/site-to-design-tokens/scripts/__tests__/write-token-export.test.ts
  • skills/site-to-design-tokens/scripts/crawl-site-styles.ts
  • skills/site-to-design-tokens/scripts/propose-tokens.ts
  • skills/site-to-design-tokens/scripts/write-token-export.ts
  • skills/site-to-figma-components/SKILL.md
  • skills/theme-orphaned-refs/SKILL.md
  • skills/theme-orphaned-refs/scripts/__tests__/find-orphaned-presets.test.ts
  • skills/theme-orphaned-refs/scripts/find-orphaned-presets.ts
  • skills/theme-orphaned-refs/scripts/find_orphaned_presets.py
  • skills/theme-orphaned-refs/scripts/jest.config.cjs
  • skills/theme-orphaned-refs/scripts/tsconfig.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PR Template Routing

Branch Type: fix
Scope: git-2761-site-tokens-font-roles
Template: pr_bug.md
Labels Applied: type:bug

This PR was automatically routed based on the branch naming strategy.

@mergify

mergify Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

Action backgrounds take the anchor step when the anchor came from button fills,
with hover one step darker. A default that fails its contrast pair moves to the
nearest passing step and is recorded; failing live colours are listed with a
passing alternative.

Fixes GIT-2762

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ZaredRogers and others added 5 commits November 9, 2026 14:35
Add a Before you start section: npm ci in the .github checkout, and
npx puppeteer browsers install chrome if the launch fails (npm 11 blocks
Puppeteer's install script). site-to-figma-components has the same note;
figma-to-block-theme only needs npm ci.

Fixes GIT-2763

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…61-site-tokens-font-roles

# Conflicts:
#	skills/figma-to-block-theme/scripts/__tests__/figma-variables-to-theme-json.test.ts
#	skills/site-to-design-tokens/references/target-structure.md
…a third family

With two families there is no accent variable, preset or Figma script entry, and the
report says so. Monospace keeps its default. figma-to-block-theme writes only the
roles that exist.

Relates to GIT-2761

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ZaredRogers

Copy link
Copy Markdown
Contributor Author

The accent font role is now created only when the site uses a third family. With two families there is no accent variable, preset or Figma script entry, and the report says "no accent font: the site uses two families". Monospace keeps its default. figma-to-block-theme writes only the roles that exist (test added). This is merged up into #4015 and #4016. The radius naming change from #4011 is also merged into this branch.

ZaredRogers and others added 12 commits November 9, 2026 15:52
…61-site-tokens-font-roles

# Conflicts:
#	skills/figma-to-block-theme/scripts/__tests__/figma-variables-to-theme-json.test.ts
…61-site-tokens-font-roles

# Conflicts:
#	skills/site-to-design-tokens/references/proposal-review.md
Live TSP writes Moret on 88 links and moret everywhere else, so the
proposal added Moret as an accent. CSS family names are not
case-sensitive; roles are now picked by lower-case name and named after
the most common spelling.

Refs GIT-2761.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…site-tokens-action-colours

# Conflicts:
#	skills/site-to-design-tokens/SKILL.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ZaredRogers

Copy link
Copy Markdown
Contributor Author

Updated after scaffold end-to-end test run 2 on live TSP (9 Nov). TSP should get no accent, but three things produced one:

  1. Case. The site writes Moret on 88 links and moret elsewhere. Family names are now compared in lower case, and the role is named after the most common spelling.
  2. A widget's system font. Two widget buttons on every page use -apple-system. System UI stacks (-apple-system, system-ui, BlinkMacSystemFont, Segoe UI) never become the accent.
  3. A stray rule. One blog link has font-family: a. A third family now needs at least 2% of the text elements (and at least 5) to take the accent role.

Live TSP now gives Moret and Argesta Display, no accent, and default monospace. The test fixture's accent (Caveat) went from 4 to 8 elements so it stays above the minimum.

ZaredRogers and others added 6 commits November 10, 2026 08:55
The declared CSS stack starts with the live site's own @font-face name
(moret, argesta_displayregular), which the theme's fontFace entries
don't declare, so the fonts would not load. Keep the stack's fallbacks
and lead with the family name instead.

Refs GIT-2770

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The monospace variable is named Monospace and its declared stack starts
with ui-monospace, so the name check failed and the mapper wrote
"Monospace, sans-serif". A generic family names no font of its own, so
keep its declared stack, and fall back to monospace for that role.

Refs GIT-2771

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Layout collection's --wp--custom--layout--content-size and
wide-size variables landed in settings.custom.layout with no unit, and
settings.layout was never set, so the theme kept the scaffold's widths.
Map them, and core's --wp--style--global-- names, to contentSize and
wideSize in px.

Refs GIT-2772

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The export created brand, primary, cta, neutral, and figma-to-block-theme
keeps the Figma order, so the theme palette was out of convention.
Create neutral, primary, brand, cta instead.

Refs GIT-2773

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…resets

The scan walked node_modules, vendor, build and .agents, so on a
scaffold-generated theme it took over 2 minutes and its report was
almost all false hits. Skip those folders (with --exclude for more),
add border-radius to the preset types, suggest the nearest step for
bare numeric ladders, and add unit tests.

Refs GIT-2774

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eScript

Agent tooling is TypeScript with Jest tests beside the script. Replace
find_orphaned_presets.py and its unittest tests with
find-orphaned-presets.ts (registry loader, slug suggester and scanner
classes, file system injected) and Jest tests at 80% thresholds. Add
npm run test:theme-orphaned-refs. Behaviour matches the previous commit.

Refs GIT-2774

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-skip-dependencies

fix: orphaned-refs - Skip dependency, build and agent folders when scanning a theme
…alette-order

fix: site-tokens - Export the palette ramps in the LightSpeed order
…layout-widths

fix: figma-tokens - Map content and wide width to settings.layout
…monospace-stack

fix: figma-tokens - Keep the declared system monospace stack
…font-stacks

fix: figma-tokens - Build font stacks from the clean family name, not the raw @font-face name
…pacing-min-order

fix: site-tokens - Keep spacing minimums in order
…ction-text-pairing

fix: site-tokens - Pair the primary button text with the fill of the same buttons
…rawl-redirects

fix: site-tokens - Record redirects in the crawl and skip pages that land on the same URL
…-setup-notes

chore: site-tokens - Say which dependencies and browser the scripts need
…ction-colours

fix: site-tokens - Use live action colours and pick passing defaults for semantic tokens
@ZaredRogers
ZaredRogers merged commit 44c845e into fix/git-2760-site-tokens-content-width Nov 11, 2026
2 of 3 checks passed
@ZaredRogers
ZaredRogers deleted the fix/git-2761-site-tokens-font-roles branch November 11, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants