Skip to content

react-compiler: decode a UTF-8 string when constant propagation joins it to a UTF-16 string - #45172

Open
robobun wants to merge 1 commit into
mainfrom
robobun/5d375bfc/react-compiler-join-utf8-utf16
Open

robobun wants to merge 1 commit into
mainfrom
robobun/5d375bfc/react-compiler-join-utf8-utf16

Conversation

@robobun

@robobun robobun commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • bun build --react-compiler --define 'K="é"' compiles "中" + K to "中é" and folds === "中é" on it to false. bun lint folds "é" + "é" + "é" === "ééé" to false and misses an unconditional setState.
  • Cause: push_units (src/react_compiler/optimization/constant_propagation.rs:812) widens each byte of an 8-bit string to a code unit. 8-bit strings hold UTF-8.

Fix

  • push_units decodes the 8-bit operand into the output buffer (strings::convert_utf8_to_utf16_in_buffer). It adds no allocation.
  • JsString::from_wtf8_bytes uses the same transcoder for two 8-bit strings. Half of a surrogate pair stays as it is.
  • Verified: 3 new tests in test/bundler/transpiler/react-compiler.test.ts (CLI, Bun.build, bun lint) fail on main. Both fixture suites pass.
  • Self-reviewed: 7 concerns raised, 5 addressed. Not taken: a todo test row (CI never runs it). Not taken: the lint test in test/cli/lint (that file timed out on debug builds).

Background

Downsides

  • "中" + "x" costs 171 more instructions per fold (100 to 271). 64 ASCII bytes cost 128 fewer.
  • A lone non-UTF-8 byte (env value \xE9) folds to U+FFFD, not U+00E9.
  • push_units grows 121 bytes. .text is unchanged.
Notes

