Skip to content

feat(compiler): reject Strong .tsx and .jsx modules - #2057

Merged
trueadm merged 8 commits into
mainfrom
feat/strong-ban-tsx
Oct 14, 2026
Merged

trueadm merged 8 commits into
mainfrom
feat/strong-ban-tsx

Conversation

@trueadm

@trueadm trueadm commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Follows #2055, now merged; main is merged in, so the diff is this change alone.

Summary

Strong mode becomes a .tsrx/.ts/.js language. JSX in a .tsx or .jsx module lowers to element descriptors, which render through the generic descriptor renderer instead of compiled templates. A .tsx/.jsx module that Strong reaches is now a compile error, OCTANE_STRONG_TSX_MODULE.

  • Both opt-ins error. A module's own "use strong" directive and the application compiler.strong policy both report it. Under the policy, app-wide .tsx files no longer fall back silently to compatibility mode. Installed and linked dependencies keep their own mode through _hasApplicationStrongPolicy, unchanged.
  • One check point. The check lives in analyzeStrongMode, which client and server compile, collectDiagnostics, and Volar (compileToVolarMappings) all share. Every path reports the same code at the same location: the "use strong" string, or 1:1 when only the policy applies.
  • The rest of the analysis still runs. collectDiagnostics and octane analyze --strong-preview list the .tsx module's other findings beside the new code, and --fix still applies its rewrites.

Why

#2055 banned descriptor APIs in Strong .tsrx/.ts, but .tsx return <jsx> and JSX values always lower to descriptors, so .tsx was the remaining hole. Per Dominic's suggestion, .tsx is banned outright rather than taught to compile to templates. In this repo only 2 Strong modules were .tsx (both test fixtures), against 99 .tsrx.

Changes

  • Compiler (strong-mode.js, strong-template-policy.js, strong-html.js):
  • Catalog (strong-diagnostics.js):
    • Adds the new entry, with the website anchor generated as for every other code.
    • Removes the .tsx wording from OCTANE_STRONG_MAP_JSX and OCTANE_STRONG_ELEMENT_API.
    • Rewrites all 10 migration recipes as .tsrx. The catalog test compiles them as .tsrx, and the generators emit tsrx fences for the website, MCP JSON, and MCP explain output.
  • Docs:
    • docs/strong-compiler-checks.md, the Strong sections of docs/differences-from-react.md and its website page, and the website Strong mode guide, including the adoption steps.
    • The Strong examples in build-tools.mdx, core-apis.mdx, and docs/tsrx-basics.md, rewritten as @{ … } .tsrx and compiled under Strong to check them.
    • The hand-written part of llms.txt, the MCP migrate-to-strong and react-divergences skills, the octane_compile tool description, and the Rsbuild/Rspack READMEs.
    • .rulesync/ had no guidance saying Strong works in .tsx, so nothing there changed.
  • Fixtures:
    • trusted-html.tsx becomes a Strong trusted-html.tsrx, so the trusted-HTML render, hydrate, and suspend coverage now runs through compiled templates.
    • for-strong.tsx becomes for-mapped.tsx without the directive. It remains the compatibility .map() counterpart in the snapshot-semantics comparison.
  • Tests:
    • About 460 Strong compiler probes compiled as .tsx now compile as .tsrx.
    • The tests that pinned Strong .tsx as valid are now tests of the new error: client, server, directive, policy, Volar location, and the full finding list.
    • Probes that only passed because a .map() list also reported OCTANE_STRONG_MAP_JSX now use @for rows or render callbacks.
    • The escaped createElement spellings moved to the OCTANE_STRONG_ELEMENT_API table, which keeps their coverage.

Validation

  • pnpm sync, then pnpm strong:diagnostics:check and node scripts/react-parity/check.mjs --validate-only
  • pnpm format:files:check on every changed file
  • pnpm typecheck:files on the changed sources, tests, and fixtures. The repo-wide pnpm typecheck is left to CI.
  • pnpm test: left to CI.
  • Targeted tests:
    • --project octane packages/octane/tests/compiler/: 4188/4189 pass. The one failure is the comment-scan timing check in compiler-vite-options.test.ts (11–14 s against 6 s under machine load). It passes when run alone and does not touch Strong.
    • octane and octane-prod: trusted-html, for, auto-calculation, strong-state-runtime.
    • octane: hydrate-compiler, signal-instance-identity, auto-memo, vite-void-import-cycles.
    • octane-signals-strong: signals-action-lifecycle.
    • cli (analyze), website-mcp-unit (compile-tool, mcp-server), rspack-plugin, vite-plugin, aria, apollo-client.
    • Shown to fail: with the check disabled, the 7 new or changed strong-template-policy and bundler-compiler tests go red. They pass again once it is restored.
  • perf-review: no runtime change. The scan's runtime scope reported 0 candidates. The compiler scope reported 1 layout-read candidate, dismissed because it sits inside a recipe's example string and never runs. Compile cost is one filename regex per Strong module, and the deleted factory branch removes a binding lookup per CallExpression in Strong modules. Emitted code for valid modules is unchanged by construction: the change only adds or removes diagnostics, and analyzeStrongMode returns the same analysis for non-.tsx files.
  • concise-code:
    • Size: src +129 −133 (runtime +0 −0). Hand-written compiler logic is +17 −45; the rest is catalog text and generated JSON.
    • New files: the changeset, and trusted-html.tsrx (a rename).
    • New exports: STRONG_TSX_MODULE, matching its neighbouring code constants.
    • Alternative considered: return early with only the new diagnostic (about 3 lines smaller). Rejected because --strong-preview and --fix would then see nothing else in a .tsx module, which is exactly the React-app migration case.
    • Bytes: not applicable, compiler-only.

