Repository navigation
Bump oxc-transform-react to 0.158.0 and pin its compiler fixes - #553
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
64dd1f9 to
64bfbfd
Compare
acusti
left a comment
There was a problem hiding this comment.
Review (xhigh)
Verdict: not ready to merge yet. One substantive gap: 0.157.0 has an undocumented new bail-out that also fails builds under panicThreshold. The rest are small wording and test-robustness fixes.
What I verified
- Ran the plugin suite on the head commit: 49 passed, 2 expected fail.
format:checkandlintare clean, and CI is green. - Aliased
oxc-transform-reactto a 0.156.0 install and ranupstream.test.tsagainst it. Exactly the 14 tests the PR names fail (the 13 pins plus the bail-outit.fails) and the 24 existing ones pass. Each failure is on the assertion that pins the fix, not on an incidental one. - Probed the new reassignment check with about a dozen inputs on both versions, with
reportDiagnosticsand with bothpanicThresholdsettings. The results are in the inline comments.
Findings, most important first
- A second new bail-out, "Cannot reassign variable in async function", isn't in the changeset, the tests or the PR description (inline on the changeset). An async function that reassigns a variable declared in an enclosing function is now skipped, and the build fails under
'critical_errors'/'all_errors'. That covers an effect storing a connection from an async IIFE for its cleanup, an async loader accumulating into an effect-local, and a handler's counter bumped in an async arrow. That's likely more common than thereturn fetchPage(…).then(…)shape the PR documents, and it contradicts the "Scope. It's narrower than the message suggests" section and the bump commit's "Common shapes are unaffected". The documented rule also isn't promise-specific:return items.map((item) => { n += 1; … })in a helper is skipped too. - The upstream fix already exists (inline on the
it.fails). oxc-project/oxc#28401 (the async variant, bisected to the #26893 commit) was closed by oxc-project/oxc#28820 on 2026-11-04, a day after 0.157.0 was published. Link both from the test and the PR, and add anit.failsfor the async shape so the 0.158.0 bump shows which of the two shapes it fixes. I still think shipping 0.157.0 now is right: under the defaultpanicThreshold, the new skips are safe, and the miscompiles this fixes aren't. - Changeset wording (inline): the oxc#27418 bullet implies the case without an early return was broken. The member-chain sentence hides that chains of 501 to about 4,900 links used to compile and are now skipped.
- Test nit (inline): the oxc#27420 regex depends on where
let notes;is declared, which isn't the property being pinned.
What's good and should stay as is
- Splitting the lockfile sync out of the bump.
- One commit per pin, each message saying what broke, at runtime, on which versions.
- Being explicit about the three unpinned rows and why.
The pins assert the fixed shape rather than just "compiles", and they fail on 0.156.0 for the right reason. The README needs no change: its caveats paragraph is example-based, and nothing listed there is now wrong. The minor bump is appropriate for a 0.x package with new build-failing diagnostics.
Generated by Claude Code
64bfbfd to
1971eb4
Compare
acusti
left a comment
There was a problem hiding this comment.
Re-review at 1971eb4
All five threads from the first review are addressed in the code and in the commit messages. I checked the range-diff against 64bfbfd and re-ran the suite:
- 0.157.0: 37 passed, 3 expected fail.
- Aliased to 0.156.0: exactly the 15 new tests fail (the 13 pins and both reassignment
it.fails), and the 24 existing ones pass. - Loosened oxc#27420 regex: still fails on 0.156.0.
format:checkandlintare clean.
The new useSocket it.fails and its links to oxc#28401 and oxc#28820 are what I'd hoped for. The two separate tests will show on the next bump whether oxc#28820 covers LoadAll, and your reading of its diff (dropping the inner function's own bindings from child_context_variables) makes that likely.
Still open:
- The changeset's lead-in sentence is broader than its two bullets (inline). As written, it describes the
cancelled-flag cleanup that still compiles. - The PR description still has the pre-review "Scope" section ("narrower than the message suggests"). It has only the one bail-out, counts "2
it.fails" and "17 commits", and says "the 14 new non-gap tests" fail on 0.156.0, which is now 15. You said that's next. I'll check it with the changeset fix.
Once both are done, I expect to call this ready.
Generated by Claude Code
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
1971eb4 to
5e92940
Compare
acusti
left a comment
There was a problem hiding this comment.
Re-review at 5e92940: ready to merge
Both items from the last round are done:
- Changeset: the lead-in now limits the skip to the two cases. The second bullet says "the function's parameters or locals", which is correct where cubic's "enclosing function's" wouldn't have been.
- PR description: it now matches the branch: both bail-outs, the upstream fix, 18 commits, 3
it.failsand 15 new tests failing on 0.156.0.
The range-diff against 1971eb4 shows only the bump commit changed. I re-ran the checks at this head:
- Plugin suite: 49 passed, 3 expected fail.
format:check,lintand the package'stsc: all clean.- CI: green on both Node versions.
All review threads are resolved. I agree with leaving cubic's regex-span finding as is: the backreference to the copy's temp name is what makes the match specific, and a length bound would bring back the layout dependence.
One thing I'm leaving as is: the bump commit's message keeps "reassigns one of its parameters or locals", where the changeset now says "the function's". The example right after it shows the intended reading, so it isn't worth a force-push.
Nothing else I'd change before merge.
Generated by Claude Code
5e92940 to
c3fa0a5
Compare
c3fa0a5 to
e1ed54d
Compare
acusti
left a comment
There was a problem hiding this comment.
Review of the 0.158.0 version (c3fa0a5)
Verdict: not ready to merge yet. The bump itself is right, and moving from 0.157.0 to 0.158.0 is the right call. The remaining work is in how the one new skip is described and tracked, plus two structural recommendations.
What I verified
- 0.158.0 (this head): the plugin suite gives 51 passed and 1 expected fail.
- Aliased to 0.156.0: exactly the 13 pins fail.
- Aliased to 0.157.0: exactly the 2 promoted tests fail, so they now guard against that regression.
- Checks:
format:check,lint, the packagetscandbun install --frozen-lockfileare clean. CI is green. - 0.157.0's bail-outs: all the shapes from my earlier review compile again on 0.158.0, matching Babel 1.0.0 and the experimental build.
- Non-ASCII ref panic:
const élanRef = useRef(…)aborts the process on 0.156.0 and 0.157.0 and compiles on 0.158.0, as described. - Upstream triage: the only
react-compilercommits between the v0.157.0 and v0.158.0 crate releases are oxc-project/oxc#28758 and oxc-project/oxc#28820, both covered.
Findings
-
The remaining skip is described inaccurately (inline on the changeset). It isn't specific to
ifblocks: it also fires in ternaries,&&, loops andswitch. It also only fires when the call's result is kept:if (touched) { validate(value, cb); }still compiles. A changeset suggestion is inline. The bump commit's message and the PR description need the same fix. -
The remaining skip isn't tracked (inline on the tests). The latest experimental React Compiler build compiles all of these cases, as Babel 1.0.0 does. So "0.158.0 is the consistent one" holds within the port, but it's still a divergence from React Compiler main, as far as a published build shows. I'd report it upstream and add an
it.failslinking the issue, or a plain pin if upstream says the stricter behavior is intended. -
Pin the non-ASCII ref panic fix (oxc-project/oxc#28758). The "no identifier in the corpora has that shape" bar fits the unpinned miscompiles, but a panic kills the process, dev server included. The suite already pins a panic fix with no corpus instance: "compiles a try whose catch can never run" (oxc-project/oxc#28066). The test is ten lines: compile a component that uses
élanRefand assertreact/compiler-runtime. On a regression, the worker would abort and the run would fail loudly. -
Recommended: collapse the 0.157.0 bump into one 0.158.0 bump. Since the plugin will never ship 0.157.0, the history currently has:
- five commits that pin main to a version with two build-failing bail-outs
- a 0.157.0 changeset documenting behavior no release will have
- two
it.failstests flipped toitinside a six-file bump commit, sogit blameon those tests points at the bump
A cleaner sequence would be:
- the lockfile sync
- the 0.158.0 bump, with its changeset and the 0.157.0 triage folded into its message
- the 13 pins (their "since 0.157.0" comments stay accurate)
- the two regression guards as plain tests from the start ("was left uncompiled on 0.157.0"), plus the asserted-allocation
it.fails
Each pin was already verified against 0.156.0 and 0.158.0, and the regression guards against 0.157.0. The repo's own commit rules ask for squashing history that adds no blame value, and the 0.157.0 bump adds none once every version-specific line it touched is rewritten.
Fine as is
- The rewritten changeset drops 0.157.0's bail-outs, which users going from 0.11.0 straight to the 0.158.0 release will never see. That's the right framing.
- The lockfile sync now matches all six release commits.
- The promoted tests' comments record what 0.157.0 did.
- The README needs no change.
Generated by Claude Code
| // Compiled again since 0.158.0 | ||
| // (https://github.com/oxc-project/oxc/issues/28401, fixed by | ||
| // https://github.com/oxc-project/oxc/pull/28820) | ||
| it('compiles an effect whose async callback reassigns an effect local', async () => { |
There was a problem hiding this comment.
The remaining skip needs a test, and probably an upstream report. The PR description reasons that "0.158.0 is the consistent one here", so the skip is documented but not tracked. That isn't how React Compiler behaves, though: the latest experimental build (babel-plugin-react-compiler@0.0.0-experimental-a1856f3-20260507) compiles every control-flow variant in the table on the changeset thread, exactly as 1.0.0 does. So this is a divergence from React Compiler main as far as a published build shows. (That build is from May, so main may have moved since. I couldn't check anything newer.)
This suite's README says it "pins both kinds of divergence", and this one also fails builds under panicThreshold. Without a test, a later bump that changes it in either direction would go unnoticed, and the changeset's claim would go stale. I'd suggest:
- Report it upstream. Tell oxc that the port skips control-flow cases Babel 1.0.0 and the experimental build compile, citing #26893 as the change that introduced it.
- Add an
it.failslinking that issue. It would assert that theif (touched) valid = validate(…)component compiles. If upstream says the stricter behavior is intended, make it a plain pin instead, asserting the skip and its diagnostic the way the exhaustive-deps test does, and keep the comment noting that Babel compiles it.
Either test works as a tripwire. The issue decides which one is right.
Generated by Claude Code
There was a problem hiding this comment.
Added the it.fails in 527f63a3. It asserts that the if (touched) valid = validate(…) component compiles. It passes against 0.158.0 as an expected fail, and its comment records:
- the 0.157.0 origin (oxc#26893)
- the
panicThresholdbuild failure - that 0.156.0, Babel 1.0.0 and the experimental build compile it
The upstream issue isn't filed yet. That's outside what this session can post, so the author has a draft to file. Once it's filed, the test's comment gets the link, and the answer decides whether this stays an it.fails or becomes a plain pin of the skip.
The other two findings are done:
- The non-ASCII ref panic is pinned in 4178cb63. Against 0.156.0 and 0.157.0 it panics and aborts the Vitest worker.
- The history is collapsed into your proposed sequence:
- the lockfile sync
- one 0.158.0 bump carrying the 0.157.0 triage in its message
- the 13 pins, with messages now saying they pass against 0.157.0 and 0.158.0
- the asserted-allocation
it.fails - the two regression guards, as plain tests from the start
- the new
it.fails - the panic pin
- the README commit
The tree differs from the previous head only by the changeset wording and the two new tests. Every commit passes the plugin suite against 0.158.0, which they all pin now.
Generated by Claude Code
e1ed54d to
19f962f
Compare
acusti
left a comment
There was a problem hiding this comment.
Re-review at 19f962f
All four findings from the last round are addressed, and I checked each one:
- Changeset wording: it now describes the kept-result, control-flow rule.
- Remaining skip: tracked as an
it.fails. Aliased to 0.156.0, it fails as intended. - Non-ASCII ref panic: pinned. Against 0.156.0 the worker aborts with the
infer_types.rs:240panic. - History: collapsed into the proposed sequence. I ran the plugin suite at each of the 21 commits, and every one passes, with test counts going up one per pin.
format:checkandlintare clean at the head.
Still open, all on the new README commit plus one changeset paragraph (inline):
- The release policy is absolute, and this PR already breaks it. The README says a release that newly skips code it has no reason to reject gets skipped. 0.158.0 does exactly that (the
it.failscase), and shipping it is still right. The README should describe the trade-off you actually made: regressions weighed against fixes. - The vetting process isn't in the repo. The corpus comparison and the runtime checks against Babel exist only in this PR's sessions. Either write the procedure down in
AGENTS.md(cheap), or describe it as practice rather than a guarantee. - The changeset's new first paragraph tells 0.11.0 users about a 0.157.0 regression they never had. I'd drop it.
Waiting on the upstream issue for the it.fails link is fine as is: the test's comment already explains the gap. Linking the issue once it's filed is enough.
Generated by Claude Code
19f962f to
dd26d1e
Compare
acusti
left a comment
There was a problem hiding this comment.
Re-review at dd26d1e
All three items from the last round are done:
- README release policy: it now weighs regressions against fixes, in both places.
AGENTS.md: the new "Bumping oxc-transform-react" section writes the vetting procedure down. Its gotchas (ids undernode_modulesare skipped, a panic aborts the process, the uncompiled pass needsreactCompiler: false) are exactly what the next bump would otherwise rediscover. Step 6 turns the dropped changeset paragraph into a rule.- Changeset: the 0.157.0 paragraph is gone.
At this head, the plugin suite gives 52 passed and 2 expected fail. format:check, lint and bun install --frozen-lockfile are clean, and CI is green.
One branch change left: rebase onto main and refresh the lockfile sync. Main has moved by three commits, including "Release @acusti/dropdown 1.3.1", another release commit that bumped a workspace version without the lockfile. I rebased locally onto c0eb2db and the rebase is clean, but bun install then rewrites packages/dropdown from 1.3.0 to 1.3.1 in bun.lock.
--frozen-lockfilepasses either way, so CI won't catch this.- The PR's first commit exists to make the lockfile match the workspace versions. Merged as is, it leaves one entry stale, and the next
bun installputs that rewrite into some unrelated diff.
Rebase per AGENTS.md (no merge commit), regenerate the lockfile into Sync bun.lock with its workspace versions, and add dropdown 1.3.1 to that commit's message, which currently lists 1.2.1 and 1.3.0.
Two non-blocking notes:
- The PR description has fallen behind this push. Its "README" section still describes the old absolute policy ("the plugin skips it for the next release that fixes it"), and it lists 21 commits and 8 items with no
AGENTS.mdcommit. That doesn't affect what merges, but it's what a reviewer reads. - The upstream issue. Step 5 of the new procedure says a regression that ships gets an
it.fails, an upstream issue and a changeset paragraph. This PR has the first and third. Filing the issue before merge would let the link land in theit.failscomment together with the rule. If it has to wait, a follow-up commit adding the link is fine.
Once rebased with the lockfile refreshed, I'd consider this ready to merge.
Generated by Claude Code
Exact pin in @acusti/vite-plugin-react-compiler, plus the root and docs devDependency ranges so bun hoists a single copy. This skips 0.157.0: its rewrite of the check for variables reassigned after render (oxc-project/oxc#26893) skipped components and hooks in which a callback reassigns another callback's variable, in an async function or in a callback whose result a function returns, and the diagnostics failed the build under panicThreshold 'critical_errors' or 'all_errors'. 0.158.0 limits the check to bindings declared in the component or hook (oxc-project/oxc#28820, fixing oxc-project/oxc#28401), so those compile again, as on 0.156.0 and with babel-plugin-react-compiler@1.0.0. One skip from that rewrite remains: a component or hook that keeps the result of a call it passes a callback to, when that callback reassigns one of the component's own variables, is now left uncompiled inside an `if`, a loop, a `switch`, a ternary or `&&` too, as it already was outside them ("Cannot reassign variable after render completes"). 0.156.0, Babel 1.0.0 and its latest experimental build compile those, and a discarded result still compiles. Under panicThreshold the diagnostic fails the build. The changeset leads with it. Between 0.156.0 and 0.158.0, the bindings also fix compiled output that rendered stale values or threw where the uncompiled code doesn't, most of which babel-plugin-react-compiler@1.0.0 shares (see the pinned tests that follow), compile code that 0.156.0 and the Babel plugin skip, stop panicking on a ref-like name that starts with a non-ASCII letter (`élanRef`, oxc-project/oxc#28758), leave member chains longer than 500 links uncompiled instead of compiling them slowly or overflowing the stack, and remove an exponential type resolution that made a loop around a `try` take seconds and gigabytes to compile. The repo's own output changes in two files with default options: MonthCalendar.tsx keys its memo block on the `title` prop from before `title = title ?? …` (oxc-project/oxc#27420), so it no longer misses its cache on every render without a title, and useStyles.ts lowers `item.referenceCount++` as an increment (oxc-project/oxc#27424), with the same behavior for a number. In the dependency corpus (12,712 JS/TS files), two files change with default options, both from #27420. With compilationMode 'all', 250 change and six flip compile status, three of them newly skipped: two copies of yaml's stringifyDocument by the remaining skip, and rolldown's replacePlugin, which mutates its own argument in a forEach callback. Source maps change in about 1,240 files from codegen's deduplicated mappings (oxc-project/oxc#28844, oxc-project/oxc#26051). No input crashed or changed fatal status. The public typings add only a `typescript` transform option (enum inlining), which the plugin doesn't pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A memo block that reassigns one of its own inputs, like a quantity clamped to the stock in place, stored the input's value after the block as its cache key through 0.156.0. A later render whose prop equaled the clamped value reused the earlier output: quantity 3 after quantity 5 (with 3 in stock) still read "Only 3 in stock". A prop defaulted by reassignment instead missed the cache on every render, as MonthCalendar's `title = title ?? …` did. As of 0.157.0 the key is a copy of the input taken before the block (oxc-project/oxc#27420). babel-plugin-react-compiler@1.0.0 keys it like 0.156.0. Rendered in sequence, 0.156.0 and Babel 1.0.0 show the stale note and 0.157.0 matches the uncompiled component. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A variable declared before a memo block and reassigned in a loop inside it wasn't restored from the cache when the block was skipped through 0.156.0, so it kept its initial value from the second render with the same props on: a "Go to first error" link pointed at "#" instead of the first invalid field. Restored as of 0.157.0 (oxc-project/oxc#27421). babel-plugin-react-compiler@1.0.0 renders "#" the same way. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A value assigned in a branch on a prop was treated as a constant through 0.156.0 when that branch also returned early on a condition that isn't reactive, like a feature flag, so the element built from it was cached once per mount: a save status kept saying "Saving" after saving finished. Recomputed as of 0.157.0 (oxc-project/oxc#27418). babel-plugin-react-compiler@1.0.0 caches it the same way as 0.156.0. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
An allocation inside a useMemo result that depends on nothing, like `seen: new Set()` next to the dependency it's keyed on, got a memo block of its own through 0.156.0 and was cached once per mount, so the result was rebuilt when its dependencies changed but kept sharing the first Set: an impressions hook stopped tracking after the page changed. Recreated with the result as of 0.157.0 (oxc-project/oxc#27427). babel-plugin-react-compiler@1.0.0 caches it like 0.156.0. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A value that is only compared and passed to a state setter during render, as in the "adjust state when a prop changes" pattern, was judged not to escape through 0.156.0 and lost its useMemo, so a new object on every render never equaled the stored one and the component crashed with "Too many re-renders". Memoized as of 0.157.0 (oxc-project/oxc#27426). babel-plugin-react-compiler@1.0.0 drops the memoization the same way. The input starts the stored value at null: passing the memoized value to useState too already kept it memoized. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
When the compiler couldn't tell a value was a ref, as with a ref prop and a fallback (`boxRef ?? ownRef`), a callback reading `ref.current.offsetWidth` was cached against that whole path through 0.156.0. The cache check reads the ref during render, before it's attached, so the component threw on its first render. Cached against the ref as of 0.157.0 (oxc-project/oxc#27423). babel-plugin-react-compiler@1.0.0 guards and throws the same way. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. The change stops a dependency path at `.current` for any value a function reads, so a function called during render that reads `.current` on a context value mutated outside render is now cached against the object and goes stale, where 0.156.0 and Babel 1.0.0 recompute it. That code breaks the Rules of React, so it isn't pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A property read inside a callback passed as a JSX prop, like
`onClick={() => onFollow(user!.id)}`, was hoisted into the cache check
through 0.156.0, and that check runs during render, so the component
threw "Cannot read properties of null" once `user` was null, even though
the callback, behind a disabled button, never ran. Cached against `user`
as of 0.157.0 (oxc-project/oxc#27070). babel-plugin-react-compiler@1.0.0
guards on `user.id` and throws the same way. The test fails against
0.156.0 and passes against 0.157.0 and 0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
Through 0.156.0, `ref.current++` compiled to
`ref.current = ref.current + 1` followed by a read of the new value, so
an id counter in a ref handed out 1, 2, … instead of 0, 1, …, and a
bigint counter threw ("Cannot mix BigInt and other types"). As of
0.157.0 it reads the property once, increments that, and writes it back
(oxc-project/oxc#27424). babel-plugin-react-compiler@1.0.0 compiles it
like 0.156.0. useStyles.ts's `item.referenceCount++` changes shape the
same way, with the same behavior for a number whose result is unused.
The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
Every BigInt literal in a compiled component or hook was printed as `undefined` through 0.156.0, so `(nanoseconds + 500000n) / 1000000n` threw "Cannot mix BigInt and other types" and `useRef(0n)` started out undefined. Kept as of 0.157.0 (oxc-project/oxc#26161). babel-plugin-react-compiler@1.0.0 leaves such a function uncompiled ("Handle BigIntLiteral expressions"). In compilationMode 'all', eight files in this repo's dependencies (from eslint, oxfmt and storybook) lose BigInt literals on 0.156.0. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
In a component defined inside a factory function (`createList(getKey, renderItem)` returning a List component), a callback that only uses the factory's arguments was outlined to a module-level function through 0.156.0, outside their scope, so the component threw "renderItem is not defined" on its first render. Kept inline and cached once per mount as of 0.157.0 (oxc-project/oxc#26519). babel-plugin-react-compiler@1.0.0 outlines it and throws like 0.156.0. The test fails against 0.156.0 and passes against 0.157.0 and 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A hook whose memoized callbacks read the same ref in different places,
with one stored as a property of the other, like a debounced callback
with a `cancel` method, was left uncompiled through 0.156.0 ("Ref type
environment did not converge"), since the ref check compared where each
function read the ref and never settled. Compiled as of 0.157.0
(oxc-project/oxc#26181), as babel-plugin-react-compiler@1.0.0 compiles
it. Without the `debounced.cancel = cancel` assignment, 0.156.0 compiled
it too. The test fails against 0.156.0 and passes against 0.157.0 and
0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A component that increments a variable a closure captures, like a count
of selected items that an onClick callback reads, was left uncompiled
through 0.156.0 ("Handle UpdateExpression to variables captured within
lambdas"), and babel-plugin-react-compiler@1.0.0 bails with the same
message. Compiled as of 0.157.0 (oxc-project/oxc#26893); rendered and
clicked, it matches the uncompiled component. The test fails against
0.156.0 and passes against 0.157.0 and 0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A callback that passes an item to a handler mutating a global, like
`onClick={() => handleClick(item.id)}` with `window.location.hash = id`
in handleClick, was treated as calling the handler during render, so the
component was left uncompiled through 0.156.0 ("This value cannot be
modified"), and babel-plugin-react-compiler@1.0.0 bails with the same
message. Compiled as of 0.157.0 (oxc-project/oxc#27309). The test fails
against 0.156.0 and passes against 0.157.0 and 0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
oxc-project/oxc#27427 recreates an allocation in a useMemo result when its dependencies change, but not one wrapped in a TypeScript assertion (`seen: [] as string[]`, `new Set() as Set<string>`): 0.157.0 and 0.158.0 still cache it once per mount, so a rebuilt result shares the first array, and an impressions hook stops tracking after the page changes, as on 0.156.0 and with babel-plugin-react-compiler@1.0.0. `new Set<string>()` and `new Array<string>()` are recreated. Tracked as an it.fails test, so the bump that fixes it turns the test red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A component in which a function returns the result of passing a callback
that reassigns one of the function's parameters or locals, like a loader
that returns
`fetchPage(page).then((next) => { rows = rows.concat(next); … })` or a
helper that returns `items.map((item) => { n += 1; … })`, was left
uncompiled on 0.157.0 ("Cannot reassign variable after render
completes", oxc-project/oxc#26893), and the diagnostic failed the build
under panicThreshold 'critical_errors' or 'all_errors'. Each call has
its own `rows`, so compiling it is safe, and 0.156.0 and
babel-plugin-react-compiler@1.0.0 compile it. Compiled again as of
0.158.0, which limits the check to bindings declared in the component or
hook (oxc-project/oxc#28820, fixing oxc-project/oxc#28401). The test
fails against 0.157.0 and passes against 0.156.0 and 0.158.0, so that
regression can't come back unnoticed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A hook or component in which an async function reassigns a variable
declared in another callback, like an effect that stores a connection
from an async IIFE for its cleanup, was left uncompiled on 0.157.0
("Cannot reassign variable in async function", oxc-project/oxc#26893),
and the diagnostic failed the build under panicThreshold
'critical_errors' or 'all_errors'. An async loader accumulating into an
effect local and a handler's counter bumped in an async arrow were
skipped the same way. The variable belongs to one run of the effect, so
compiling it is safe, and 0.156.0 and babel-plugin-react-compiler@1.0.0
compile it. Compiled again as of 0.158.0 (oxc-project/oxc#28820, fixing
oxc-project/oxc#28401). Reassigning one of the component's own
variables from an async function was already skipped on 0.156.0. The
test fails against 0.157.0 and passes against 0.156.0 and 0.158.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
Since 0.157.0 (oxc-project/oxc#26893), a component or hook that keeps the result of a call it passes a callback to, when that callback reassigns one of the component's own variables, is left uncompiled inside an `if`, a loop, a `switch`, a ternary or `&&`, as it already was outside them ("Cannot reassign variable after render completes"). Under panicThreshold 'critical_errors' or 'all_errors', the diagnostic fails the build. 0.156.0, babel-plugin-react-compiler@1.0.0 and its latest experimental build (0.0.0-experimental-a1856f3-20260507) compile every one of those, so it's a divergence from React Compiler as far as a published build shows, and 0.158.0 keeps it. A discarded result still compiles. Tracked as an it.fails test until upstream says whether the stricter behavior is intended: if it is, the test becomes a plain pin of the skip; if not, the bump that fixes it turns the test red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
A ref-like name that starts with a non-ASCII letter, like `élanRef`, made the compiler panic through 0.157.0, because the check for a ref-like name sliced the identifier's first byte. A panic aborts the process, a dev server included. Compiled as of 0.158.0 (oxc-project/oxc#28758), as babel-plugin-react-compiler@1.0.0 compiles it. No identifier in this repo or its dependencies has that shape, but like the try-whose-catch-can-never-run test, a regression here would take the whole process down, so it gets a pin. Against 0.156.0 and 0.157.0 the test aborts the Vitest worker; it passes against 0.158.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
The plugin's README now promises that each bindings release is checked before a plugin release ships it, and skipped when its regressions outweigh its fixes, but the procedure behind that lived only in the sessions that did the 0.158.0 bump. A "Bumping oxc-transform-react" section next to "Dependency upgrades" writes it down: - triaging the upstream commits between the two crate tags - comparing the repo, its dependencies and Outlyne compiled with the old and new bindings, in default mode and compilationMode 'all', with ids outside node_modules and each version in its own process, since a panic aborts it - checking fixes and newly skipped shapes at runtime against the uncompiled code and babel-plugin-react-compiler@1.0.0, with `reactCompiler: false` for the uncompiled pass - pinning plausible fixes and every crash, proven against the old bindings by aliasing them in a throwaway Vitest config - weighing regressions against fixes, and tracking any that ship with an it.fails, an upstream issue and a changeset paragraph - writing the changeset from the last shipped bindings version Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
The README said the plugin pins the newest oxc-transform-react that passes this repo's tests, which undersells the reason to depend on it. 0.157.0 passed the suite, fixed 13 miscompiles, and still started skipping and failing builds on code that compiled before, so the plugin skips it for 0.158.0, which fixes that. A new Bindings version section under Usage lists what each release is checked against: the pinned tests and known gaps, a comparison of every JS/TS file in the repo and its dependencies compiled with the old and new bindings, and runtime checks against uncompiled output and babel-plugin-react-compiler@1.0.0. It also says a release is skipped when its regressions outweigh its fixes, and that regressions shipped anyway, and changes to what compiles because the new behavior is correct, are in the changelog and the upstream-tracking suite. The procedure behind those checks is in AGENTS.md. "Why this exists" no longer says a plain Vite + React app has nothing to gain from the plugin. `@vitejs/plugin-react`'s `compiler: true` leaves installing and vetting oxc-transform-react to the app (an optional peer dependency), and the curation is the plugin's second reason to exist. The Caveats paragraph on the upstream-tracking suite links to the new section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q
dd26d1e to
f46d079
Compare
acusti
left a comment
There was a problem hiding this comment.
Re-review at f46d079: ready to merge
The rebase resolves the last item. Main now carries its own lockfile sync (2585af3, up to dropdown 1.4.0), so the PR rightly drops its sync commit. What I checked:
- Rebase: the branch sits linearly on 3ad760a, with no merge commits.
- Lockfile:
bun installleavesbun.lockunchanged, and the PR'sbun.lockdiff against main touches onlyoxc-transform-react. - Content: outside
bun.lock, the diff against main is byte-identical to what I reviewed at dd26d1e. - Every commit: the plugin suite passes at all 21, with counts rising one per pin (36 → 52 passed, then 2 expected fail).
- Full validation at the head:
bun run build,bun run tsc,bun run lintandformat:checkare clean, andbun run testgives 729 passed and 2 expected fail. CI is green. - PR description: it now matches the branch (21 commits, the
AGENTS.mdsection, the weighed release policy).
Nothing I'd change on the branch before merge. The one follow-up is filing the upstream report for the kept-result skip and adding its link to that it.fails comment, as step 5 of the new AGENTS.md procedure asks. That's a one-line commit whenever the issue exists.
Generated by Claude Code
Summary
Bumps
oxc-transform-reactfrom 0.156.0 to 0.158.0 in@acusti/vite-plugin-react-compiler(exact pin). The root and docs devDependency ranges move with it, so bun hoists a single copy.It skips 0.157.0, whose new bail-outs 0.158.0 removes again (oxc-project/oxc#28820). In Outlyne, those bail-outs would have left components uncompiled in 8 files.
The PR lands as 21 commits on top of
main:it.failsfor an asserted allocation that #27427 missesit.failsfor the remaining skip, belowAGENTS.mdsection documenting how to vet a bindings bumpEvery commit passes the plugin suite against 0.158.0.
Each item below was checked by running identical inputs through the bindings with the plugin's own
transform()options (jsx: 'preserve',reactCompiler: {}, plusreportDiagnosticsandpanicThresholdwhere noted). Runtime claims come from rendering each input in sequence in React 19 (happy-dom), with clicks where relevant. Each input was rendered four ways: uncompiled, 0.156.0, 0.157.0 or 0.158.0, and babel-plugin-react-compiler@1.0.0 (with@babel/core7).What changes for users of 0.11.0 (0.156.0 → 0.158.0)
One new skip that can fail builds (
it.fails)A component or hook is now skipped when all of these hold:
if, a loop, aswitch, a ternary or&&It was already skipped outside those. The diagnostic is "Cannot reassign variable after render completes", and under
panicThreshold: 'critical_errors'or'all_errors'it fails the build. A discarded result still compiles.cbis(m) => { warning = m; })if (touched) valid = validate(value, cb);valid = touched ? validate(value, cb) : true;valid = touched && validate(value, cb);for (const r of rules) valid = validate(r, cb);switch (touched) { case true: valid = validate(value, cb); }if (touched) { validate(value, cb); }(result discarded)valid = validate(value, cb);(unconditional)The skip comes from oxc-project/oxc#26893's rewrite of the check. The latest experimental React Compiler build (
0.0.0-experimental-a1856f3-20260507) compiles these cases too, so as far as a published build shows, this is a divergence from React Compiler. Outlyne's 2,096 files have no instance of it.An
it.failstest asserts that theifcase compiles. An upstream report is drafted but not filed yet; its answer decides whether that test stays anit.failsor becomes a plain pin of the skip. The changeset leads with this skip.0.157.0's bail-outs are gone (regression guards)
0.157.0 skipped two shapes in which a callback reassigns a variable declared in another callback, and failed builds on them under
panicThreshold:let socket; (async () => { socket = await connect(url); })();in an effectreturn items.map((item) => { n += 1; … })orreturn fetchPage(page).then((next) => { rows = rows.concat(next); … })0.158.0 includes oxc-project/oxc#28820 (fixing oxc-project/oxc#28401), which limits the check to bindings declared in the component or hook. All six inputs from the earlier review compile again, and so do the 8 Outlyne files 0.157.0 would have skipped.
Two plain tests guard against the regression coming back:
LoadAlland theuseSocketeffect each fail against 0.157.0 and pass against 0.156.0 and 0.158.0.Runtime miscompiles fixed (landed in 0.157.0)
Every 0.156.0 output below renders differently from the uncompiled component, and every 0.158.0 output matches it.
#useRefinline in a memoized object (not pinned)useMemoresultnew Set()shared across dependency changes, so impressions stop trackingref.currentwhen the ref isn't recognized (boxRef ?? ownRef)ref.current.offsetWidthduring render and throws on mountuser.idduring render and throws onceuseris nullnextId.current++heights[index++ % columns] += h(not pinned){ ['__proto__']: label }(not pinned)__proto__key; the entry vanishesundefined; arithmetic throwsThree rows aren't pinned, because nothing in this repo or its 12,712 dependency files has their shapes:
'__proto__'key.parts[parts.length - 1] += x, which behave the same on both versions.ref: React.useCallback(…), don't change output, and no corpus file moves a hook out of a memo block.Now compiled (pinned)
debounced.cancel = cancel. 0.156.0 skipped it with "Ref type environment did not converge"; Babel 1.0.0 compiles it.count++on a variable a closure captures. Babel 1.0.0 bails, like 0.156.0..mapcallback passing an item to a handler that mutates a global (window.location.hash = id). Babel 1.0.0 bails, like 0.156.0.Non-ASCII ref panic (pinned)
A ref-like name that starts with a non-ASCII letter (
élanRef,한글Ref) panics 0.156.0 and 0.157.0, which aborts the process, a dev server included. 0.158.0 compiles it (oxc-project/oxc#28758), as Babel 1.0.0 does. Against older bindings, the test aborts the Vitest worker.It's pinned despite having no corpus instance, because a regression would take the process down. The existing unreachable-
catchpin is there for the same reason.Also in 0.158.0
typescripttransform option (enum inlining) since 0.156.0, which the plugin doesn't pass.Known gap (
it.fails)#27427 misses an allocation wrapped in a TypeScript assertion.
seen: [] as string[]ornew Set() as Set<string>is still cached once per mount, as on 0.156.0 and with Babel 1.0.0.Not pinned
tryin a loop oxc-project/oxc#27417): seconds and gigabytes on 0.156.0, milliseconds after, with identical output. A test would hinge on a timeout. The changeset mentions it.ifs when a value defined before the chain is read after it.declare const|letinside a function body (react-compiler:declare const xinside a component is emitted asconst x;which is a syntax error oxc-project/oxc#27429): tsc rejects it, so only unchecked code can reach it..currenton a context object mutated outside render now goes stale, where 0.156.0 and Babel recompute it. That code breaks the Rules of React.validateNoImpureFunctionsInRender(linter: react/purity flags impure calls inside async (server) components oxc-project/oxc#27974)+constant-folding fix (fix(ecmascript): avoid numeric+folding when an operand may be a string oxc-project/oxc#28544)f<string> in o(fix(parser): preserve in-context after TypeScript type arguments oxc-project/oxc#28300) changed, from fatal to acceptedREADME and AGENTS.md
README: new "Bindings version" section under Usage. It says what each release is checked against:
It also says a release is skipped in favor of the next one that fixes it when its regressions outweigh its fixes. Regressions that ship anyway, and changes to what compiles because the new behavior is correct, are called out in the changelog and tracked in the upstream-tracking suite.
README: "Why this exists" no longer says a plain Vite + React app has nothing to gain from the plugin.
@vitejs/plugin-react6.1.2'scompiler: trueuses oxc-transform-react as an optional peer dependency (^0.152.0) that the app installs and vets itself.AGENTS.md: new "Bumping oxc-transform-react" section, after "Dependency upgrades". It writes down the procedure behind the README's promises:node_modulesand Outlyne in both modesCorpora
compilationMode: 'all'MonthCalendar.tsx(#27420; it no longer misses its cache on every render without atitle) anduseStyles.ts(#27424, same behavior)node_modules)The six compile-status flips in the dependency corpus under
'all':superPropBase, semver'smakeSafeRegex, react-docgen'sgetTypeParameters.stringifyDocument, by the remaining skipreplacePlugin, which mutates its own argument in aforEachcallback, a real violationOutlyne on 0.157.0 would have added diagnostics in 8 files and left components uncompiled in at least 2 of them. Six of the 8 were on its async or returned-callback bail-outs:
EmbedRenderer,Video,WorkspaceProvider,SectionDialog, media-pickerUploadsanduseBookingFlow.Outlyne's 15 code diffs on 0.158.0 come from two changes:
Projects,LayoutButtonEditor,PageHeaderLogoTypeEditor,MenuManagerandMessagingAvailabilitykey onproject,section,settings,menuandavailabilityin place of property paths read in callbacks.BookingTerms,PageLinkEditor,PricingPopover,SubmissionsPopover,VideoPosterEditor,WebsiteSettings,Uploads,useSyncHealth,PromptUsageMeterandutils/media.ts.media.tsnow memoizes a value that reads a module-level cache during render. Its own fetch still updates the value, throughmediaURL. The one difference is timing: when another instance caches an entry first, the slot now picks it up only once its own fetch resolves. Separately, that reading turned up a duplicate-request bug in the same hook, fixed in outlyne/outlyne#3056.No input threw, crashed, or changed fatal status on any version.
Tests
upstream.test.tsgains 16 plain tests and 2it.failstests, verified by aliasingoxc-transform-reactto older installs:it.fails, since 0.156.0 compiles its input.Validated on the rebased head with:
bun install --frozen-lockfilebun run buildbun run buildall(including the Storybook build)bun run test(729 passed, 2 expected fail)bun run lintbun run tscbun run format:check🤖 Generated with Claude Code
https://claude.ai/code/session_01Cito1LcGyM2qjPAVSWgY2q