Skip to content

DS V2 PR-A: correctness — HCM proofs, contrast/disabled, prop unions - #1570

Merged
BigSimmo merged 4 commits into
mainfrom
claude/ds-v2-correctness
Aug 1, 2026
Merged

DS V2 PR-A: correctness — HCM proofs, contrast/disabled, prop unions#1570
BigSimmo merged 4 commits into
mainfrom
claude/ds-v2-correctness

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Close SPEC §13 Phase 1 slices PR 2–4: forced-colours computed proofs under all three .ckb-v2 selectors; --text-placeholder + eyebrows/placeholders off the decoration tier; retire the ten design-system disabled:opacity* recipes; discriminated unions for Citation / Chip / ToggleSwitch / RadioGroup; AsyncButton applies type after the props spread.
  • Correct the ckb-v2-tokens.css header so this repo file (not a design-project export) is the ranked SoT under AGENTS.md.
  • Flip GATES Gate 1 / enabled-control / decoration-on-text rows toward blocking with committed contracts; update SPEC §13 statuses and COMPONENTS defect rows closed by this PR.

Verification

  • npm run verify:pr-local — exit 0; unit Test Files 471 passed (471) / Tests 4878 passed | 3 skipped (4881); production build + client-bundle secret check passed; eval:rag:offline fixture Offline RAG fixture and manifest validation passed (36 golden cases, 23 suites) and Vitest Test Files 23 passed (23) / Tests 574 passed (574) (J4 baseline-diff: better than known-red main baseline of 4 timeouts / 570 passed — zero assertion failures).
  • npm run verify:ui344 passed (12.7m).
  • npm run test:e2e:critical15 passed (37.1s).
  • npm run test:e2e:style-contract5 passed including three ckb-v2 HCM computed selector cases.
  • npm run typecheck + npm run check:design-system-contract — green (raw colors 2; literal shadows 0; legacy tap classes 0).
  • Docs-surface: check:outstanding-issues, sitemap:check, docs:check-index, check:branch-review-ledger — green.

Verification not run: verify:release / live evals / live Lighthouse — outside standing auth for this program PR.

Risk and rollout

  • Risk: Low–medium UI correctness. HCM remaps align v2 command pairing with the live ButtonFace/ButtonText lesson; disabled controls lose opacity fades in favour of the encoded controlDisabled recipe; prop unions reject previously constructible inert-enabled Citation/Chip/ToggleSwitch/RadioGroup states (near-zero product call sites for Citation/Chip/RadioGroup).
  • Rollback: Revert the squash commit on main (Railway auto-redeploys).
  • Provider or production effects: Merge deploys to psychiatry.tools via Railway auto-deploy from main. No OpenAI/Supabase/live-eval calls in this PR.

Clinical Governance Preflight

Not required — no ingestion, answer generation, search/ranking, source rendering, document-access, privacy, production-env, or clinical-output behaviour change. Paths are design-system tokens/recipes/UI contracts + docs.

Notes

  • Program wave: Wave 1 / PR-A (claude/ds-v2-correctness). Auto-merge on green per standing auth.
  • Ledger: product tip 1aa9822978668a10447ef3246bd60cda6f1208cb recorded before push.
  • Follow-on: Wave 2 PR-V must not touch ckb-v2-tokens.css until this lands (A→V lease); values glance required before arming V.

Open in Devin Review

Summary by CodeRabbit

  • Accessibility
    • Improved contrast and forced-colour support across controls, status indicators, focus states, placeholders, and disabled elements.
    • Added accessibility requirements for interactive switches, removable chips, and citations.
  • UI Improvements
    • Standardized placeholder styling across search and form fields.
    • Replaced opacity-based disabled states with clearer borders, colours, backgrounds, and shadows.
  • Component Updates
    • Improved button type defaults and radio-group controlled/uncontrolled behavior.
  • Documentation
    • Updated design-system specifications, gates, and defect tracking to reflect completed work.

BigSimmoand others added 3 commits August 2, 2026 04:55
…ns).
Prove forced-colours remaps under the three .ckb-v2 selectors, move placeholders and eyebrows off the decoration tier, retire design-system disabled:opacity recipes, harden Citation/Chip/ToggleSwitch/RadioGroup contracts, and correct the token-file SoT header.
Co-authored-by: Cursor <cursoragent@cursor.com>
The standalone spec was outside Playwright's production match pattern, so verify:ui would never collect it.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@supabase

