Skip to content

feat(design): port Clinical Sky token system, elevation ladder and radius grid - #1375

Merged
BigSimmo merged 12 commits into
mainfrom
claude/clinical-design-system-update-e34ca9
Jul 29, 2026
Merged

feat(design): port Clinical Sky token system, elevation ladder and radius grid#1375
BigSimmo merged 12 commits into
mainfrom
claude/clinical-design-system-update-e34ca9

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

Ports the reviewed Clinical Sky design system into globals.css, then fixes the drift and defects that port exposed.

Accent moved from Aegean teal #0b6f86 to Clinical Sky #1d6fb8. The full --primary-* ramp is re-derived in both themes rather than swapping the 500 step, so tints, borders and hover states stay coherent; dark holds the same hue (#74bdf0) instead of drifting to cyan-green. #1d6fb8 is 5.2:1 on white, legal as both text colour and button fill.

Structural token work:

  • Surfaces are now an ordered five-step scale (inset < wash < subtle < surface < raised). --surface-raised was darker than --surface, so raised cards read as recesses.
  • Elevation is a numbered ladder --e0--e4 — one monotonic sequence that sorts by name, hue-tinted, with negative spread. Seven shadow names previously produced five effects that didn't sort (tight 3px < soft 20px < hover 26px < elevated 48px). Old names are aliases onto tiers, so nothing breaks.
  • Status colours all sat in one 4.6–5.2:1 band, so nothing read as more urgent than anything else. Now ≥5.5:1 with danger clearly highest, and the categorical --type-* / --tone-* anchors are chroma-capped below the calmest status colour so an identity chip can never out-shout a status badge.
  • Radius ladder onto the 4px grid: 4 · 6 · 8 · 12 · 16 · 20. --radius-lg was 10px; moving it to 12 collided with --radius-xl, so the upper ladder shifted a rung rather than collapsing two names onto one value.
  • Type: the 8px --text-4xs step is retired (indefensible at any density in a clinical product); --tracking-eyebrow and --leading-display/--leading-prose replace 67 + 12 arbitrary values. Tailwind's own --leading-tight/-snug are deliberately not shadowed — that would silently retune 38 existing call sites.
  • Tabular numerals on code/kbd/th/td/.font-mono so doses and counts stop wobbling between rows.

Three drift bugs found in passing, each silently keeping the old teal: the pre-paint APP_THEME_COLORS.light (a flash of the wrong page colour and a mismatched browser chrome bar), the brand mark powering the favicon and generated icon routes, and the Therapy Compass print palette.

tests/design-token-contract.test.ts (27 assertions) now ratchets these relationships — surface ladder ordering, ramp distinctness, chroma cap, contrast floors, ladder aliasing, radius grid, and the derived values (APP_THEME_COLORS must equal the resolved --background; the brand tiles must equal --clinical-accent). Two stale pins that copied token values instead of tracking them are repaired.

Not adopted from the review: the proposed two-tone focus ring. It stacked a second box-shadow — which the shared focus rule exists to prevent — and wiped the control's resting elevation. Its premise doesn't hold here: outline-offset paints outside the border box, so the gap shows the ancestor surface, not the control's accent fill.