Risk / follow-ups

  • App-wide policy now breaks on .tsx. An app with compiler.strong on and application .tsx modules now fails to build until they become .tsrx. This is intended, and the changeset (octane minor) and docs say so.
  • The octane/strong JSX type entry stays. Volar still selects it for Strong .tsrx. Only the advice to point .tsx at it is removed.
  • feat(compiler): reject element descriptor APIs and single-item @for in Strong mode #2055's unreleased changeset is corrected here. .changeset/strong-element-api.md said "Strong .tsx modules may keep these APIs"; this PR drops that clause and the "outside .tsx and .jsx" wording, since both changesets ship in the same release.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
App-wide compiler.strong now fails on any application .tsx/.jsx until migration to .tsrx, which is a breaking workflow change for adopters though emitted code for valid Strong modules is unchanged.

Overview
Strong mode is now limited to .tsrx, .ts, and .js. Any .tsx or .jsx module reached by "use strong" or compiler.strong fails with OCTANE_STRONG_TSX_MODULE, because JSX in those extensions still lowers to element descriptors instead of compiled templates. Analysis continues after that error so collectDiagnostics and octane analyze --strong-preview can surface other Strong findings on the same file.

OCTANE_STRONG_ELEMENT_API applies in every Strong module—the old .tsx/.jsx carve-out is gone. The createElement raw-HTML branch for trusted HTML in Strong .tsx is removed as redundant. Migration recipes, docs, MCP skills, and CLI/MCP diagnostic catalogs are updated to .tsrx and keyed @for lists; tests and fixtures follow suit (trusted-html.tsrx, compatibility .map() in for-mapped.tsx).

Enabling app-wide Strong breaks builds until .tsx/.jsx UI is converted to .tsrx—documented as an intentional minor release behavior.

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

trueadm and others added 4 commits October 14, 2026 15:37
…s modules

Strong modules outside the .tsx/.jsx dialect now report
OCTANE_STRONG_ELEMENT_API for createElement, cloneElement,
isValidElement, Children, and descriptorChildren from octane (named
imports, namespace member access, and namespace destructuring), and for
jsx/jsxs/jsxDEV/Fragment from Octane's JSX runtime entries. Descriptors
render through the generic descriptor renderer instead of compiled
templates. Type-only imports stay valid, and Strong .tsx keeps them.

The namespace checks share one helper with OCTANE_STRONG_COMPAT_IMPORT.
The Strong useMemo/useCallback plain-module fixtures now take their
markup from a non-Strong view module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Strong .tsrx modules now report OCTANE_STRONG_SINGLE_ITEM_FOR for an
@for whose iterable is a one-item array literal, whatever its binding
pattern or key, and for a const holding one when no other identifier in
the module spells its name. Multi-item literals, spreads, and holes stay
valid. The replacement is React's keyed remount: <Fragment key={value}>
or a key on the only element or component.

