Repository navigation
fix(codemod): preserve retained React registry factories - #3052
Merged
domgan-oai merged 5 commits intoNov 18, 2026
Merged
domgan-oai merged 5 commits into
domgan-oai merged 5 commits into
Conversation
trueadm
marked this pull request as ready for review
November 18, 2026 20:53
Contributor
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operations
All 20 timed operations (19 without a verdict)
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. |
…d-registry-types # Conflicts: # packages/codemod/src/project.ts
This was referenced Nov 18, 2026
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
A selected registration module could rewrite React's
createElementto Octane even though an unchanged React registry later renders its callback result. Preserve the original named factory for a proven retained React registry, including mixed modules that also compile a native component. Refuse writes when the source-backed boundary is unresolved, the factory has other uses, or registrations are ambiguous.Fixes #2776.
Validation
perf-review: not applicable (codemod-only diff).concise-code: src +104 −16 (runtime +0 −0); new files and exports: patch changeset and RETAINED_REGISTRY_BOUNDARY, consumed by the write guard; alternatives: blanket React factory preservation (~5 lines) rejected because it changes unrelated native migrations and hides ambiguous ownership; bytes: not applicable.pnpm format:checkpnpm typecheckpnpm testpnpm synccompleted with no tracked changes.Risk / follow-ups
The proof intentionally supports a bounded named-factory registration shape. Unproved or ambiguous ownership remains an explicit migration boundary.
Provenance
agent-authored)Originating task: Codex task, host
com-79386.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Codemod-only change, but it alters which files rewrite vs stay unchanged and introduces a new write-blocking error path that may surprise existing migration runs.
Overview
The codemod now keeps React
createElementin registration modules only when it can prove the import is used solely inside a typed callback handed to a relative React registry, including mixed files that also export a native component or harmless primitive exports.When that boundary cannot be proved—missing or weak
ReactNodetyping, extra registrations or unrelated code, more than one use of the factory, or ambiguous modules—it reports a newretained-registry-boundaryerror and refuses to write, leaving the source unchanged. Cases that previously still rewrotecreateElementto Octane (for example a second factory or a mixed React/Octane module) now surface that error instead.project.tstreats this rule like other hard migration blockers, and tests cover the allow vs block matrix (mixed modules, ES2022, missing React types, duplicate registrations).Reviewed by Cursor Bugbot for commit 4342d9d. Bugbot is set up for automated code reviews on this repo. Configure here.