RAG impact: no retrieval behaviour change — design tokens, styling and docs only; no file under src/lib/rag/**, clinical-search, ranking-config, the eval harness, or the golden fixture is touched.

Verification

  • npm run verify:pr-localTest Files 418 passed (418), Tests 4265 passed | 3 skipped, plus format, client-bundle secret surface, and offline RAG fixture/manifest validation (36 golden cases, 21 suites)
  • npm run verify:cheap — green on the merged base
  • npm run verify:ui — 323 passed. Residual failures on this machine were hydration/load races under ~40 concurrent worktrees (button never enables, menu never opens); each re-verified passing on an idle box
  • One genuine test defect found and fixed: ui-overlap.spec.ts measured the header without covering the measurement in the same retry gotoHome already uses, so a React remount left a 0×0 rect and the suite failed at a different arbitrary width each contended run. Stable across four consecutive runs since
  • Live browser token readback in both schemes confirms theme-color meta matches --background exactly (#f1f4f8 / #060708)

Risk and rollout

Visual change across the product: every page background moves off pure white, and 1,036 rounded-* call sites change radius. No behavioural or data-path change. Revert is a single-commit revert of the token blocks; the --e0--e4 aliases mean call sites need no coordinated change either way.

Clinical Governance Preflight

Design tokens, styling and docs only — no ingestion, answer generation, search/ranking, document access, privacy or clinical output path is touched. Recorded for completeness:

  • 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 — status colours were strengthened, not relaxed, and now outrank the categorical identity set
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed — no decision-support behaviour changed

Notes

  • The direction is renamed Clinical White / Sky Graphite; "Aegean" no longer described the accent. Six docs that hardcoded the old teal are updated.
  • docs/redesign/02-design-direction.md carried pre-existing rot in its "Token set (implemented in globals.css)" section — a primary ramp of #0e8f85/#33d4c2, a radius scale that never matched, durations of 150/200/250ms against an actual 120/180/240ms. Corrected and cross-checked value by value.
  • Therapy Compass's 650/680 weights were briefly normalised to 600/700 and then restored: globals.css uses 520/540/560/580/640 deliberately, so intermediate weights on a variable face are the established idiom, not drift.
  • The claude.ai/design project 08d6f126 has been updated with the recompiled bundle and the four changed guideline docs. Its _ds_manifest.json token inventory still lists --text-4xs and the retired arbitrary utilities until a full resync.mjs --remote regenerates bundle and manifest together.

🤖 Generated with Claude Code

BigSimmoand others added 3 commits July 28, 2026 13:27
…rect token docs
Follow-ups on the Clinical Sky token port:
- Restore Therapy Compass's 650/680 font weights. They were normalised to
600/700 on the premise that they were off-scale, but globals.css uses
520/540/560/580/640 deliberately ("Geist is a variable face, so these
interpolate instead of snapping to 700"), so the intermediate weights were
the established idiom rather than drift. therapy-compass.css now differs
from main only by the Clinical Sky print palette.
- Fix a pre-existing race in the header-overlap coverage. gotoHome settles on
a single visible header, but a later React remount can detach it before the
measurement, leaving a 0x0 rect and no candidates, so the suite failed at a
different arbitrary width on each contended run. Retry the collection, not
the overlap assertion, so a header that never renders still fails. Stable
across four consecutive runs.
- Correct docs/redesign/02-design-direction.md, whose "Token set (implemented
in globals.css)" section claimed a primary ramp of #0e8f85/#33d4c2, a radius
scale of lg 0.875rem / xl 1.25rem / 2xl 1.75rem, and durations of
150/200/250ms. None matched the stylesheet. Every value is now cross-checked
against globals.css; the dated June 20 / July 1 sections are left as the
record of past runs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@supabase

supabaseBot commented Jul 29, 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 ↗︎.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitaiBot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:11 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b95da665-28e6-48c5-a7a8-38932fd1f119

📥 Commits

Reviewing files that changed from the base of the PR and between 96a4c76 and 76e08f2.

⛔ Files ignored due to path filters (1)
  • src/app/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (62)
  • .design-sync/conventions.md
  • docs/branch-review-ledger.md
  • docs/clinical-badge-system-guide.md
  • docs/clinical-chat-ui-component-map.md
  • docs/design-system.md
  • docs/redesign/02-design-direction.md
  • docs/redesign/permanent-colour-direction.md
  • mockups/README.md
  • scripts/check-type-scale.mjs
  • src/app/(search-app)/documents/search/page.tsx
  • src/app/globals.css
  • src/app/mockups/answer-evidence-popups/page.tsx
  • src/app/mockups/mode-dropdown/page.tsx
  • src/app/mockups/recent-searches-bottom/page.tsx
  • src/components/AccessibleTable.tsx
  • src/components/ClinicalDashboard.tsx
  • src/components/DocumentTagCloud.tsx
  • src/components/DocumentViewer.tsx
  • src/components/clinical-dashboard/ClinicalSidebar.tsx
  • src/components/clinical-dashboard/DocumentManagerPanel.tsx
  • src/components/clinical-dashboard/dashboard-nav.tsx
  • src/components/clinical-dashboard/differentials-home.tsx
  • src/components/clinical-dashboard/document-admin.tsx
  • src/components/clinical-dashboard/document-search-results.tsx
  • src/components/clinical-dashboard/favourites-command-library-page.tsx
  • src/components/clinical-dashboard/favourites-hub.tsx
  • src/components/clinical-dashboard/favourites-library-nav.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/medication-prescribing-workspace.tsx
  • src/components/clinical-dashboard/medication-record-page.tsx
  • src/components/clinical-dashboard/output-panel.tsx
  • src/components/clinical-dashboard/patient-profile-panel.tsx
  • src/components/differentials/differential-detail-page.tsx
  • src/components/differentials/differential-presentation-workflow-page.tsx
  • src/components/differentials/differential-stream-page.tsx
  • src/components/document-search-mockups.tsx
  • src/components/document-viewer/document-rail-panels.tsx
  • src/components/document-viewer/manual-tag-editor.tsx
  • src/components/document-viewer/source-panels.tsx
  • src/components/dsm/dsm-comparison-page.tsx
  • src/components/dsm/dsm-diagnosis-page.tsx
  • src/components/dsm/dsm-differential-considerations-page.tsx
  • src/components/dsm/dsm-search-page.tsx
  • src/components/favourites-page-mockups/favourites-library-redesign-page.tsx
  • src/components/forms/form-code-badge.tsx
  • src/components/forms/form-detail-page.tsx
  • src/components/master-document-flow-mockups.tsx
  • src/components/mode-home-template.tsx
  • src/components/services/service-detail-page.tsx
  • src/components/settings-search-mockups/settings-search-mockup-page.tsx
  • src/components/therapy-compass/therapy-compass.css
  • src/components/tools-page-mockups/rectangle-direction-mockups.tsx
  • src/components/tools-page-mockups/split-pane-refined-mockups.tsx
  • src/components/tools-page-mockups/tools-page-mockup-page.tsx
  • src/components/ui-primitives.tsx
  • src/lib/brand-mark.ts
  • src/lib/theme.ts
  • tests/design-token-contract.test.ts
  • tests/theme.test.ts
  • tests/ui-overlap.spec.ts
  • tests/ui-route-coverage.spec.ts
  • tests/ui-tools.spec.ts
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@cursoragent Inspect the PR and repository state, identify the root cause of every failing CI check, unresolved review comment, merge conflict, and related defect. Apply the smallest robust fix using existing project patterns and best practices, without unrelated changes. Run Bugbot and all relevant lint, type-check, test, build, and CI-equivalent commands, fix any issues found, then resolve only the review comments that are fully addressed. Summarise the root causes, changes made, validation results, and any remaining blockers.

@cursor

cursorBot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

PR #1375 is merged (7695b36f, squash @ 05:14:26 UTC). Auto-merge landed after required CI went green.

Root causes

  1. Merge conflicts with main — branch was 21+ commits behind
    • DocumentViewer.tsx: main extracted the rail into DocumentViewerRail; this PR still had the inline aside (only tracking-eyebrow token edits)
    • Later document-search-results.tsx: Remove document result overlays #1378 removed SelectedDocumentEvidencePanel; this PR only had token edits inside that deleted overlay
  2. Production UI failureform detail mobile… hit Playwright strict mode with twoform-detail-page mains during hydration remount (same class as medication/home settlement races)
  3. Review threads / Bugbot — none actionable (cursor[bot] ack only; 0 review threads)

Fixes applied (all in the squash)

  • Took main’s DocumentViewerRail; reapplied tracking-eyebrow in document-rail-panels.tsx
  • Took Remove document result overlays #1378’s overlay removal; kept tracking-eyebrow on surviving search-results code
  • Hardened form-detail Playwright tests with expectSingleSettledOwner
  • Synced through main until CI green

Validation

GateResult
Hosted PR required / Production UIPASS on tip 76e08f2d (then squash-merged)
Build / Static / Unit / Safety / PR policy / Semgrep / CircleCIPASS
Local verify:cheap423 files / 4298 tests PASS
typecheck, lint, formatPASS
form-detail e2e2/2 PASS
design-token + related40/40 PASS
Bugbot0 findings

Remaining

  • Leftover branchclaude/clinical-design-system-update-e34ca9 at c71abc6c — only a post-merge ledger row that did not make the squash. Safe to delete when you want.
  • No unresolved review comments to resolve.
Open in WebOpen in Cursor

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@codex fix issues

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@claude review PR

@github-actions

Copy link
Copy Markdown
Contributor

Hi @BigSimmo — thanks for the @claude mention.

Open this in Claude Code on the web to continue here: https://claude.ai/code

Context: BigSimmo/Database · #1375

Automated backlink from the Claude backlink workflow. Claude Code can pick up the mention and push a scoped fix to the branch.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 29, 2026 04:07
@claude

claudeBot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@CodeRabbit review PR

@coderabbitai

coderabbitaiBot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@BigSimmo: I’ll review PR #1375.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Take main's DocumentViewerRail extraction and re-apply the
tracking-eyebrow token on the moved summary heading so the design
system port stays mergeable with current main.
@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

  • Fixed the standalone PWA offline page, which still mirrored the retired Aegean palette. Its light and dark backgrounds, surfaces, borders, text, Clinical Sky accents, glow, elevation, and browser theme colours now match the current design system. public/offline.htmlL8-L17public/offline.htmlL29-L41public/offline.htmlL128-L142
  • Bumped the service-worker cache version so existing PWA installations receive the corrected offline document rather than retaining the previously precached version. public/sw.jsL9-L15
  • Updated the offline-document SHA-256/cache-version pairing guard for the new immutable cache generation. tests/pwa-manifest.test.tsL82-L100
  • Added a design-token regression test that verifies the standalone offline page continues to mirror the application background and clinical accent in both colour schemes. tests/design-token-contract.test.tsL242-L254
  • Recorded the completed scoped review in the repository’s append-only review ledger.
  • Committed the changes on codex/fix-pr-1375 as 90e3903857e533adc38f715b16337ff9cd57e672 (fix(design): align offline fallback with Clinical Sky).
  • Created the requested stacked pull-request metadata with the title “fix(design): align offline fallback with Clinical Sky.”

Testing

  • node <<'NODE' … NODE — printed the decisive result: Offline Clinical Sky token mirror and service-worker cache pairing passed.
  • node scripts/check-branch-review-ledger.mjsBranch review ledger guard passed: 1162 table records ... no conflict markers, mojibake, heading records, or duplicates.
  • git diff --check
  • ⚠️npm run verify:cheap — blocked before reaching project tests because the environment provides Node 20.20.2 instead of the repository-required Node 24 and has no resolvable tsx/cli; this was an environment/toolchain limitation rather than an application test failure.

View task →

@github-actions

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Production UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #6463 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

Production UI failed when hydration briefly left two
form-detail-page mains mounted. Use expectSingleSettledOwner so
transient remounts can converge while a permanent double-render
still fails.
Resolve document-search-results conflict by taking #1378's
removal of SelectedDocumentEvidencePanel; this branch only had
tracking-eyebrow edits inside that deleted overlay.
@BigSimmo
BigSimmo merged commit 7695b36 into mainJul 29, 2026
19 checks passed
@BigSimmo
BigSimmo deleted the claude/clinical-design-system-update-e34ca9 branch July 29, 2026 05:14
@cursorcursorBot mentioned this pull request Jul 29, 2026
9 tasks
BigSimmo added a commit that referenced this pull request Jul 29, 2026
 (#1391)
Follow-ups to #1375 (Clinical Sky design system), which merged before these landed.
`text-4xs` was dead on main. #1375 retired the `--text-4xs` token, so Tailwind
emits no such rule and every remaining `text-4xs` class was a silent no-op with
the text falling back to inherited size. Two files carrying it landed from main
while #1375 was in flight and were dead on arrival. Repointed to `text-3xs`, the
10px floor, and guarded: the design-token contract now fails if any tracked file
under `src/` references the retired class outside a comment. Mockups are
deliberately not exempt — a dead utility breaks a mockup exactly as it breaks
production.
Six hydration races fixed at the source. In this app visible never implies
interactive: the server-rendered tree paints before React owns it, so a single
un-retried action asserted once is a coin flip under load. Every fix retries the
action together with the effect it should produce, so a swallowed first attempt
retries while a genuine regression still fails.
Both retries added to ui-smoke are idempotent, which review caught and which
matters more than it looks. `toPass` schedules another attempt whenever the
inner assertion's own deadline expires — which can happen after the click
already landed. Without a guard, `openGuide` clicked a Settings trigger the
modal was already covering, and the mode-menu retry clicked a TOGGLE a second
time, closing a menu that had just opened and oscillating until the budget ran
out. The mobile branch needed a second guard: a swallowed Settings click leaves
the phone menu open, so re-running `openMobileClinicalGuideMenu` would toggle it
shut and then fail to find Settings inside it — meaning the <768px branch could
not recover on retry at all.
The ui-overlap phone-inset measurement now retries inside `toPass` with the 2px
symmetry tolerance and the assertions byte-for-byte unchanged, so a genuinely
asymmetric header still fails once the retry budget is spent.
Documentation records that the intermediate font weights on the variable face
are deliberate rather than drift, and that redefining Tailwind's own leading
names silently retunes every existing call site.
Also resolves an `issues:next-id` double-allocation: #108/#109 were claimed
concurrently by two branches, so this branch's two rows are renumbered #110/#111
and the marker moved to 112. #111 is archived rather than left open, since this
change is what closes it.
RAG impact: no retrieval behaviour change — test robustness, two mockup class
names, and docs only; nothing under `src/lib/rag/**`, clinical-search,
ranking-config, the eval harness or the golden fixture is touched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvU8z73P6TXUXoYBqN5K1P
Sign up for freeto 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.

2 participants

@BigSimmo@cursoragent