How it was found, and who it reaches

  • It was found by reading the code (js_parser: use EString::eql_bytes in the {k: v}.k fold, keep this for template tags #32297 names it: "It has no PR yet"). There is no user report and no issue.
  • --react-compiler is experimental and off by default. push_units is wrong in 1.4.0 to 1.4.4. bun lint is not in a release yet.
  • The 8-bit side is a string that skips the lexer and has a non-ASCII character: a define value, an inlined process.env value (--env=inline), module.filename in a file with a non-ASCII name, or any literal under bun lint (src/lint/react_compiler/convert.rs:914).
  • The UTF-16 side is a non-ASCII literal from the lexer, or an earlier fold with a non-ASCII result. So K + K + K is wrong too: K + K is UTF-16.
  • Wrong on main because of the join: the constant in both operand orders, through +=, and read in a nested function. Also .length of the join (3, not 2), === against the right literal, the if pruned on it, and a pair of surrogate halves split across the two strings.

Not fixed here

Measurements (release builds of main d1cb7db without and with this diff, linux x64. Not repeated after the rebase onto main 449877f: the source hunk and convert_utf8_to_utf16_in_buffer did not change)

  • Allocations per folded join with a UTF-16 operand: 1 on main and 1 here (the Vec::with_capacity of the arm), 0 regrows. A join of two 8-bit strings does not enter the arm. Counted with scratch counters in a debug build, 10,000 folds per class.

  • Instructions per call of push_units, callees included. valgrind and perf are not available on the machine (no package source, no PMU). The count is a single-step trace in gdb, 40 calls per class, min equal to max:

    operand main PR
    UTF-16, 1 unit 66 70
    8-bit ASCII, 1 byte 34 201
    8-bit ASCII, 64 bytes 349 217
    8-bit é, 2 bytes 39 (wrong result) 257
    8-bit non-ASCII, 64 bytes 349 (wrong result) 306

    A fold calls push_units once per operand. Per fold: two 8-bit strings +0 (no call), UTF-16 and 1 ASCII byte +171 (100 to 271), UTF-16 and 64 ASCII bytes -128 (415 to 287), two UTF-16 strings +8 (132 to 140), UTF-16 and é +222 (105 to 327, wrong result on main).

  • Size: push_units is 144 bytes on main and 265 here (llvm-nm). .text is 79,690,917 bytes and the stripped binary 105,223,912 bytes in both (llvm-size). Alignment padding takes the 121 bytes. evaluate_binary_op is inlined into constant_propagation_impl, 11,611 bytes in both.

  • Outputs that were right stay the same: "中" + "x", "x" + "中", "中" + "" and a 64-byte ASCII operand are new test rows and pass on main. 0 of 14 snapshots of react-compiler.test.ts change. 0 of 1,807 fixture outputs differ, but no fixture calls push_units (0 calls, counted at a gdb breakpoint).

  • A byte that is not UTF-8: with \xE9, "中" + process.env.V folds to 4e2d e9 on main and 4e2d fffd here. "x" + process.env.V folds to 78 fffd on both. With \x80\x80\x80 the two joins give 4e2d fffd fffd fffd and 78 fffd fffd fffd here. Both inputs are test rows.

Self-review, not taken

  • A todo test row for the folds under "Not fixed here". CI does not run a todo body, and the list above is the record.
  • Moving the bun lint test to test/cli/lint/react-compiler.test.ts. Three ESLint-format tests of that file have the default 5 s timeout, and CI sets a longer one. On a debug build of the first base they timed out when the whole file ran. Each passed alone. On a debug build of this branch on main 449877f they took 1.7 s, 2.8 s and 3.6 s in one run. So a debug run of that file is not a reliable proof for the new test. The test can move if a maintainer prefers that file.

Tests (debug build of the branch after the rebase onto main 449877f)

  • bun bd test test/bundler/transpiler/react-compiler.test.ts: 124 pass, 1 skip, 1 todo. The 3 new tests fail on a debug build of main 449877f.
  • react-compiler-fixtures.test.ts: 3,293 pass, 320 skip. react-compiler-fixtures-run.test.ts: 849 pass.
  • test/cli/lint/react-compiler.test.ts: 26 pass, 1 skip.
  • Before the rebase: 119 pass in react-compiler.test.ts, the 3 new tests failed on a debug and on a release build of main, and test/cli/lint/react-compiler.test.ts had 27 pass on the release build with this diff.

[human-review] gate passed · iteration 0 · 2 files touched

fails on main (without fix)
ASAN without fix: 3 failed, 2 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/pr_gate.xml" test/bundler/transpiler/react-compiler.test.ts
bun test v1.4.4 (367d939d9)

test/bundler/transpiler/react-compiler.test.ts:
(pass) bundler > react-compiler/SimpleComponent [1572.03ms]
(pass) bundler > react-compiler/ComponentWithHooks [661.93ms]
(pass) bundler > react-compiler/ObjectPatternRestInProps [577.31ms]
(pass) bundler > react-compiler/UnderscoreAndDollarComponentTags [625.92ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Browser [414.97ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Bun [432.06ms]
(pass) bundler > react-compiler/FullstackHtmlImportCompilesClientGraphInClientMode [960.48ms]
(pass) bundler > react-compiler/OutputModeExplicitSsrOverridesTarget [282.71ms]
(pass) bundler > react-compiler/SsrObjectMethodShorthand [4366.78ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Client [250.07ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Ssr [234.24ms]
(pass) bundler > react-compiler/BundledReactPreservesImportRefs [914.27ms]
(pass) bundler > re
... (truncated)

release without fix: 41 failed, 2 skipped
bun test v1.4.3-canary.1 (367d939d9)

test/bundler/transpiler/react-compiler.test.ts:
(pass) bundler > react-compiler/SimpleComponent [103.88ms]
(pass) bundler > react-compiler/ComponentWithHooks [30.08ms]
(pass) bundler > react-compiler/ObjectPatternRestInProps [32.54ms]
(pass) bundler > react-compiler/UnderscoreAndDollarComponentTags [27.44ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Browser [32.27ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Bun [31.93ms]
(pass) bundler > react-compiler/FullstackHtmlImportCompilesClientGraphInClientMode [33.00ms]
(pass) bundler > react-compiler/OutputModeExplicitSsrOverridesTarget [18.39ms]
(pass) bundler > react-compiler/SsrObjectMethodShorthand [61.88ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Client [19.55ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Ssr [17.33ms]
(pass) bundler > react-compiler/BundledReactPreservesImportRefs [30.09ms]
(pass) bundler > react-compiler/BundledCjsCompilerRuntimeSurvivesTreeShaking [32.02ms]
(pass) bundler > react-compiler/RequireStringPreservesImportRecord [18.91ms]
(pass) bundler > react-compiler/Branch
... (truncated)
passes on PR (with fix)
ASAN with fix: 2 skipped
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test "--reporter=junit" "--reporter-outfile=/tmp/pr_gate.xml" test/bundler/transpiler/react-compiler.test.ts
bun test v1.4.4 (367d939d9)

test/bundler/transpiler/react-compiler.test.ts:
(pass) bundler > react-compiler/SimpleComponent [1347.67ms]
(pass) bundler > react-compiler/ComponentWithHooks [662.55ms]
(pass) bundler > react-compiler/ObjectPatternRestInProps [613.92ms]
(pass) bundler > react-compiler/UnderscoreAndDollarComponentTags [686.44ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Browser [325.20ms]
(pass) bundler > react-compiler/OutputModeDefaultsByTarget-Bun [335.80ms]
(pass) bundler > react-compiler/FullstackHtmlImportCompilesClientGraphInClientMode [947.81ms]
(pass) bundler > react-compiler/OutputModeExplicitSsrOverridesTarget [258.50ms]
(pass) bundler > react-compiler/SsrObjectMethodShorthand [1361.39ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Client [246.77ms]
(pass) bundler > react-compiler/OutputModeIgnoredWhenCompilerDisabled-Ssr [279.41ms]
(pass) bundler > react-compiler/BundledReactPreservesImportRefs [823.57ms]
(pass) bundler > re
... (truncated)

release with fix: 2 skipped
$ bun scripts/build.ts --profile=release
[configured] bun-profile → bun (stripped)
  target       linux-x64-gnu
  build type   Release
  build dir    ./build/release
  revision     7e13ddcd91
  features     lto, baseline

23 deps, 146 codegen, 1176 objects in 2091ms

ninja: Entering directory `/workspace/bun/build/release'
[1/4] fetch lolhtml
[lolhtml] up to date
[2/4] fetch rust-argon2
[rust-argon2] up to date
[2/4] cargo plan → /workspace/bun/build/release/rust-target/plan.json
265 units: 193 lib, 16 proc-macro (host), 19 custom-build (host), 15 run custom-build, 17 lib (host), 4 run custom-build (host), 1 rlib
[3/4] reconfigure
[1/1530] mkdir stamps
[2/1530] mkdir codegen
[3/1530] gen bake.{client,server,error}.js
-> bake.client.js, bake.server.js, bake.error.js
[4/1530] install /workspace/bun
bun install v1.4.3-canary.1 (367d939d9)

Checked 22 installs across 44 packages (no changes) [1322.00ms]
[5/1530] install /workspace/bun/packages/bun-error
bun install v1.4.3-canary.1 (367d939d9)

Checked 1 install across 2 packages (no changes) [67.00ms]
[6/1530] rustc unicode_xid 
[7/1530] rustc unicode_ident 
[8/1530] gen string-map defines_table
[9/1530] rustc heck 
... (truncated)
diff hotspot
.../optimization/constant_propagation.rs           |   8 +-
 test/bundler/transpiler/react-compiler.test.ts     | 244 +++++++++++++++++++++
 2 files changed, 251 insertions(+), 1 deletion(-)

gate history · 1 passed · 0 rejected · iteration 0

evidence per changed file
file                                                     reads  edits  tests
src/react_compiler/optimization/constant_propagation.rs      3      1     37
test/bundler/transpiler/react-compiler.test.ts               4      3     37

@robobun

robobun commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 8:46 AM PT - Oct 26th, 2026

✅ @robobun, your commit 1820aed1e8b6e5e37b201b09bb51d8fa6a15c62f passed in Build #133108! 🎉


🧪   To try this PR locally:

bunx bun-pr 45172

That installs a local version of the PR into your bun-45172 executable, so you can run:

bun-45172 --bun

@robobun

robobun commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status

Reproduced on 1.4.3-canary (367d939) and on main (d1cb7db). bun build comp.jsx --react-compiler --define 'K="é"' --external '*' prints "中é" for "中" + K. On main, bun lint with react/set-state-in-render does not report the setState call under if ("é" + "é" + "é" === "ééé").

Reproduced again on main 449877f, the base of this branch since the rebase of 2026-10-26. On a debug build of that main the 3 new tests fail: "中" + K has the code units 4e2d c3 a9, and bun lint does not report the setState call. With this branch they pass.

The fix is this PR, #45172.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 7e13ddc and 1820aed.

Files selected for processing: 1
  • test/bundler/transpiler/react-compiler.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

The compiler now converts 8-bit string data from UTF-8 to UTF-16 code units. Regression tests cover string concatenation across values and contexts, and lint diagnostics for constant conditions formed by string concatenation.

Changes

React Compiler string decoding

Layer / File(s) Summary
Decode strings and verify compiler behavior
src/react_compiler/optimization/constant_propagation.rs, test/bundler/transpiler/react-compiler.test.ts
push_units converts 8-bit string data from UTF-8 to UTF-16; the UTF-16-backed path is unchanged. CLI and API tests cover concatenation, templates, assignments, comparisons, branch evaluation, and invalid bytes. A lint test checks diagnostics for constant conditions formed from non-ASCII and ASCII strings.

Suggested reviewers: jarred-sumner

Priority: Normal

Merge Risk: Minimal · up to 1820a

No actionable merge-blocking issue is established; the change is mergeable after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: decoding UTF-8 strings during constant propagation when joining them with UTF-16 strings.
Description check Passed The description explains the problem, fix, scope, downsides, and verification results. It does not use the exact template headings, but it provides the required information in equivalent sections.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Beyond the inline findings, I also checked whether sizing the output buffer to bytes.len() u16 slots can trip the panic in convert_utf8_to_utf16_in_buffer (src/bun_core/string/immutable.rs:2501): it cannot, since both the simdutf path and the WTF-8 fallback consume at least one input byte per emitted code unit (4 bytes for a surrogate pair), so the output never exceeds the input byte count. The Latin-1 .env to U+FFFD change and the unfolded template-literal join were also examined and are consistent with the PR's stated scope.

Extended reasoning...

The change replaces byte-widening in push_units (src/react_compiler/optimization/constant_propagation.rs) with a WTF-8 to UTF-16 transcode into a pre-resized Vec slot, plus itBundled and bun lint tests. It touches no security-sensitive surface; the only hazard examined was the panicking converter, whose buffer bound holds here. Two confirmed sibling encoding-blind folds (== against numbers, .length on invalid UTF-8) remain as inline findings, so a human should weigh whether they belong in this PR.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🟣 src/react_compiler/optimization/constant_propagation.rs — Users who compare a folded non-ASCII string to a number with == get a wrong constant and a pruned branch, the same encoding-blind string folding this PR fixes one arm of. At constant_propagation.rs:1077 every UTF-16 string yields NaN via as_bytes().map(js_to_number).unwrap_or(NaN), so (" " + ONE) == 1 with --define ONE="1" folds to false while JavaScript gives true. Fix: run ToNumber on the UTF-16 code units (trim JS whitespace, parse) or decline the fold when the string is UTF-16, so the arm never asserts a wrong equality for a non-ASCII operand.

    Why this was flagged

    Trigger: a constant string with any non-ASCII content (a lexer literal, or the result of a join that push_units now produces correctly) compared with == or != to a number constant, reached through js_abstract_equal from the Equal/NotEqual folding in evaluate_binary_op. constant_propagation.rs:1077 maps a UTF-16 string straight to NaN and :1079-1083 then folds the comparison to false, which the compiler uses to prune the branch; JS ToNumber of " 1" is 1, so the user's taken branch is deleted. The base behaves the same, but REVIEW.md requires fixing the whole class in the same PR: this arm is in the same function family, has the same root cause (treating UTF-16 storage as non-numeric and byte-level checks without encoding branching), and the PR author lists it only as 'Not fixed here'. Remedy: decode UTF-16 to a numeric parse (or return None for UTF-16 strings) in the string/number arm.

    Verification: Pre-existing; acknowledged in the PR description's "Not fixed here" section. At src/react_compiler/optimization/constant_propagation.rs:1077 s.as_bytes().map(js_to_number).unwrap_or(f64::NAN) yields NaN for any UTF-16 string, so == to a number constant folds to false. Lines 1056-1096 are untouched by this diff; on the base commit the same inputs fail by the same route.

  • 🟣 src/react_compiler/optimization/constant_propagation.rs — A component reading .length of an inlined env or define value containing bytes that are not valid UTF-8 gets a folded length that disagrees with the string the compiler itself folds for the same value. At constant_propagation.rs:523 len_utf16 (js_string.rs:85) uses simdutf's utf16-from-utf8 length for 8-bit non-ASCII data, which counts stray continuation bytes as 0 units, while push_units at :817 turns each such byte into one U+FFFD unit. Fix: compute .length by the same WTF-8 decoding used for the join (count units produced by convert_utf8_to_utf16_in_buffer or an equivalent fallback-aware counter) so length and content folds agree.

    Why this was flagged

    Trigger: --env=inline with a value such as three 0x80 bytes (test row Utf16ThenThreeBadBytes at react-compiler.test.ts:3633 shows the join folds to 4e2d fffd fffd fffd), and a component that reads V.length or branches on it. js_string.rs:81-85 returns element_length_utf8_into_utf16, which with USE_SIMDUTF (unicode.rs:1123-1124) is simdutf::length::utf16::from::utf8, giving 0 for continuation-only input, so V.length folds to 0 while ("x" + V).length folds to 4 via the UTF-16 join. The PR adds the U+FFFD convention to the UTF-16 join without making the sibling length fold use the same decoder, so the two constants the compiler emits for one value contradict each other. Pre-existing on base for the 8-bit path, but this PR extends the U+FFFD rule to a second site and REVIEW.md says never compare byte counts to code-unit counts across a conversion. Remedy: derive the length from the same WTF-8 decode that produces the units.

    Verification: Pre-existing: base already folds V.length the same wrong way by the same route. Trigger: --env=inline whose value contains stray continuation bytes such as \x80\x80\x80, and a component under --react-compiler that reads V.length. constant_propagation.rs:521-523 folds .length with s.len_utf16(), which counts continuation bytes as 0 units. So for \x80\x80\x80, V.length folds to 0, while the real V.length is 3.

@robobun

robobun commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator Author

Both findings are in code that this PR does not change, and both fold the same way on main. I checked each on release builds of main and of this branch.

== of a string and a number (constant_propagation.rs:1071)

  • Confirmed. With --define 'ONE="1"', ("\u00a0" + ONE) == 1 folds to false. It is under "Not fixed here" in the description.
  • Each of the two fixes changes folds that are right today. Reading a UTF-16 string through js_to_number gives it the wrong folds of js_to_number ("infinity" == 1 / 0 folds to true). Not folding a UTF-16 string against a number drops the fold of "é" != 1 in a build. Under bun lint it drops the report of a setState call below if ("é" + "é" != 1).
  • The exact fix is JavaScript's whitespace and number grammar in js_to_number, for both storages. That is a change of its own, so this PR stays with the join. If a maintainer wants the narrow fix in this PR, I will add it.

.length of an 8-bit string that is not valid UTF-8 (diagnostics/js_string.rs:85)

Confirmed, and it is wider than reported. For an inlined env value:

bytes V.length, folded units of V in a folded join V.length at run time, not folded
80 80 80 0 3 3
E9 1 1 1
F0 2 1 1
E4 B8 1 2 1

The length fold, the join and the printer each decode such bytes in their own way. The numbers are the same on main. A decode where the value is made settles it for every reader, and #42019 does that for define and env values. I added this to "Not fixed here".

@robobun

robobun commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator Author

#46915 has the same push_units change in src/react_compiler/optimization/constant_propagation.rs. The bun lint test is only in this PR. The second to merge drops the source hunk.

… it to a UTF-16 string

`push_units` widened each byte of an 8-bit string to one UTF-16 code
unit. An 8-bit string holds UTF-8, so a character that is not ASCII
became one code unit per byte: `"中" + K` with the define `K="é"`
folded to "中é". `bun lint` gives the compiler every string literal as
UTF-8 bytes, so `"é" + "é" + "é" === "ééé"` folded to false there.

The 8-bit arm now decodes the bytes into the tail of the output buffer,
with the transcoder that `JsString::from_wtf8_bytes` uses for a join of
two 8-bit strings. Half of a surrogate pair stays as it is, and a byte
that is not UTF-8 is U+FFFD in both joins.
@robobun
robobun force-pushed the robobun/5d375bfc/react-compiler-join-utf8-utf16 branch from 7e13ddc to 1820aed Compare October 26, 2026 14:00

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — a small, self-contained fix with a thorough test matrix.

What was reviewed:

  • push_units in src/react_compiler/optimization/constant_propagation.rs: checked that bytes.len() u16 slots always suffice for the panicking convert_utf8_to_utf16_in_buffer — the WTF-8 fallback only emits two units after a 4-byte decode whose continuation bytes all validated, and every other path emits at most one unit per byte, so the buffer cannot be too small; resize/truncate uses the returned slice length, leaving no stale zeros.
  • Sibling sites: no other b as u16 widening of 8-bit EString data remains in src/react_compiler; the new arm matches the shape JsString::from_wtf8_bytes already uses, so both join paths now transcode identically.
  • Tests: backend, define, dotenv, env, and Buffer-valued files are all supported by expectBundled; the lint test drains pipes via Promise.all, asserts stdout before the exit code, and cleans up with using.
Extended reasoning...

The diff replaces a byte-to-code-unit cast in the React Compiler constant-propagation string-join helper with the in-tree UTF-8 to UTF-16 transcoder (8 lines of Rust) and adds a parameterized bundler test plus a bun lint test covering accented, astral, split-surrogate, env-sourced invalid-byte, module.filename, .length, ===, and branch-pruning shapes. It touches no security-sensitive surface (no auth, crypto, permissions, or path handling) and no CODEOWNERS-covered path. The panicking transcoder variant is provably safe because output units can never exceed input bytes, the change mirrors the existing from_wtf8_bytes pattern, and a grep found no remaining sibling sites of the same bug class in the module. The bug hunt ran to dry_streak with no findings, and the new commit since the earlier bot comment is the rebased version of the same change.

robobun added a commit that referenced this pull request Oct 27, 2026
…sign target, more tests

- `fold_constant_index` takes its target by reference, so the longest
  `a["b"]["b"]...` chain is main's again.
- `order_utf16` is the code of main again. `checked_order_utf16` compares
  two ASCII texts as bytes and decodes other texts from the start.
- `.length` of a string is not folded where it is assigned to, updated or
  deleted.
- `push_units` of the React Compiler is the code of main again: #45172
  owns that join.
- The checked iterator is private to the string module, and the note on
  `init_re_encode_utf8` stays.
- Tests: the bounds of a folded index, the order and key folds under
  `bun run`, long texts in the seeded differential, and the folds with no
  minify flag beside the other define folds.
- bench/snippets/transpiler-define-folds.mjs times the folds by kind of
  text and length.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant