Skip to content

fix(cli): pages built with Tailwind v4 publish - #1191

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/tailwind-v4-publish
Nov 4, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/tailwind-v4-publish

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

What changed

patchy publish refused every page built with Tailwind CSS v4: "Could not inspect the HTML bundle." Tailwind's preflight has nested @supports conditions, and css-tree reports a parse error each time it tries one grammar on a condition and moves on to the next. The bundle check threw on every report. Now it throws only when css-tree couldn't read something, so Tailwind v4 pages publish, from a repo or as a single HTML file. A url() inside an @supports block is still found and refused.

The look check had the same bug: a look with a nested condition, such as @layer look { @supports ((display:grid)) { … } }, was refused with "could not be parsed: Identifier is expected". It now follows the same rule.

Closes #1190

Look at

The onParseError rule in packages/patchy/src/bundleCheck.ts. css-tree's condition parser backtracks with parseWithFallback(…, () => null). It tries a supports declaration, reports the miss with a null fallback, rewinds, and rereads the same tokens as a nested condition. If that fails too, it reports again with a real fallback node (general-enclosed, or Raw for unreadable text), and the check still throws. On Tailwind 4.3.3's real output, every error css-tree reports has a null fallback, and the tree has no Raw nodes.

CSS Before After
Tailwind v4's preflight conditions could not inspect publishes
@supports ((-webkit-hyphens:none) and …) { body { background-image: url("https://…") } } could not inspect refused: external CSS url()
@supports (((( {…}, @supports ((x) and (y) {…} could not inspect could not inspect
color: red; broken; … (the existing test) could not inspect could not inspect

Other options I ruled out:

  • Upgrading css-tree. 3.2.1 is the latest release.
  • Ignoring parse errors inside @supports preludes. That needs offsets mapped back to at-rules, and it would also accept conditions css-tree truly can't read.

The same rule in packages/core/src/look.ts. The look check records an error for every report css-tree makes, so a valid nested @supports inside @layer look was refused. It now records only reports with a non-null fallback. Every other check it makes on the parsed CSS is unchanged: tokens only in :root, references, !important and escapes. The server's look API and patchy look both use this function.

pageImports.ts needs no change. It parses with css-tree's default onParseError, which recovers instead of throwing, and the repo publish below runs it over Tailwind's CSS.

The tests, red then green. Here are the new tests running against main's bundleCheck.ts:

× publishes Tailwind v4's preflight @supports conditions
  Caused by: SyntaxError: Identifier is expected
× refuses document-local blob assets and external CSS resources
  AssertionError: expected 'Could not inspect the HTML bundle. Us…' to include '\n- <style>: external CSS url()'

On the branch: Tests 8 passed (8).

The new look test, against main's look.ts:

× reads nested @supports conditions inside @layer look, and checks what they hold
  AssertionError: expected [ …(2) ] to deeply equal []
  +   "look.css:21 could not be parsed: Identifier is expected.",
  +   "look.css:21 could not be parsed: Colon is expected.",

On the branch: Tests 39 passed (39). The same test also checks that an external url() inside the condition is still refused.

How it was verified

I built a page with Tailwind v4 (4.3.3, its own CLI) in a scratch project and ran it against a local instance (pnpm dev). Each publish ran first with main's bundleCheck.ts restored, then with the branch's. Output is trimmed to the point.

Single file. The Tailwind CSS is inlined in one HTML file, built both with and without --minify.

== main
$ patchy publish ./page.html --name tailwind-v4 --json
{"ok":false,"error":"Could not inspect the HTML bundle. Use valid, supported CSS with embedded resources.","kind":"local"}
exit 1
$ patchy publish ./page.min.html --name tailwind-v4-min --json
{"ok":false,"error":"Could not inspect the HTML bundle. Use valid, supported CSS with embedded resources.","kind":"local"}
exit 1
== branch
$ patchy publish ./page.html --name tailwind-v4 --json
{"ok":true,…,"name":"tailwind-v4",…,"tier":1,…,"warnings":[],…}
exit 0
$ patchy publish ./page.min.html --name tailwind-v4-min --json
{"ok":true,…,"name":"tailwind-v4-min",…,"tier":1,…,"warnings":[],…}
exit 0

Repo. I ran patchy init, kept Tailwind's compiled CSS in the repo as src/tailwind.css, and imported it from src/main.tsx.

== main
$ patchy publish --json
{"ok":false,"error":"Could not inspect the HTML bundle. Use valid, supported CSS with embedded resources.","kind":"local"}
exit 1
== branch
$ patchy publish --json
{"ok":true,…,"name":"tw4-patch",…,"tier":1,…,"warnings":[],…}
exit 0
Single file Repo
Tailwind v4 page published as one HTML file Tailwind v4 page published from a patch repo

An external url() hidden in a Tailwind page's @supports block, on the branch:

$ patchy publish ./page.external.html --name tailwind-v4-external --json
{"ok":false,"error":"The HTML bundle is not self-contained or uses unsupported external dependencies:\n- <style>: external CSS url()\nInline every resource in the HTML, for example as a data: URL.","kind":"local"}
exit 1

Checks. After the look fix, I ran pnpm lint and pnpm typecheck (both pass), plus the focused suites look.test.ts, LookApi.test.ts, cliLook.test.ts and repoBuild.test.ts (all pass). Before it, I ran pnpm check locally:

  • Format, lint, typecheck and synth pass.
  • Some offline tests failed with a stray GET / on CLI and execution stub servers. That's a local port probe on this machine, and the failing set changed between runs. repoBuild.test.ts and PatchesApi.test.ts pass on their own.
  • I didn't run pnpm verify locally, because the machine is shared. CI judges.

Release impact

Tick exactly one.

  • Breaking — requires action from anyone already running this

  • Not breaking — no action required. The CLI and the look check now accept CSS they used to refuse, and still refuse everything they refused before except css-tree's own backtracking reports.

  • What does a revert leave behind? A company look published in the meantime with a nested @supports condition, such as @supports ((display:grid)) and (not (margin-trim:inline)). Nothing re-checks a stored look, so it stays the company's look after a revert. Pages and Tailwind v4 repos published in the meantime stay published.

  • Does the release before it still work with that? Not fully. It serves the stored look as is. But every repo that imports the company's look.css (the starter's src/main.tsx does) gets that CSS in its bundle, and the release before refuses the bundle with "Could not inspect the HTML bundle". Repo publishes in that company then fail until an admin runs patchy look restore to a revision without the nested condition. Before rolling back past this PR, check patchy look for a nested @supports and restore an earlier revision first if there is one. A repo refreshed while the nested look was current keeps it in patchy/_generated/look.css until it runs patchy refresh again, and a single-file page that copied the look's CSS needs that CSS replaced.

Built by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code.

@github-actions github-actions Bot added area:cli Touches the cli area size:s Under 100 changed lines labels Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review (GPT 6.1 Sol, xhigh) on 0fb800a: PASS with notes.

  • The rule is safe. css-tree 3.2.1 rewinds before calling the fallback. Only Condition.js:58 and :82 return null, and both retry the same tokens straight away. Nested conditions stay walkable, and a failed recovery still throws or yields rejected Raw content.
  • No bypass in 611 smuggling cases: odd and invalid @supports, url(), image-set(), imports, malformed declarations, custom properties, escapes, @media, @container, @layer and @font-face. The accepted cases made zero requests in Chromium.
  • Real Tailwind 4.3.3 output passes, minified and not, as a single file and from a repo. An external URL inside nested @supports is still refused.
  • Note: look.ts has the same existing bug for nested @supports in look CSS. It's being fixed in this PR with the same rule.

@github-actions github-actions Bot added the area:core Touches the core area label Nov 1, 2026
@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Nov 1, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked be4e6043ec540dc6825d136f913027e41f2477b4 (base 1f187a92b2c20da81e8a1d647ea28a60a075d6ef) on team, by Claude Opus 5.5 in Claude Code, through T3 Code. This re-check supersedes my earlier FAIL at the same head. I re-read the PR body and labels only; the functional checks below come from that run.

Done means

  • Tailwind v4's real output publishes, as a single file and from a repo: passed. Built with Tailwind 4.3.3's own CLI. On main, both are refused with "Could not inspect the HTML bundle"; on the head, both publish and render styled for another member (200, no browser errors).
  • A resource inside @supports is still found and refused: passed. A hand-written url() and one generated by a Tailwind supports-[…]:bg-[url(…)] class are refused with external CSS url() on the head, as a single file and in a repo. In a probe of 448 @supports cases against Chromium, the head refused all 156 that loaded an external resource.
  • Tests cover both: passed. repoBuild.test.ts and look.test.ts pass (47 tests), and so does every CI check.
  • Looks with nested @supports: passed. look preview and look publish accept them on the head. With an external url() inside, the CLI refuses them and the server's look API answers 422.

Golden journeys

  • Publish a page: passed.
  • The others: not run. The diff doesn't touch them.

Rollback answers: they now match the diff. The one-way label is on. The answers name the stored look with a nested @supports and the previous release refusing repo bundles that import look.css. They give patchy look restore as the way out and say to check patchy look before rolling back.

Not run

  • A full live → head → live rehearsal: shown in three parts instead. The head stores the look, nothing re-checks a stored look, and main's own checkBundle refuses the built bundle.

Notes

  • The restore alone doesn't clear repos. A repo generated or refreshed while the nested look was current keeps it in patchy/_generated/look.css after a restore. Its publish keeps failing on the previous release until it runs patchy refresh. A single-file page that inlined the look needs its CSS replaced. The rollback line could name the refresh too.

@allisonmahmood
allisonmahmood force-pushed the fix/tailwind-v4-publish branch from be4e604 to 63447c2 Compare November 4, 2026 01:42
@allisonmahmood
allisonmahmood merged commit 4c6b2f5 into main Nov 4, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the fix/tailwind-v4-publish branch November 4, 2026 01:54
allisonmahmood added a commit that referenced this pull request Nov 4, 2026
…ges publish (#1241)

## What changed

This adds release 36's What's new entry, written from `1acc968`. It
covers everything merged since release 35's `through` (`dd0e2ec`), and
sets the `patchy` release to `0.36.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Improved: shortcuts work where you use them (keys for one part of a
patch, the closest wins, text boxes keep their typing keys) | #1231 |
| Improved: the shortcuts sheet shows what works where you are (Ctrl+/
and ⌘/ open it, its commands run, it opens from a patch's menu and in
view on a narrow screen, keeps the look, spells keys out away from a
Mac) | #1231, #1181, #1178, #1180, #1177 |
| Fixed: keys pressed while a patch opens reach it | #1183 |
| Fixed: pages styled with Tailwind 4 publish, and a look with the same
rule saves | #1191 |
| Fixed: an old copy of a patch no longer replaces newer work
(**Breaking** for such a copy: it needs `patchy pull` or one
`--allow-behind` publish) | #1179 |
| Improved: your agent can check a publish before sending it | #1188 |
| Improved: your agent hears what changed when it updates a patch |
#1186, #1185 |
| Fixed: your agent stops chasing false alarms (`pnpm install` exit
codes, `manifest.json` bytes, the description notice, a copied dev
record) | #1176, #1174, #1175 |
| Behind the scenes: fuller hotkeys instructions for agents; fewer
redraw costs for patches with many shortcuts | #1182, #1187 |

`patchChanges` has three sentences for the agent refreshing a patch
across this release:
- #1231's, from its PR: text fields keep their keys, `preventDefault()`,
and the sheet's Mod+/ and `.hotkey-row` buttons.
- The sheet's dialog renders in `document.body`, and element-only page
rules don't reach it (#1178, #1180). Its own row lists last (#1181). The
hotkey label helpers take only valid literals (#1177).
- Publish's `unknown_base_version` (#1179).

It also rewords release 33's "Press ? to see every shortcut a patch
has". That was true only for a patch that mounts the shortcuts sheet, so
it now says a patch *can* list its shortcuts.

The rest get no line:
- #1206, #1207, #1209 and #1220 are `pnpm dev eval` tooling.
- #1222 is release 35's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`, and release 33's reworded line.
- **Rollback safety, from the live commit `d28fdd0` (release 35) to
`1acc968`:**
- #1191 is labelled `one-way`. Its Release impact: a company look
published after this release with a nested `@supports` condition stays
stored after a revert. Release 35 refuses any bundle carrying it, so
repo publishes in that company would fail until an admin runs `patchy
look restore` to an earlier revision. Pages and Tailwind 4 repos already
published stay published.
- #1183 is the only change to what the server serves browsers: the
shell's script, under a digest-named URL. Its revert leaves nothing
behind.
- The hotkeys PRs change `patchy/hotkeys`, which patches bundle when
they are built. Published patches keep their copy.
- The CLI PRs change what a CLI writes and refuses. Release 35 reads
everything they leave behind: #1176's `allowBuilds` entry, #1174's
indented `manifest.json`, and the `version` recorded by an
`--allow-behind` publish.

**Rollback line:** If this release misbehaves, roll back to `d28fdd0`
(release 35). First check that no company's look has a nested
`@supports` condition, and `patchy look restore` an earlier revision
where one does (#1191).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `WhatsNewPages.test.ts` and
`schemas.test.ts` pass (22 tests), and `bun fmt` passes on the changed
files.
- **Facts.** The sheet's new `document.body` home and its element-rule
reset were checked against `hotkeys.ts` and `hotkeySheet.ts` on main.
- **Deploy state.** I pinned the live commit from `/healthz/deep`:
`d28fdd0` (release 35). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Text and version numbers only. Like every release, the `0.36.0` bump
tells CLIs and patch repos installed before this deploy to upgrade.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3
Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Touches the cli area area:core Touches the core area one-way Rolling production back past this PR would break the release before it size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish refuses every Tailwind v4 page: the bundle check rejects nested @supports conditions

1 participant