Skip to content

test(contract): lock ui.tsx design-system escape hatches (kenji audit #1) - #218

Merged
jackwener merged 1 commit into
mainfrom
yuejing/fe-bug-hunt-12
Jun 24, 2026
Merged

test(contract): lock ui.tsx design-system escape hatches (kenji audit #1)#218
jackwener merged 1 commit into
mainfrom
yuejing/fe-bug-hunt-12

Conversation

@jackwener

Copy link
Copy Markdown
Member

PR-FE-BUG-HUNT-12 closing kenji's audit reminder 4-6 finding #1 (msg `6cc0e04d` 2026-06-24).

Bug

`packages/ui/src/ui.tsx` is a motion / design-contract blind spot. The PR-MOTION-TOKEN-CONVERGE-0 contract scans `packages/ui/src/primitives/` and `apps/desktop/src/renderer/` but NOT the aggregate re-export layer at ui.tsx. That file inlines Tailwind utilities that would otherwise be caught by existing contracts:

Class Count Where
`z-40` 2 dialog + sheet backdrop
`z-50` 5 dialog popup, sheet popup, tooltip, select popup, popover
`backdrop-blur-sm` 2 dialog + sheet backdrop
`transition-[height]` 1 accordion content panel

Without a contract, future primitive PRs can quietly add a sixth or seventh escape hatch without design-system review.

Approach

Greenfield contract test pinning the EXACT set + count. Three checks:

  1. Each allowlisted pattern appears exactly the expected number of times — both new sites and stale entries fail.
  2. No other bare Tailwind z-index utilities (z-0 / z-10 / z-20 / z-30) crept in.
  3. No other bare backdrop-blur intensity variants beyond `sm` crept in.

Why I'm NOT removing the escape hatches in this PR

Touches Base UI primitive wrappers (Dialog, Sheet, Tooltip, Select, Popover, Accordion) and risks visual breakage. Each removal needs kenji / WAWQAQ review on what to tokenize to. Contract locks the perimeter; future PRs replace one at a time.

The accordion `transition-[height]` is documented as intentional — content panels are variable-height; transform scaling would distort children. That one stays even after full tokenization.

Diff

1 new file, ~110 lines test. No source change, no visual change. No overlap with any open PR.

Verification

Disk still ~100%, couldn't run `pnpm install && pnpm test`. The contract is self-validating — first run will confirm all four allowlist counts match the file as it stands.

… reminder 4-6 #1)

Kenji's aesthetic audit reminder 4-6 finding #1
(msg `6cc0e04d` 2026-06-24): `packages/ui/src/ui.tsx` is a motion /
design contract blind spot. The PR-MOTION-TOKEN-CONVERGE-0 contract
scans `packages/ui/src/primitives/` and `apps/desktop/src/renderer/`
but NOT the aggregate UI re-export layer at ui.tsx. That file
inlines Tailwind utilities that would otherwise be caught:

- `z-40` (×2): dialog + sheet backdrop scrim
- `z-50` (×5): dialog popup, sheet popup, tooltip, select popup, popover
- `backdrop-blur-sm` (×2): dialog + sheet backdrop
- `transition-[height]` (×1): accordion content panel

Without a contract, future primitive PRs can quietly add a sixth or
seventh escape hatch without going through design-system review.

## Approach

Greenfield contract test pinning the EXACT set + count of escape
hatches. Three checks:

1. Each allowlisted pattern appears exactly the expected number of
   times — adding new sites OR removing old ones (stale allowlist)
   both fail.

2. No other bare Tailwind z-index utilities (z-0 / z-10 / z-20 / z-30)
   have crept in.

3. No other bare backdrop-blur intensity variants beyond `sm` have
   crept in (md / lg / xl / 2xl / 3xl / none).

## Intentionally NOT removing the escape hatches in this PR

Removing them would touch Base UI primitive wrappers (Dialog, Sheet,
Tooltip, Select, Popover, Accordion) and risk visual breakage. Each
removal needs WAWQAQ / kenji review on what to tokenize to. The
contract locks the perimeter; future PRs can replace one at a time.

The accordion `transition-[height]` is documented as intentional —
content panels are variable-height; transform-based scaling would
distort children. That one stays even after full tokenization.

## Diff

1 new file: ~110 lines test. No source change, no visual change.
No overlap with any open PR.

## Verification

Disk still ~100%, couldn't run `pnpm install && pnpm test`. The
contract is greenfield and self-validating — first run will confirm
all four allowlist counts match the file as it stands.
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