supabaseBot commented Aug 1, 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 ↗︎.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@ecc-tools

ecc-toolsBot commented Aug 1, 2026

Copy link
Copy Markdown

🔒 Upgrade Required

Private repository analysis requires Pro or Enterprise.

Upgrade: https://ecc.tools/pricing?plan=pro


ECC Tools keeps the core app open, and puts private repos, team features, and enterprise controls behind paid tiers.

@BigSimmo
BigSimmo enabled auto-merge (squash) August 1, 2026 21:27
@coderabbitai

coderabbitaiBot commented Aug 1, 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:26 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: 79047a51-c9ca-4662-8937-d6790108649b

📥 Commits

Reviewing files that changed from the base of the PR and between 7c06d2c and d5e90b8.

📒 Files selected for processing (11)
  • docs/design-system/COMPONENTS.md
  • docs/design-system/SPEC.md
  • src/app/globals.css
  • src/components/DocumentViewer.tsx
  • src/components/applications-launcher-page.tsx
  • src/components/calculators/directory-grid.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/formulation/formulation-builder-page.tsx
  • src/components/ui-primitives.tsx
  • tests/ckb-v2-token-contract.test.ts
  • tests/ui-style-contract.spec.ts
📝 Walkthrough

Walkthrough

The change updates design-system tokens, forced-colours mappings, disabled-control styling, component prop contracts, placeholder usage, tests, and design-system documentation.

Changes

Design-system correctness

