Skip to content

fix(codemod): warn about retained React JSX callers - #2657

Merged
domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/codemod-retained-react-jsx-issuer
Nov 14, 2026
Merged

domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/codemod-retained-react-jsx-issuer

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Warn when an unchanged React JSX component directly renders a relative JSX import that the codemod will rename to an Octane component. Report the edge on the retained caller and selected leaf.

Selecting only the leaf in a standard React JSX project rewrites the caller's import to .tsrx. Production React SSR then rejects the Octane element returned by the leaf. The existing server-render advisory covers direct calls to the React DOM renderer. A plain React component return can reach the same failure through an ancestor.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • Production React SSR reproduced the retained-caller failure. An authored OctaneCompat control rendered successfully.
  • All 1,403 codemod and CLI tests, including a dual-export deduplication regression, plus codemod package typecheck, targeted formatting, changeset validation, pnpm sync, and git diff --check.
  • The focused project checks cover default and named imports, JSX runtime aliases, native JSX, a shadowed binding, a type-only import, an authored bridge, and the warning in write mode.
  • Concision review. Reuse the existing export, JSX runtime, and resolved rename checks. The new binder runs only on retained JSX issuers with a pending path rewrite and a plausible explicit JSX extension.
  • Performance review is inapplicable to runtime output. This adds an advisory to the migration tool.

Risk / follow-ups

The check follows explicit relative JSX paths and direct exported returns under the standard resolver. Bundler-only aliases can supply a different renderer, so this is an advisory. The recipe-free replay matched all 7,902 rows, including the 1,361 clean Strong results on the base.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · host com-79386


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


Note

Low Risk
Changes are limited to codemod diagnostics and tests; no runtime or auth/data paths are affected.

Overview
Extends the codemod’s react-compat advisory beyond direct react-dom/server usage: when only a leaf .tsx/.jsx is selected for migration, it now flags unchanged React callers that still use standard automatic JSX and return JSX for a relative component that will be rewritten to .tsrx.

The new retainedReactComponentReturns analyzer reuses direct-export return detection to find those edges; project.ts merges them with the existing server-render checks and emits warnings on both the retained caller and the migrating leaf (with JSX-specific wording). A patch changeset and parameterized project tests cover when the warning should and should not appear (e.g. native Octane JSX, aliases, lowercase tags, type-only imports, shadowed bindings, explicit OctaneCompat).

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

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Nov 14, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review November 14, 2026 03:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit d963636. Configure here.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

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

Compares 3c31a249a, the merge commit's first parent with 4a43ba3ba 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

target operation base ms head ms head/base 95% CI
octane-tsrx runlots 24.475 22.858 −9.5% −13.9% … −4.0% 🟢 faster
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.642 2.725 ±0.0% −1.8% … +3.7% ⚪ within noise
octane-tsrx replace 5.792 5.775 +4.1% ±0.0% … +8.5% ⚪ within noise
octane-tsrx add 2.350 2.458 +2.2% −0.0% … +6.5% ⚪ within noise
octane-tsrx update 0.082 0.080 −2.7% −4.7% … +1.0% ⚪ within noise
octane-tsrx select 0.006 0.006 −0.2% −5.8% … +2.2% ⚪ within noise
octane-tsrx swap 0.016 0.017 +1.7% −1.0% … +4.7% ⚪ within noise
octane-tsrx remove 0.017 0.018 +1.1% −0.0% … +3.4% ⚪ within noise
octane-tsrx runlots 24.475 22.858 −9.5% −13.9% … −4.0% 🟢 faster
octane-tsrx select_lots 0.007 0.007 +0.5% −4.9% … +8.8% ⚪ within noise
octane-tsrx clear 47.250 46.625 +0.3% −1.0% … +2.6% ⚪ within noise
octane-jsx run 3.342 3.592 +2.8% ±0.0% … +5.5% ⚪ within noise
octane-jsx replace 6.558 6.858 +1.9% −5.7% … +6.5% ⚪ within noise
octane-jsx add 3.125 3.542 +3.4% −1.5% … +6.5% ⚪ within noise
octane-jsx update 0.196 0.173 −1.2% −3.4% … +1.8% ⚪ within noise
octane-jsx select 0.083 0.087 +3.0% +1.7% … +5.0% ⚪ within noise
octane-jsx swap 0.128 0.126 +0.6% −2.4% … +5.5% ⚪ within noise
octane-jsx remove 0.105 0.109 +2.2% +0.6% … +3.6% ⚪ within noise
octane-jsx runlots 28.142 28.875 +0.8% −2.2% … +6.0% ⚪ within noise
octane-jsx select_lots 0.906 0.887 −1.5% −3.4% … +0.8% ⚪ within noise
octane-jsx clear 49.258 51.175 +1.3% +0.1% … +4.0% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 111 measured values.

Public-import reachability bundles (bytes)

No changes across 141 measured values.

@domgan-oai
domgan-oai merged commit 32ad2e1 into octanejs:main Nov 14, 2026
53 of 58 checks passed
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