Repository navigation
feat(compiler): reject Strong .tsx and .jsx modules - #2057
Merged
Merged
Conversation
…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
marked this pull request as ready for review
October 14, 2026 15:59
# 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]>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
View logs |
octane-website-mcp | de91bca | Oct 14 2026, 04:37 PM |
Contributor
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
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. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
View logs |
octane-website | de91bca | Oct 14 2026, 04:37 PM |
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
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strong mode becomes a
.tsrx/.ts/.jslanguage. JSX in a.tsxor.jsxmodule lowers to element descriptors, which render through the generic descriptor renderer instead of compiled templates. A.tsx/.jsxmodule that Strong reaches is now a compile error,OCTANE_STRONG_TSX_MODULE."use strong"directive and the applicationcompiler.strongpolicy both report it. Under the policy, app-wide.tsxfiles no longer fall back silently to compatibility mode. Installed and linked dependencies keep their own mode through_hasApplicationStrongPolicy, unchanged.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, or1:1when only the policy applies.collectDiagnosticsandoctane analyze --strong-previewlist the.tsxmodule's other findings beside the new code, and--fixstill applies its rewrites.Why
#2055 banned descriptor APIs in Strong
.tsrx/.ts, but.tsxreturn <jsx>and JSX values always lower to descriptors, so.tsxwas the remaining hole. Per Dominic's suggestion,.tsxis 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
strong-mode.js,strong-template-policy.js,strong-html.js):.tsxexemption fromOCTANE_STRONG_ELEMENT_API.createElement(...)raw-HTML branch ofOCTANE_STRONG_UNTRUSTED_HTML. With no Strong.tsx, every Strong module that can reach Octane'screateElementalready fails onOCTANE_STRONG_ELEMENT_API. The helpers it imported fromstrong-html.jsare now module-private.strong-diagnostics.js):.tsxwording fromOCTANE_STRONG_MAP_JSXandOCTANE_STRONG_ELEMENT_API..tsrx. The catalog test compiles them as.tsrx, and the generators emittsrxfences for the website, MCP JSON, and MCP explain output.docs/strong-compiler-checks.md, the Strong sections ofdocs/differences-from-react.mdand its website page, and the website Strong mode guide, including the adoption steps.build-tools.mdx,core-apis.mdx, anddocs/tsrx-basics.md, rewritten as@{ … }.tsrxand compiled under Strong to check them.llms.txt, the MCPmigrate-to-strongandreact-divergencesskills, theoctane_compiletool description, and the Rsbuild/Rspack READMEs..rulesync/had no guidance saying Strong works in.tsx, so nothing there changed.trusted-html.tsxbecomes a Strongtrusted-html.tsrx, so the trusted-HTML render, hydrate, and suspend coverage now runs through compiled templates.for-strong.tsxbecomesfor-mapped.tsxwithout the directive. It remains the compatibility.map()counterpart in the snapshot-semantics comparison..tsxnow compile as.tsrx..tsxas valid are now tests of the new error: client, server, directive, policy, Volar location, and the full finding list..map()list also reportedOCTANE_STRONG_MAP_JSXnow use@forrows or render callbacks.createElementspellings moved to theOCTANE_STRONG_ELEMENT_APItable, which keeps their coverage.Validation
pnpm sync, thenpnpm strong:diagnostics:checkandnode scripts/react-parity/check.mjs --validate-onlypnpm format:files:checkon every changed filepnpm typecheck:fileson the changed sources, tests, and fixtures. The repo-widepnpm typecheckis left to CI.pnpm test: left to CI.--project octane packages/octane/tests/compiler/: 4188/4189 pass. The one failure is the comment-scan timing check incompiler-vite-options.test.ts(11–14 s against 6 s under machine load). It passes when run alone and does not touch Strong.octaneandoctane-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.strong-template-policyandbundler-compilertests 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 1layout-readcandidate, 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 perCallExpressionin Strong modules. Emitted code for valid modules is unchanged by construction: the change only adds or removes diagnostics, andanalyzeStrongModereturns the same analysis for non-.tsxfiles.concise-code:trusted-html.tsrx(a rename).STRONG_TSX_MODULE, matching its neighbouring code constants.--strong-previewand--fixwould then see nothing else in a.tsxmodule, which is exactly the React-app migration case.Risk / follow-ups
.tsx. An app withcompiler.strongon and application.tsxmodules now fails to build until they become.tsrx. This is intended, and the changeset (octaneminor) and docs say so.octane/strongJSX type entry stays. Volar still selects it for Strong.tsrx. Only the advice to point.tsxat it is removed..changeset/strong-element-api.mdsaid "Strong.tsxmodules may keep these APIs"; this PR drops that clause and the "outside.tsxand.jsx" wording, since both changesets ship in the same release.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
App-wide
compiler.strongnow fails on any application.tsx/.jsxuntil 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.tsxor.jsxmodule reached by"use strong"orcompiler.strongfails withOCTANE_STRONG_TSX_MODULE, because JSX in those extensions still lowers to element descriptors instead of compiled templates. Analysis continues after that error socollectDiagnosticsandoctane analyze --strong-previewcan surface other Strong findings on the same file.OCTANE_STRONG_ELEMENT_APIapplies in every Strong module—the old.tsx/.jsxcarve-out is gone. ThecreateElementraw-HTML branch for trusted HTML in Strong.tsxis removed as redundant. Migration recipes, docs, MCP skills, and CLI/MCP diagnostic catalogs are updated to.tsrxand keyed@forlists; tests and fixtures follow suit (trusted-html.tsrx, compatibility.map()infor-mapped.tsx).Enabling app-wide Strong breaks builds until
.tsx/.jsxUI 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.