Layer / File(s)Summary
Token roles and enforcement
src/app/ckb-v2-tokens.css, tests/*contract.test.ts, docs/design-system/GATES.md, docs/design-system/SPEC.md
Adds placeholder and forced-colours tokens. Updates contrast, decoration, and disabled-control rules. Adds contract coverage.
Shared control behavior
src/components/ui-primitives.tsx, src/components/ui/pagination.tsx, src/components/ui/tabs.tsx, tests/ui-primitives.dom.test.tsx, docs/design-system/COMPONENTS.md
Uses shared disabled styling. Preserves explicit AsyncButton types. Adds ToggleSwitchProps variants and related tests.
Component interaction contracts
src/components/ui/chip.tsx, src/components/ui/choice.tsx, src/components/ui/citation.tsx, tests/ui-v2-components.dom.test.tsx
Enforces accessible removable chips, controlled or uncontrolled radio groups, and interactive or static citations.
Placeholder token rollout
src/components/DocumentViewer.tsx, src/components/applications-launcher-page.tsx, src/components/calculators/directory-grid.tsx, src/components/clinical-dashboard/master-search-header.tsx, src/components/formulation/formulation-builder-page.tsx, docs/branch-review-ledger.md
Replaces text-soft with text-placeholder in search fields and textareas. Records validation results in the review ledger.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels:codex

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 40.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 nameStatusExplanation
Title check✅ PassedThe title clearly summarizes the main HCM, contrast, disabled-state, and prop-union changes.
Description check✅ PassedThe description follows the required template and provides summary, verification results, risk, rollout, governance, and notes.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/applications-launcher-page.tsx (1)

262-274: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a 48px tap target for the search submit button.

The submit button uses h-10 w-10, which produces a 40px target. Replace it with min-h-12 min-w-12 or an equivalent 48px size.

As per coding guidelines, production tap targets use min-h-12 (48px).

Proposed fix
- "mr-1 grid h-10 w-10 place-items-center rounded-full bg-[color:var(--clinical-accent)] text-[color:var(--clinical-accent-contrast)] shadow-[var(--shadow-tight)] transition hover:bg-[color:var(--clinical-accent-hover)]",+ "mr-1 grid min-h-12 min-w-12 place-items-center rounded-full bg-[color:var(--clinical-accent)] text-[color:var(--clinical-accent-contrast)] shadow-[var(--shadow-tight)] transition hover:bg-[color:var(--clinical-accent-hover)]",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/applications-launcher-page.tsx` around lines 262 - 274, Update
the submit button in the search form, identified by
aria-label={copy.openSelectedAriaLabel}, to provide a minimum 48px tap target by
replacing the current h-10 w-10 sizing with min-h-12 min-w-12 or an equivalent
48px constraint while preserving its existing styling and behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/design-system/COMPONENTS.md`:
- Around line 100-125: Update the open-defect ledger rows for Button and
TextField/SearchField/Select to remove the resolved danger contrast token and
decoration-tier placeholder items. Verify the corresponding implementations
first; if either behavior still exists, retain that specific defect and its PR 3
closure reference instead of removing it.
In `@docs/design-system/SPEC.md`:
- Line 430: Update the PR 3 status statement in the design-system specification
to reflect that PR 3 is complete and all ten opacity uses were retired, matching
the completed-status statement elsewhere in the document.
In `@src/components/ui-primitives.tsx`:
- Around line 297-301: Update the read-only indicator props branch around
onToggle and aria-label, plus its rendering path, so an indicator rendered with
role="img" always has an accessible name. Require aria-label for announced
indicators, or apply aria-hidden to intentionally unlabeled indicators; preserve
the existing interactive behavior and ensure both affected type branches follow
the same rule.
- Line 57: Update the toolbarButton recipe so its height and width use 48px
minimum dimensions instead of the h-tap and w-tap utilities tied to the 44px
--tap-min value, while preserving the remaining styling classes unchanged.
In `@tests/ckb-v2-token-contract.test.ts`:
- Around line 218-228: Update the forced-colours token list in the contract test
to include --glow-soft alongside the other tokens expected to match none,
ensuring the test detects any regression that restores its glow.
---
Outside diff comments:
In `@src/components/applications-launcher-page.tsx`:
- Around line 262-274: Update the submit button in the search form, identified
by aria-label={copy.openSelectedAriaLabel}, to provide a minimum 48px tap target
by replacing the current h-10 w-10 sizing with min-h-12 min-w-12 or an
equivalent 48px constraint while preserving its existing styling and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f6492bed-2135-4e3a-b2bd-7a94bbe259a8

📥 Commits

Reviewing files that changed from the base of the PR and between e358aa4 and 7c06d2c.

📒 Files selected for processing (22)
  • docs/branch-review-ledger.md
  • docs/design-system/COMPONENTS.md
  • docs/design-system/GATES.md
  • docs/design-system/SPEC.md
  • src/app/ckb-v2-tokens.css
  • src/components/DocumentViewer.tsx
  • src/components/applications-launcher-page.tsx
  • src/components/calculators/directory-grid.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/formulation/formulation-builder-page.tsx
  • src/components/ui-primitives.tsx
  • src/components/ui/chip.tsx
  • src/components/ui/choice.tsx
  • src/components/ui/citation.tsx
  • src/components/ui/pagination.tsx
  • src/components/ui/tabs.tsx
  • tests/ckb-v2-token-contract.test.ts
  • tests/decoration-on-text.contract.test.ts
  • tests/disabled-encoding.contract.test.ts
  • tests/ui-primitives.dom.test.tsx
  • tests/ui-style-contract.spec.ts
  • tests/ui-v2-components.dom.test.tsx

Comment threaddocs/design-system/COMPONENTS.md
Comment threaddocs/design-system/SPEC.md Outdated
Comment threadsrc/components/ui-primitives.tsx
Comment threadsrc/components/ui-primitives.tsx
Comment threadtests/ckb-v2-token-contract.test.ts

@devin-ai-integrationdevin-ai-integrationBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment threadsrc/components/ui-primitives.tsx
Comment threadsrc/components/DocumentViewer.tsx Outdated

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:7c06d2ce3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment threadsrc/components/ui-primitives.tsx
@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch claude/ds-v2-correctness at starting commit 7c06d2c; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:claude/ds-v2-correctness, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit:7c06d2ce3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BigSimmo
BigSimmo disabled auto-merge August 1, 2026 21:58
Declare --text-placeholder on the live globals layer so production placeholders resolve outside .ckb-v2; remove accidental UTF-8 BOMs; hide unlabeled ToggleSwitch indicators; extend HCM glow-soft pins; sync SPEC/COMPONENTS defect prose.
Co-authored-by: Cursor <cursoragent@cursor.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) August 1, 2026 22:01
@ecc-tools

ecc-toolsBot commented Aug 1, 2026

Copy link
Copy Markdown

🔒 Upgrade Required

Private repository analysis requires Pro or Enterprise.

Upgrade: https://ecc.tools/pricing?plan=pro


ECC Tools keeps the core app open, and puts private repos, team features, and enterprise controls behind paid tiers.

@BigSimmo
BigSimmo merged commit 3520e32 into mainAug 1, 2026
66 checks passed
@BigSimmo
BigSimmo deleted the claude/ds-v2-correctness branch August 1, 2026 22:14
BigSimmo added a commit that referenced this pull request Aug 2, 2026
* DS V2 PR-V 5a: close out token values (colour, elevation, ink)
No value deltas remain for slice 5a. 59e4c3d landed --shadow-well, the spine and status-mark families and the dark --clinical-chat-document fix; PR 3 (#1570) landed the remaining ink roles. The v2 light and dark blocks declare the same colour set, and the design-system contract reports rawColorLiterals 2 / literalShadowClasses 0 / legacyTapClasses 0 against an unchanged baseline.
The two surviving #0f766e literals restate a Postgres column default for a per-record accent colour, so they are data rather than design tokens and stay put; SPEC now records why, to stop a later reader 'fixing' the app default away from the database default.
* DS V2 PR-V 5b: move the tap knob to 48px
--spacing-tap goes 2.75rem -> 3rem in the globals @theme block, which is the only place it may be set (SPEC 4.10, DECISIONS C2). The v2 layer's --tap-min stops carrying its own value and becomes the pure alias var(--spacing-tap), so the app cannot render a 44/48 split. This moves 426 *-tap call sites across 90-odd files at once.
Pins flip in this commit, not a follow-up: ckb-v2-token-contract now asserts the alias, that the v2 layer never declares the knob, and that the @theme value is at least 48px (checked on resolved rem, since a string compare would pass on an alias); ui-style-contract raises its rendered Chromium floor to 48; ui-tools expects the mode-home hero tile at 48.
Two follow-through rules came out of the sweep and are written into SPEC 4.10. A grid track that holds a tap-sized child reads var(--spacing-tap) instead of copying the number - seven hardcoded 2.75rem tracks were audited and the launcher search row, the one with no gap between columns, was rebound; the other six absorb the extra 4px into an existing gap or the row's own padding. And the phone composer keeps a deliberate 44px below 431px, because its height is part of the search-chrome contract and 4px per button would re-tune the dock reserve and the phone CLS budget for no accessibility gain.
Also retires two min-h-[44px] literals on interactive links onto min-h-tap, and rewrites the comments that restated 44px so they name the token instead. GATES gate 2 moves to implemented-blocking.
* DS V2 PR-V 5c: move the control radius to 10px
Live @theme --radius-md goes 0.5rem -> 0.625rem, which is the value the v2 layer already declares for controls, inputs and buttons. The two layers disagreeing is what made adoption reshape every control on a surface the moment it opted in (SPEC 4.6), so the step lands here, once, moving all 243 rounded-md call sites across 81 files with a single visual diff instead of one surprise per adopted surface.
The 4px-grid pin flips in the same commit: the ladder now carries two named half-steps (sm 6px, md 10px) so a third cannot slip in, and the test additionally asserts the v2 control rung equals the live one - the drift this commit closes cannot silently reopen.
Fourteen arbitrary radius literals are absorbed onto the ladder, each to its nearest rung with ties going to the smaller: the therapy 9/10/11/14px values PR-T carried over from the retired stylesheet, the 5px choice box, and the 1.1/1.15/1.35rem dialog and popover corners. The 2px cap on the mode-nav indicator stays a literal and now says why - it is a hairline below the ladder's 4px floor, where the nearest rung would double it into a visible dome.
* DS V2 PR-V: record the review ledger row for the values PR
* DS V2 PR-V: fix tap leftovers and retune phone chrome pins
Complete the phone-composer 44px exception for the input, move Tools
search submit onto the tap knob, demote gate 2 to honest partial
coverage, correct the SPEC 426-site count, and retune short-runway
smoke pins for the 48px geometry.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
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.

1 participant

@BigSimmo