suspense-superseded-arm.tsrx compiles with strong: true and its keyed
@for case covers row replacement (#1698), so it now iterates a real
one-row list instead of a literal. The tsrx-authoring rule names the
new code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fragment-sibling-slots.test.ts compiles its fixture with strong: true,
and ForRow covers sibling slots at a @for row's fragment root. Its
`const rows = ['row']` alias now trips OCTANE_STRONG_SINGLE_ITEM_FOR,
so the row comes from a helper instead of a single-item literal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Strong mode renders through compiled templates, but JSX in a .tsx or .jsx
module lowers to element descriptors. A .tsx/.jsx module that "use strong"
or the application compiler.strong policy reaches now reports
OCTANE_STRONG_TSX_MODULE in client, server, and editor compilation. The
rest of the analysis still runs, so collectDiagnostics and
`octane analyze --strong-preview` list the module's other findings.

With no Strong .tsx left, OCTANE_STRONG_ELEMENT_API applies to every Strong
module, and the createElement raw-HTML check it now subsumes is removed.
Migration recipes, the MCP server recipes and skills, the Strong docs and
website guide, and the Strong compiler tests move to .tsrx.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 14, 2026 15:59
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability labels Oct 14, 2026
trueadm and others added 2 commits October 14, 2026 17:02
# Conflicts:
#	docs/strong-compiler-checks.md
#	packages/cli/src/data/octane-data.json
#	packages/octane-mcp-server/src/strong-diagnostics.json
#	packages/octane/src/compiler/strong-diagnostics.js
#	packages/octane/src/compiler/strong-template-policy.js
#	packages/octane/tests/compiler/strong-template-policy.test.ts
#	website/public/llms.txt
#	website/src/content/docs/strong-mode.mdx
…note

The element API changeset from #2055 is unreleased and ships with this
change, which makes Strong .tsx modules a compile error. Its ".tsx may
keep these APIs" wording no longer holds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
⚠️ Deployment skipped
View logs
octane-website-mcp de91bca Oct 14 2026, 04:37 PM

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares 55376d868, the merge commit's first parent with 2ca8a9725 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 4.233 4.258 +0.0% −13.5% … +23.3% ⚪ within noise
octane-tsrx replace 12.342 10.767 −5.4% −11.1% … +0.9% ⚪ within noise
octane-tsrx add 3.133 3.242 −4.6% −9.2% … +5.9% ⚪ within noise
octane-tsrx update 0.170 0.172 −1.8% −9.3% … +7.7% ⚪ within noise
octane-tsrx select 0.007 0.007 +11.1% −3.0% … +17.7% ⚪ within noise
octane-tsrx swap 0.021 0.021 −1.7% −6.8% … +6.9% ⚪ within noise
octane-tsrx remove 0.028 0.024 −11.6% −20.2% … −1.0% ⚪ within noise
octane-tsrx runlots 34.525 34.208 −3.9% −9.8% … +5.6% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 −0.2% −4.9% … +4.8% ⚪ within noise
octane-tsrx clear 72.433 68.842 −2.0% −9.2% … +1.3% ⚪ within noise
octane-jsx run 7.492 7.150 +3.3% −12.4% … +26.2% ⚪ within noise
octane-jsx replace 13.808 14.717 +2.8% −5.5% … +20.3% ⚪ within noise
octane-jsx add 4.558 4.650 ±0.0% −5.4% … +8.5% ⚪ within noise
octane-jsx update 0.398 0.383 −0.4% −9.0% … +12.4% ⚪ within noise
octane-jsx select 0.184 0.213 +1.6% −3.9% … +32.0% ⚪ within noise
octane-jsx swap 0.252 0.271 +9.8% +0.4% … +20.0% ⚪ within noise
octane-jsx remove 0.249 0.257 +1.7% −10.4% … +17.1% ⚪ within noise
octane-jsx runlots 60.475 56.900 −2.3% −6.5% … +14.0% ⚪ within noise
octane-jsx select_lots 4.196 3.519 −10.2% −17.7% … +3.5% ⚪ within noise
octane-jsx clear 101.000 96.058 +0.6% −6.4% … +3.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
⚠️ Deployment skipped
View logs
octane-website de91bca Oct 14 2026, 04:37 PM

trueadm and others added 2 commits October 14, 2026 17:25
direct-signal-bindings ran its Strong matrix over .tsx too, and
strong-hook-cache compiled its returned-JSX Strong case as .tsx; both now
report OCTANE_STRONG_TSX_MODULE. The .tsx compatibility cells stay, and the
returned-JSX Strong form now runs as a .tsrx module. The MCP explain test
expects the tsrx recipe fences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm merged commit 55139ec into main Oct 14, 2026
54 of 59 checks passed
@trueadm
trueadm deleted the feat/strong-ban-tsx branch October 14, 2026 17:50
trueadm added a commit that referenced this pull request Oct 15, 2026
Brings in #2047-#2051 (Strong literal stabilisation), #2054 (checked
compiled boundaries and a compiled router entry), #2055/#2057 (Strong
rejects descriptor APIs and .tsx/.jsx), #2056/#2060/#2061 (CLI Strong
reports), #2062 (Strong in the website and devtools), #2065 (no
browser-translation DOM accommodations) and Version Packages.

Conflicts, resolved so main's behaviour lands on the redesign's commit model:
- runtime.ts, #2065: setText keeps main's legacy host-only convention and the
  redesign's hydration writeText. The translator recovery is gone from
  renderText/commitText, setRenderText/commitSetText, commitHole,
  childTextHoleUpdate, recordHole and bindSignalChild; removeOnlyChildText
  still removes a committed Text at commit. resetOnlyChildHost and
  PENDING_HOST_TEXTS (which served only the host-only text writes) are deleted.
- compile.js, #2065: text updates call setRenderText(_txt, v), commit
  functions setText(_txt, v), and commitHole takes no host.
- runtime.server.ts, #2054: a compiled-only frame checks its output;
  ordinary frames keep the redesign's returned-value normalization.
- codes.json: main's 344-346 (CompiledContext, CompiledOutlet) keep their
  numbers; the redesign's codes move to 347 (server boundary error), 348
  (hydration protocol skew) and 349 (frontier rehome). Generated tables and
  CLI data are regenerated; docs/ssr.md names #348.

Adaptations:
- compiled-boundaries.test.ts: the server runs no error boundary (React's
  model), so an invalid CompiledOutlet under a catch-only @Try fails
  renderToString with the CompiledOutlet error; the client still shows the
  catch arm.
- scripts/render-writers.mjs drops resetOnlyChildHost.

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

agent-authored Diff or issue body substantially produced by an AI agent feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant