Skip to content

fix: keep multi-style tsrx components analyzable under tsrx-tsc - #745

Merged
trueadm merged 1 commit into
mainfrom
claude/modest-babbage-1714fd
Aug 12, 2026
Merged

trueadm merged 1 commit into
mainfrom
claude/modest-babbage-1714fd

Conversation

@trueadm

@trueadm trueadm commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

pnpm typecheck:files packages/octane/tests/_fixtures/return-style.tsrx (or any selection including it) failed with 8 parse errors — TS1381 "Unexpected token. Did you mean {'}'}" / TS1005 "'}' expected" — on a fixture that is valid octane tsrx.

Root cause is in the tsrx type-only toolchain, not the fixture: one component may split its scoped CSS across several <style> blocks (compile.js applyCssScoping rebases every sheet onto the first block's canonical hash, and return-style.test.ts proves it through mount, SSR, and hydration), but @tsrx/core's shared type-only JSX transform threw TSRX fragments can only have one style tag. When the volar compile throws, tsrx-tsc falls back to presenting the raw source as the virtual TSX, so every CSS brace becomes a TSX parse error.

Changes

  • patches/@[email protected] (+ pnpm-workspace.yaml entry): the type-only path now accepts multiple sheets per component scope and rebases them onto the first sheet's hash (per-sheet apply_css_definition_metadata accumulates into the component's class-map metadata, so style refs compose). Runtime (non-typeOnly) transforms keep the throw — @tsrx/react's differential-rig compile is unchanged. Remove once the fix ships upstream (same precedent as the superseded 0.1.37/0.1.40 parse patches).
  • tests/compiler/volar.test.ts: regression — a split-style component stays analyzable (no errors, both CSS blocks surface as embedded regions, no raw CSS leaks into the TSX). Fails with the original throw on unpatched core, so a core bump that drops the patch prematurely trips it.
  • tests/_fixtures/return-style.tsrx: typed the props parameter (an untyped props is a noImplicitAny error per the authoring rules; visible once the semantic phase can run).
  • scripts/typecheck-files.mjs: the directory walker now skips hidden directories — the differential rig's .react-cache/ compiled output was entering sweeps as JS roots and silently flipping allowJs for the program depending on whether the differential suite had run.
  • packages/*/audit/react-parity.json + evals manifest: pnpm sync regeneration (lockfile hash re-pin after the patch entry).

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test — 20,934/20,938; the 4 failures were real-browser Playwright suites (doom-production, browser/native-change: matcher/waitForFunction timeouts and a vite 504 Outdated Optimize Dep race under full-suite load); both pass in isolation (7/7 and 12/12) and don't touch this change's surface
  • targeted tests: tests/compiler/volar.test.ts 14/14 (incl. new regression); return-style + style + style-map + deopt-style-patch + differential basic/features-namespace — 172/172
  • pnpm typecheck:files packages/octane/tests/_fixtures/return-style.tsrx clean; the packages/octane/tests sweep contains zero TS1381/TS1005

Deliberately left unverified: nothing in this diff, but see the follow-up below for what the sweep now honestly reports.

Risk / follow-ups

  • The tests sweep was never actually clean. tsrx-tsc stops after syntactic diagnostics, so this fixture's parse errors were aborting the semantic phase for the whole 849-file program. With them fixed, pnpm typecheck:files packages/octane/tests reports ~3,094 pre-existing semantic errors (untyped fixture props TS7006, {n as string} number casts TS2352, .tsx-extension imports TS5097, …) — each reproducible per-file on pristine main (e.g. pnpm typecheck:files packages/octane/tests/_fixtures/hooks.tsrx). Corpus cleanup is spun off as its own task.
  • Related finding for that follow-up: tsrx-tsc resolves octane's own .tsrx under the @tsrx/react platform (the differential devDependency wins the plugin's workspace walk); a tsconfig root-level "tsrx": { "compiler": "octane/compiler/volar" } overrides it, but flipping platforms changes the corpus's error mix and should be decided deliberately.
  • External octane consumers install unpatched @tsrx/core, so their editors/tsrx-tsc still hit the throw on multi-style components until the typeOnly allowance is upstreamed to the ripple monorepo.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


Note

Low Risk
Low risk: scoped to type-only @tsrx/core transform and tooling; runtime still throws on multiple style tags. Patch maintenance if core is bumped without upstream fix.

Overview
Fixes tsrx-tsc / Volar breaking on Octane components that split scoped CSS across multiple <style> blocks. A patched @tsrx/[email protected] lets the type-only JSX transform accept several sheets per scope, rebase them onto one hash, and keep emitting proper virtual TSX instead of falling back to raw source (which turned CSS braces into TS1381/TS1005).

Adds a Volar regression test for split-style components, types return-style.tsrx props, and updates typecheck-files.mjs to skip hidden dirs (e.g. .react-cache/) so compiled artifacts do not pollute sweeps. pnpm-lock.yaml, package react-parity audits, and evals overlay lockfile hashes are refreshed for the new patch.

Reviewed by Cursor Bugbot for commit 3c7f47a. Bugbot is set up for automated code reviews on this repo. Configure here.

One component may split its scoped CSS across several <style> blocks —
compile.js rebases every sheet onto the first block's canonical hash, and
tests/_fixtures/return-style.tsrx proves it through mount, SSR, and
hydration. @tsrx/core's shared type-only JSX transform instead threw "TSRX
fragments can only have one style tag", and tsrx-tsc's fallback then
presented the raw source as the virtual TSX, so every CSS brace surfaced as
TS1381/TS1005 parse errors and the syntactic abort hid the rest of the
program's diagnostics.

Patch @tsrx/core 0.1.56 (pnpm patch) so the TYPE-ONLY path accepts multiple
sheets and rebases them onto the first sheet's hash; runtime transforms keep
the throw, so @tsrx/react's differential compile is unchanged. Add a volar
regression test that fails with the original throw on unpatched core, type
the fixture's props param, and stop the typecheck-files walker from
descending into hidden directories (the differential rig's .react-cache
compiled output was entering sweeps as JS roots and flipping allowJs).

Co-Authored-By: Claude Fable 5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 12, 2026
@trueadm
trueadm marked this pull request as ready for review August 12, 2026 21:39
@trueadm
trueadm merged commit ecc7700 into main Aug 12, 2026
48 checks passed
@trueadm
trueadm deleted the claude/modest-babbage-1714fd branch August 12, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant