Repository navigation
Description
Summary
Upgrade tailwindcss 3.4.3 → 4.3.3. That is the deliverable now, not the fallback.
The upgrade is also the exit from the unpatched braces DoS advisory
(GHSA-vfj7-8cjw-p6xm, high, CVSS 7.5,
CVE-2026-93687, vulnerable <=3.0.3, no published fix). [email protected] has zero
dependencies, so the six paths that reach braces leave the production graph with it.
Measured, not assumed. A scratch lockfile resolved with [email protected],
[email protected], tailwind-merge@^3.7.0 and @tailwindcss/[email protected], with
autoprefixer dropped, gives pnpm audit --prod → 0 high, 0 critical. braces is gone from
--prod entirely. What remains is what remains today and is ungated: payload and fast-uri
(moderate), dompurify (low).
[email protected] (today) |
[email protected] |
|
|---|---|---|
| own dependencies | 23 | 0 |
pnpm audit --prod high |
1 (braces) |
0 |
| PostCSS entry | tailwindcss |
@tailwindcss/postcss |
| config | tailwind.config.js |
CSS-first @theme in globals.css |
Staying on 3.x is not an exit
[email protected] is published on the v3-lts dist-tag, so "upgrade within 3" looks like a
cheap third option. It is not: 3.4.19 still declares chokidar, fast-glob and micromatch,
which are three of the six paths. Measured off the registry metadata. The braces edge survives
every 3.x.
Approach
Three phases, one PR, in this order. Phase 1 is independent and unblocks everyone; phases 2 and 3
are the upgrade.
Phase 1 — book the advisory, so CI goes green
scripts/audit-baseline.json:29 is "advisories": {}, so node scripts/check-audit.mjs exits 1
on main today and every PR here is red on Dependency Audit. Confirmed by running it:
New high/critical advisories (1): GHSA-vfj7-8cjw-p6xm (braces).
Add the one entry keyed by the GHSA id, with a one-line reason naming this ticket.
scripts/check-audit.mjs:188 compares the audit's gated ids against those keys, and
.github/workflows/ci.yml:76 runs it on every PR. The lean gate
(.claude/skills/pr-prep/check.sh) does not include audit:check, so this failure is
invisible locally and shows up only in CI.
Phase 3 deletes the entry again. Both halves belong in this ticket: the weekly
audit.yml --strict run fails on a baseline entry whose advisory no longer reports, so leaving
the line behind turns the ratchet red.
Phase 2 — the cascade and the units. This is the hard part.
Two invariants this repo already holds break by default under v4. Both were measured by compiling
a probe sheet through @tailwindcss/[email protected], not read off the migration guide.
1. v4 emits real cascade layers, and that inverts #156. v3 strips its own @layer and emits
flat rules. v4 emits @layer theme, base, components, utilities; and wraps everything in them.
src/styles/globals.css:45 already states the trap, aimed at the opposite direction: unlayered
author styles outrank every author layer, so layering our sheet hands a host page's
button { … } an automatic win over our utilities. v4 does that to us by default, for the whole
utility set — a host-visible regression in the defensive reset, not a cosmetic one.
Mitigation, measured: import the parts without a layer() clause and the output carries zero
@layer at-rules, matching v3's cascade position exactly.
@import 'tailwindcss/theme.css' source(none);
@import 'tailwindcss/preflight.css';
@import 'tailwindcss/utilities.css' source(none);
@source './index.html';
@source './src';
@source './.ladle';This replaces @tailwind base; @tailwind components; @tailwind utilities;
(src/styles/globals.css:134). source(none) plus explicit @source lines keep the deliberate
content behaviour from tailwind.config.js:157 — scan all of src, so a directory rename never
silently drops a utility.
2. v4's default theme is rem, and pnpm assert:css fails the build on one. The probe emitted
--spacing: 0.25rem, --text-sm: 0.875rem, --radius-lg: 0.5rem from a handful of utilities.
scripts/assert-css-scoped.mjs:65 allows rem only in the lazy CalendarView-* chunk (#238), so
every one of these fails the build.
TAILWIND_REM_TO_PX (tailwind.config.js:24) is the v3 answer and has to be re-expressed as
@theme. It gets shorter: v4 derives the spacing scale from one variable, so
@theme { --spacing: 4px; }re-pins all 37 entries — .p-4 compiles to padding: calc(var(--spacing) * 4). Measured: with
that one line the probe output contains zero rem. preflight.css ships no rem of its own, so
the theme variables are the entire surface.
Re-pin in px, each against the table it replaces: --spacing (one line), --radius-*
(borderRadius, tailwind.config.js:25), --text-* (fontSize, both the TAILWIND_REM_TO_PX
block and the overriding one at tailwind.config.js:200), --leading-* (lineHeight),
--container-* (maxWidth plus columns). maxWidth is a function taking { theme, breakpoints }
(tailwind.config.js:95); v4 has no breakpoints() helper, so those keys get written out.
Phase 3 — the mechanical migration
Each item below is a known call site, not a sweep.
postcss.config.js:13— swaptailwindcss()for@tailwindcss/postcss, drop
autoprefixer(v4 prefixes through lightningcss). Keep the PostCSS entry point; do not take
@tailwindcss/vite.scopeWidgetCsshas to run last over the finished sheet, Tailwind's
generated output included. The Vite plugin does Tailwind's work outside the PostCSS chain, so
the scoping pass would stop seeing the utilities it exists to confine — andpnpm assert:css
is a post-build gate, so the leak would reachdist/before anything complained.darkMode: 'class'(tailwind.config.js:258) →@custom-variant dark (&:where(.dark, .dark *));.
Measured:dark:bg-primarycompiles to.dark\:bg-primary:where(.dark, .dark *), which keeps
working withsrc/hooks/use-theme.ts:23and Ladle's theme addon (.ladle/config.mjs) unchanged.<alpha-value>is gone — 4 call sites,tailwind.config.js:10,:12,:13,:188.
v4 handles the/50modifier itself: measured,bg-primary/50emits
color-mix(in srgb, hsl(var(--primary-9)) 50%, transparent)with an@supportsupgrade to
in oklab. SobrandScalebecomes plain--color-primary-*: hsl(var(--primary-N))entries and
the opacity modifiers keep working. ⚠ The blend moves from HSL alpha tocolor-mixin oklab —
a real visual delta on every/NNutility, which is part of what the browser pass checks.radixScale(tailwind.config.js:19) needs no change in substance — solidvar(--gray-N)
values become--color-gray-*entries.theme.extend.opacity(tailwind.config.js:195) →@theme { --opacity-hover: 0.8; --opacity-disabled: 0.5; }. Measured:opacity-hoverstill generates, which keeps
src/styles/globals.css:358(@apply text-primary hover:opacity-hover !important) compiling.fontFamily(tailwind.config.js:239) →--font-sansetc.defaultTheme.fontFamily.*has
no v4 equivalent import, so the fallback stacks get written out. The
var(--sy-font-sans, "Atlas Rethink Sans")indirection and the fix(ui): scope widget css so it cannot restyle the host page #91 reasoning above it carry
over verbatim;src/styles/fonts.test.tscovers the family name.backgroundImage(tailwind.config.js:254) →--background-image-circle-pattern.tailwind-variants0.1.20 → 3.3.1, andtailwind-mergebecomes a direct dependency.
0.1.20 bundlestailwind-merge@^1.14.0as a dependency; 3.3.1 declares it as a peer at
>=3.0.0. v1's merge tables do not know v4's class names, so this upgrade is not optional —
it is what makestv()'s conflict resolution correct.tailwind-variantskeeps its
tailwindcss: '*'peer, which is now harmless: the edge resolves to a package with no
dependencies.prettier-plugin-tailwindcss0.6.14 → 0.8.1 for v4 class sorting. A full
pnpm lint:fixpass will reorder class strings acrosssrc/. ⚠jsx-sort-propsautofix moves
props and leaves comments where they sat (docs/rules/code-comments.md) — re-read every JSX
opening element the sweep touched.- The scoping pass itself needs no change.
isNested()
(scripts/postcss-scope-widget.mjs:426) skips only rules with arule-type ancestor, and
@layeris an at-rule — so had we kept the layers, rules inside them would still be scoped and
still asserted. Phase 2 removes the layers anyway. v4 does emit nested@supportsinside
rules, which the pass sees more of than before, soscripts/postcss-scope-widget.test.tsis
the spec to extend. tailwind.config.jscan be deleted once@themecarries everything. ⚠ Do not keep it
alive through@config: that is the v3 compatibility path, and<alpha-value>and the
breakpoints()helper are exactly what it exists to preserve — a half-migrated config is a
second source of truth for the token set.
Acceptance criteria
-
scripts/audit-baseline.jsonbooksGHSA-vfj7-8cjw-p6xmagainst this ticket in Phase 1, and
pnpm audit:checkexits 0. -
[email protected]and@tailwindcss/[email protected]installed;autoprefixerremoved;
tailwind-variants@^3.3.1andtailwind-merge@^3.7.0installed. -
GHSA-vfj7-8cjw-p6xmno longer reported bypnpm audit --prod, and its baseline entry is
deleted in the same PR. - The emitted CSS carries no
@layerat-rule, so the feat(widget): de-brand the widget and keep host CSS out of it #156 reset keeps its cascade position. -
pnpm buildpasses,assert:cssincluded — noremoutside theCalendarView-*chunk. -
tailwind.config.jsis deleted, and no@configdirective replaces it. -
docs/embedding.md's Browser support table andCHANGELOG.mdboth state the Firefox floor
this moves (see Downstream impact).
Verification checklist
-
node scripts/check-audit.mjsexits 0 after Phase 1. -
pnpm audit --prod --json | grep GHSA-vfj7-8cjw-p6xm— matches after Phase 1, no match
after Phase 3. -
node scripts/check-audit.mjs --strictexits 0 after the baseline entry is deleted. It exits
1 if the entry is left behind, which is the ratchet. -
pnpm buildsucceeds. Thengrep -c '@layer' dist/**/*.js→ 0, andpnpm assert:csspasses. -
pnpm sizestays inside budget. Record the new numbers beside the budget in
scripts/check-bundle-size.mjs— the eager payload changes, and the loader/embed graphs must
still share no chunk. -
pnpm lint && pnpm typecheck && pnpm test:run(the lean gate) andpnpm ladle:build. - A browser pass over all 50 stories in both themes —
pnpm ladle, light and dark. This is
the gate the automated lane cannot be: a wrong@themevalue compiles cleanly and just looks
wrong. The/NNopacity utilities (nowcolor-mix) and everyTAILWIND_REM_TO_PXscale are
what to look at. -
pnpm review:embedafterpnpm build— a real host-page embed, checking the feat(widget): de-brand the widget and keep host CSS out of it #156 direction
specifically: a host rule onbutton,a,div,letter-spacingandline-heightmust
still lose to our utilities. - Spot-check the three
@layer components/@layer utilitiesblocks in
src/styles/globals.css:320-360still compile their@applylines,bg-panel,
flex-centerandcolored-linksincluded.
Open questions
- Which Firefox floor ships? v4 needs 128;
docs/embedding.mdpublishes 114.
Raise the documented floor, or hold the upgrade? Chrome 111 and Safari 16.4 already match
v4's own floor, so Firefox is the only gap. -
Which exit — wait forUpgrade. Decided in the thread.[email protected], or upgrade? -
Is an availability-only advisory worth a major CSS upgrade?Yes. Decided in the thread.
Downstream impact
docs/embedding.md and CHANGELOG.md, in this PR. The Browser support table publishes
Firefox 114; Tailwind 4 requires 128. That is a host-observable contract change, and those two
files are the only documentation an embedding site reads.
No CSP row changes: v4 adds no origin, and the stylesheet still injects through
vite-plugin-css-injected-by-js. No SahajCloud or SahajAtlasWordpress change — the atlas URL
contract and the CMS types are untouched.
Notes
- A
pnpm.patchedDependenciespatch ofbraceswould not clear the gate.pnpm auditmatches
installed versions against the advisory range, not patched content, so the finding survives the
fix. It is not a third exit. pnpm.auditConfig.ignoreGhsasis closed off on purpose.scripts/check-audit.mjstreats its
presence as a failure rather than a waiver, and turns the PR red.- Moving
tailwindcsstodevDependenciesdoes not work, measured. Entry moved, lockfile
rebuilt withpnpm install --lockfile-only,node scripts/check-audit.mjsstill exits 1 on the
same GHSA, becausetailwind-variantskeeps the peer edge in the production graph. Recorded
because it is the obvious shortcut and it is a dead end. Phase 3 makes it moot either way. - Two non-gated findings sit beside this one, out of scope here:
fast-uri(moderate, patched
>=3.1.8) anddompurify(low, patched>=3.4.16). Both are fixable in range. - Every measurement above came from
[email protected]/@tailwindcss/[email protected]compiled
through PostCSS 8.5.26, and from a scratch lockfile resolved with pnpm 9.15.0.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Oct 3, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
fix(ci): book the braces advisory in the audit baseline
sydevs-bot commentedon Oct 3, 2026
Revised from the code. One claim in the body was false, and it matters.
scripts/audit-baseline.json:29is"advisories": {}, sonode scripts/check-audit.mjsexits 1 onmaintoday. Every PR here is red on Dependency Audit until that entry lands. The booking is now Phase 1 of## Approach.[email protected]declarestailwindcss: '*'as a peer, and pnpm resolves it into the production graph. Six distinct paths reachbraces, not three.tailwindcsstodevDependenciesdoes not even silence the gate. Measured: entry moved,pnpm install --lockfile-only,pnpm audit:checkstill exits 1 on the same GHSA. The refusal stands, for a better reason.Hold Untilwould block Phase 1, which is live work.Priority High — the red gate blocks other work. Effort Easy. No tailwindcss 4 ticket filed; that is an open question for you.
@sydevs-bot implementstarts the work.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Oct 3, 2026
@sydevs-bot Revise this ticket as an upgrade to tailwindcss 4
[-]chore(deps): braces DoS advisory has no patch — tailwindcss 3 is its only path in[/-][+]chore(deps): upgrade tailwindcss 3 → 4, which is also the exit from the unpatched braces advisory[/+]sydevs-bot commentedon Oct 3, 2026
Reshaped as the tailwindcss 4 upgrade. Title changed — it named the advisory, now it names the deliverable.
Every claim below is measured:
[email protected]givespnpm audit --prod0 high.[email protected](v3-lts) still declareschokidar,fast-globandmicromatch.button {}would beat our utilities. Fix: import the parts withoutlayer()— measured, zero@layeremitted.assert:cssfails on one (fix(ui): a host's root font size shrinks the side panel #238).@theme { --spacing: 4px }re-pins all 37 entries.Phase 1 (book the advisory, green CI) stays. Phase 3 deletes the entry — the
--strictratchet needs both halves in one PR.Effort Easy → Hard. One open question for you: v4 needs Firefox 128,
docs/embedding.mdpublishes 114.@sydevs-bot implementstarts the work.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Oct 3, 2026
@sydevs-bot implement and raise the documented browser floor as needed
fix(ci): book the unpatched braces advisory
Merge origin/main into claude/chore-244-production-smoke
Merge origin/main into claude/fix-232-sentry-dsn
chore(build): cut the budget history to figures and a line each