Skip to content

refactor(tokens): migrate production letterspacing onto the named scale - #1669

Merged
BigSimmo merged 3 commits into
mainfrom
claude/ds-tracking-migration
Aug 7, 2026
Merged

refactor(tokens): migrate production letterspacing onto the named scale#1669
BigSimmo merged 3 commits into
mainfrom
claude/ds-tracking-migration

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

Completes what #1663 set up. #1655 and #1658 have landed, so ui-primitives.tsx and the answer surface are free to touch.

  • 68 arbitrary tracking-[…] call sites across 40 production files fold onto the five named roles. That is every statically resolvable site the contract can see. The ratchet now reports arbitrary tracking 0, down from 68.

    Folded from Onto Sites
    -0.008 -0.01 -0.035 -0.04 tracking-display 6
    0.01 0.02 tracking-normal 2
    0.04 0.05 0.06 tracking-label 47
    0.08 0.09 tracking-eyebrow 8
    0.1 0.11 0.12 tracking-kicker 7

    Largest single move is 0.04em; almost all are 0.01–0.02em.

  • Baseline tightened from 68 to 0, per-path map cleared, so the family cannot regrow at all rather than regrowing up to the old ceiling. Every other metric was left untouched by construction — the edit sets only arbitraryTracking.

  • *-mockups.tsx and *-mockups/ directories are deliberately untouched. Design scratch, gate-exempt; migrating them would triple the diff for no enforcement gain. tracking-[var(--quantity-unit-tracking)] is the sanctioned token form and stays.

Verification

  • npm run check:design-system-contract — exit 0, arbitrary tracking 0
  • npm run typecheck — exit 0
  • npm run lint — exit 0
  • npm run test — 5 473 passed, 14 skipped (author report on original tip)
  • npm run verify:pr-local — to be re-confirmed after main sync on the review-and-fix tip
  • UI verification not run: letterspacing deltas are ≤0.04em (mostly 0.01–0.02em); Production UI critical + Production UI (1–3) already passed on tip f275e9b2; a local Chromium screenshot pass would not meaningfully adjudicate sub-pixel tracking.

Risk and rollout

  • Risk: low — CSS utility class renames onto named letterspacing tokens plus a design-system contract baseline ratchet; no clinical logic, retrieval, privacy, or document-access behavior changes. patient-safety-plan.tsx is touched only for two tracking-[0.06em]tracking-label class renames (same computed role).
  • Rollback: revert the squash merge (or the letterspacing commit) to restore prior arbitrary tracking utilities and the previous baseline.
  • Provider or production effects: None

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

Clinical-risk classification is triggered solely by the path name src/components/patient-safety-plan.tsx (matches the patient presentation-surface pattern). Diff is letterspacing token migration only.

RAG impact: no retrieval behaviour change — this diff renames CSS utility classes and adjusts a contract baseline. No file under src/lib/rag/**, clinical-search, retrieval-selection, ranking-config, answer-ranking, the eval harness, or the golden fixture is modified.

Completes the work #1663 set up. #1655 and #1658 have landed, so
`ui-primitives.tsx` and the answer surface are free to touch.

68 arbitrary `tracking-[…]` call sites across 40 production files fold onto the
five named roles. That is every statically resolvable site the contract can see;
the ratchet now reports `arbitrary tracking 0`, down from 68.

Fold applied, as committed in globals.css:

  -0.008 / -0.01 / -0.035 / -0.04  -> tracking-display   (6 sites)
  0.01 / 0.02                      -> tracking-normal    (2)
  0.04 / 0.05 / 0.06               -> tracking-label     (47)
  0.08 / 0.09                      -> tracking-eyebrow   (8)
  0.1 / 0.11 / 0.12                -> tracking-kicker    (7)

Largest single move is 0.04em; almost all are 0.01-0.02em.

Baseline tightened from 68 to 0 with the per-path map cleared, so the family
cannot regrow at all rather than regrowing up to the old ceiling. Every other
metric in the baseline was left untouched by construction — the edit sets only
`arbitraryTracking`.

`*-mockups.tsx` and `*-mockups/` directories are deliberately untouched: design
scratch, gate-exempt, and migrating them would triple the diff for no
enforcement gain. `tracking-[var(--quantity-unit-tracking)]` is the sanctioned
token form and stays.

Verification: check:design-system-contract exit 0 (`arbitrary tracking 0`) ·
typecheck 0 · lint 0 · full unit suite 5 473 passed, 14 skipped.

Three test files fail, none caused by this diff:
- tests/installed-lock-parity.test.ts — playwright 1.62.0 vs locked 1.62.1,
  environmental, issue #149.
- tests/pr-handoff-stop.test.ts and tests/mode-nav-addon-slot.dom.test.tsx —
  both arrived on main after this session's earlier clean full run, from #1649
  and #1647. They fail for Windows-environment reasons: simulated `jq` absence,
  and an assertion comparing repo-relative POSIX paths against absolute Windows
  paths. The mode-nav assertion compares path FORMAT over an identical two-file
  set, so it is content-independent and a class rename cannot produce it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@supabase

supabase Bot commented Aug 7, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR replaces arbitrary letter-spacing utilities with shared design-system tracking tokens across application surfaces. It also updates the design-system baseline from 68 violations to zero.

Changes

Tracking token standardization

Layer / File(s) Summary
Baseline and foundational typography consumers
scripts/design-system-contract-baseline.json, src/app/reference/colour-coding/page.tsx, src/components/AccessibleTable.tsx, src/components/ClinicalDashboard.tsx, src/components/ui-primitives.tsx
The baseline records zero arbitraryTracking violations. Foundational labels and headings use shared tracking utilities.
Calculator tracking utilities
src/components/calculators/*
Calculator labels, badges, headings, and status text use shared tracking tokens.
Clinical dashboard tracking utilities
src/components/clinical-dashboard/*
Clinical dashboard headings, labels, table content, search results, dialogs, and panels use shared tracking tokens.
Document and reference tracking utilities
src/components/differentials/*, src/components/document-viewer/*, src/components/dsm/*, src/components/factsheets/*
Differential, document viewer, DSM comparison, and factsheet surfaces use shared tracking tokens.
Remaining UI tracking utilities
src/components/mode-nav/mode-nav.tsx, src/components/patient-safety-plan.tsx, src/components/pwa-lifecycle.tsx, src/components/services/*, src/components/specifiers/*, src/components/therapy-compass/*
Remaining labels and headings use shared or default tracking values.
Estimated code review effort: 1 (Trivial) ~5 minutes

Possibly related PRs

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the migration of production letter-spacing utilities to named design-system tokens.
Description check ✅ Passed The description follows the required template and documents scope, risk, rollback, governance, and verification, including reasons for skipped UI checks.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ds-tracking-migration

Comment @coderabbitai help to get the list of available commands.

@BigSimmo

BigSimmo commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Cursor review-and-fix summary — PR 1669

Tip: 6df709c8a3c44f469c454c4e04dfd501db0d78e8 on claude/ds-tracking-migration
Base: main @ 38e5a433
Ahead/behind vs origin/main: 3 / 0
Merge-tree vs origin/main: clean (behind-but-clean resolved on remote; no content conflict)
Mergeable: MERGEABLE · mergeStateStatus: BLOCKED (required CI still settling)
Auto-merge: already armed (squash) — left as-is; merge left to you

Snapshot / blockers cleared

Item Before After
PR policy FAIL — missing ## Clinical Governance Preflight (classifier trip on patient-safety-plan.tsx path only) SUCCESS — complete preflight + Risk/rollout + Verification wording
Sync BEHIND main Remote tip already includes main syncs (#1670/#1671); 0 behind, merge-tree clean
Review threads 0 0 unresolved
Required CI on prior tip f275e9b2 PR required + Production UI (1–3) + critical SUCCESS New tip re-running after remote sync — Static/Build/Coverage/Production UI critical in progress

Review findings

  • Bugbot + deep review: no high-confidence P0/P1/P2 product defects. 68/68 tracking-[…] folds match the named-scale buckets; max delta ≤0.04em (mostly 0.01–0.02em).
  • Protected RAG/ranking surfaces: not touched (ragRanking: false). Existing body RAG impact: line is correct.
  • Clinical-risk flag: path-only false friend — sole trigger is src/components/patient-safety-plan.tsx (two tracking-[0.06em]tracking-label renames). No clinical logic change.
  • Fixed: PR body governance/verification/risk metadata (policy blocker).
  • Dispositioned / no code change: fold-table “display: 6” vs 4 sites in this diff (cosmetic body table); mockup arbitrary tracking left intentionally; hardcoded CSS letter-spacing outside this utility migration.
  • Threads: none to resolve. Codex review hit usage limits; CodeRabbit reported no actionable comments.

Local gates (decisive lines)

  • Design-system contract passed … arbitrary tracking 0.
  • verify:cheapTest Files 519 passed (519) / Tests 5493 passed | 1 skipped (5494)
  • verify:pr-local → lint + typecheck + full unit suite + build + Offline RAG fixture and production-contract checks passed. (574 offline RAG tests)
  • Re-confirmed on current tip: arbitrary tracking 0
  • Not run (approval-gated / low yield): verify:ui, verify:release, live evals, check:supabase-project, Lighthouse (advisory). UI verification not run: sub-pixel tracking; prior tip already had Production UI green.

Push / ledger

  • Did not push a local merge/ledger tip — remote had already advanced with main syncs and required CI was in flight; pushing would only cancel green-path runs for a ledger-only delta.
  • Review ledger row appended locally for head 6df709c8 under scope PR 1669 heavy review-and-fix (unpushed, per no ledger-only tip rule).

Residual risks

  • Sub-pixel visual drift on labels/kickers/display (≤0.04em) — trust Production UI on the settling tip.
  • Auto-merge will proceed once required checks on 6df709c8 go green; no further agent action planned.

Merge left to you.

@BigSimmo
BigSimmo merged commit b557a26 into main Aug 7, 2026
25 checks passed
@BigSimmo
BigSimmo deleted the claude/ds-tracking-migration branch August 7, 2026 10:15
BigSimmo added a commit that referenced this pull request Aug 7, 2026
… used it (#1673)

The session handed this file found four defects in it and one hazard it omitted.
All five verified against origin/main before being written back.

Corrections:
- #1669 was listed "open at handover"; it merged as b557a26. Any status in a
  handover is stale the moment it is written, so §1 now says re-measure rather
  than quote — the staleness figure itself drifted 111 -> 129 commits in two days.
- "two source sites already carry workaround comments" was an undercount. There
  are five comments across four files; a literal grep for "tailwind-merge" finds
  only three, because two say "plain join" and "concatenates". The fifth,
  mode-home-template.tsx:106, does not merely comment — it strips stray
  `justify-*` tokens, so twMerge would make that workaround redundant or
  double-handle it.
- "~200 importing files" understated the blast radius: `cn(` is called 1 888
  times across 188 source files, and 210 files reference ui-primitives.
- Records that this needs tailwind-merge v3.x (v2 targets Tailwind 3; the repo is
  on tailwindcss ^4.3.1) and that neither tailwind-merge nor clsx is a dependency.

The omitted hazard, now the headline of A1: stock tailwind-merge classifies an
unknown `text-<x>` as a text COLOUR, and this repo's @theme defines scales it has
never seen (text-2xs, text-3xs, the tracking-* roles, min-h-tap, size-icon-*,
thirteen shadow-*, custom radius-*/leading-*). `cn(eyebrowText)` would therefore
have either its size or its colour silently deleted — a regression across the kit
with no type or lint signal. The deliverable is the extendTailwindMerge config,
not the `cn()` body. Also records the two hazard classes to audit first and the
instruction to baseline the known Windows failures before touching anything.

Prompt fix (§9): that session stalled before step 0 asking whether `git fetch`
fell inside the provider-confirmation boundary. It read the earlier wording
correctly — "any provider-backed workflow" plainly covers a fetch. The boundary
exists for spend, mutation and production risk, none of which a read-only fetch
carries. §9 now pre-authorises fetch, worktree creation and a single-package
npm install by name, keeps the real gates, and records why the paragraph exists
so it is not trimmed away later.

docs:check-links exit 0.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant