Skip to content

test(contract): lock drawer.tsx + tabs.tsx motion escape hatches (kenji audit #3+#4) - #219

Merged
jackwener merged 2 commits into
mainfrom
yuejing/fe-bug-hunt-13
Jun 24, 2026
Merged

test(contract): lock drawer.tsx + tabs.tsx motion escape hatches (kenji audit #3+#4)#219
jackwener merged 2 commits into
mainfrom
yuejing/fe-bug-hunt-13

Conversation

@jackwener

Copy link
Copy Markdown
Member

PR-FE-BUG-HUNT-13 — sibling of PR #218 (which locked ui.tsx). Closes kenji's audit reminder 4-6 findings #3 + #4 (msg `6cc0e04d`).

drawer.tsx escape hatches (5)

Pattern Count Why
`cubic-bezier(0.32,0.72,0,1)` 2 iOS-style drawer settle curve, raw on backdrop opacity + popup transform. Should move to `--ease-drawer` token.
`duration-450` 2 drawer settle. Doesn't match any current `--duration-*`.
`transition-[transform,box-shadow,height,background-color]` 1 animating `height` is layout-trigger. Intentional — snap points (peek / half / full) drive variable height; `transform: scaleY` would distort children.
`backdrop-blur-sm` 1 same as kenji #6.
`z-50` 1 same convention as ui.tsx.

tabs.tsx escape hatches (3)

Pattern Count Why
`transition-[width,translate]` 1 active-tab indicator animates `width` (layout). Cleaner refactor is `translate + scaleX` with measured base, but needs measurement infrastructure not in place.
`duration-200` 1 matches `--duration-base` (200ms) by value, uses bare Tailwind.
`ease-in-out` 1 generic, not project's `--ease-out-strong`.

Approach

Same as PR #218 (ui.tsx contract): pin EXACT count of each allowlisted pattern. Adding new sites OR removing stale entries both fail. Plus a sweep that verifies NO new `transition-[]` showed up beyond the allowlisted one in each file.

Not touching source — primitives need careful per-primitive review. Contract locks the perimeter.

Diff

`1 new file, +147 lines` — test only. No source change, no visual change. No overlap with PR #218 (different files) or any open PR.

Verification

Disk still ~100%, couldn't run tests. Greenfield contract is self-validating — first run confirms counts match current state. Counts derived from grep + manual read.

…ji audit #3 + #4)

Sibling of PR-FE-BUG-HUNT-12 (which locked ui.tsx). Closes kenji's
audit reminder 4-6 findings #3 + #4 (msg `6cc0e04d` 2026-06-24):

## drawer.tsx escape hatches (5)

- `cubic-bezier(0.32,0.72,0,1)` ×2 — iOS-style settle curve, raw on
  backdrop + popup. Should move to `--ease-drawer` token.
- `duration-450` ×2 — drawer settle duration. Doesn't match any
  current `--duration-*` token. Should tokenize.
- `transition-[transform,box-shadow,height,background-color]` ×1 —
  animating `height` is layout-trigger. Intentional because drawer
  snap points (peek / half / full) drive variable height and
  `transform: scaleY` would distort children. Layout-property
  transition is acknowledged here.
- `backdrop-blur-sm` ×1 — same finding as kenji #6.
- `z-50` ×1 — same convention as ui.tsx; pending tokenization.

## tabs.tsx escape hatches (3)

- `transition-[width,translate]` ×1 — animating `width` is layout-
  trigger. Cleaner refactor is `translate + scaleX` with measured
  base width, but that needs measurement infrastructure not in
  place. Layout transition acknowledged.
- `duration-200` ×1 — matches `--duration-base` (200ms) by value
  but uses bare Tailwind utility.
- `ease-in-out` ×1 — generic Tailwind easing, not project's
  `--ease-out-strong`.

## Approach

Same as PR-FE-BUG-HUNT-12 (ui.tsx contract): pin EXACT count of
each allowlisted pattern. Adding new sites OR removing stale
allowlist entries both fail. Plus a "no other layout transitions"
sweep that verifies no NEW `transition-[<bracketed-list>]` showed
up beyond the allowlisted ones.

Not touching source — touches primitive wrappers; each tokenization
needs kenji / WAWQAQ review per primitive. Contract locks perimeter.

## Diff

1 new file, ~140 lines test. No source change, no visual change.
No overlap with PR-FE-BUG-HUNT-12 (different file scope) or any
other open PR.

## Verification

Disk still ~100%, couldn't run tests. Greenfield contract is
self-validating — first run confirms counts match current file
state. The allowlist counts were derived from grep + manual read.
Verified counts via `grep -o ... | wc -l` before pushing PR #219 to
review and caught my own miscounts:

- drawer.tsx `z-50`: 1 → actual 3 (gesture wrapper, backdrop scrim,
  cushion overlay all stack at z-50)
- drawer.tsx had TWO additional `transition-[<bracketed>]` patterns
  I missed: `transition-[transform,box-shadow,height,background-color,
  margin,padding]` (drawer popup bottom-edge — worse layout trigger
  than the base, adds margin+padding) and `transition-[background-
  color,box-shadow]` (drawer-internal switch handle — paint-only,
  safe)
- tabs.tsx had ONE additional `transition-[color,background-color,
  box-shadow]` pattern (tabs trigger paint transition — paint-only,
  safe)

All five additions added to the allowlist with explicit reason. The
`no unexpected transition-[<bracketed>]` sweep rewritten to subtract
the full allowlist from the found set (set-difference) instead of
naively iterating, so it doesn't false-fail when there are multiple
paint-only patterns.

Pre-push count verification is now baked into the test contract
itself — if a future maintainer changes a count without re-running,
the test will fail loudly.
@jackwener
jackwener merged commit 05f15df into main Jun 24, 2026
@jackwener
jackwener deleted the yuejing/fe-bug-hunt-13 branch June 24, 2026 17:33
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