Repository navigation
fix(node:path): preserve unpaired UTF-16 surrogates - #163
Merged
Merged
Conversation
Adapt oven-sh#34596 to borrowed string views and retain the existing lossless process.cwd handling in resolve. Cover both path variants and suffix comparisons that split a valid surrogate pair. Co-authored-by: robobun <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 14, 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.
What does this PR do?
Preserve unpaired UTF-16 code units throughout
node:pathon bothposixandwin32. Previously, converting inputs to UTF-8 replaced lone surrogates with U+FFFD. This also fixes suffix comparisons that remove one code unit from a surrogate pair.Adapts the implementation and tests from oven-sh#34596 by @robobun to the current borrowed-string API. Wide path arguments use the existing UTF-16 algorithms; mixed-width arguments widen Latin-1.
format()retains field strings across user getters. The scratch pool keeps the same byte capacities with two-byte alignment.resolve()preserves its existing replaceableprocess.cwdand WTF-8 handling and now encodes argument strings through the same lossless bridge.How did you verify your code works?
Node 24.21.0 passes all 80 checks in a standalone path-family matrix; stock Bun 1.4.3 passes 42. The new Bun regression tests cover lone high/low surrogates, valid pairs, mixed-width arguments,
formatgetters that force GC, and a basename suffix splitting a pair.On Linux x64, a release build passes
bun run build:release test test/js/node/path: 170 passed, 3 existing platform skips, 0 failed across 19 files. The new regression filter reports 1 pass, 6 failures on the unpatched build. The standalone family matrix passes 80/80 on the patched binary.OpenClaw’s
extensions/codex/src/app-server/sandbox-exec-server/fs-policy.test.tspasses 12/12 on Node 24 and the patched Bun binary; the unpatched fork reports 11 passed, 1 failed, specifically the Unicode code-point case. Tests used private home/state/temp directories.Independent Codex and Claude reviews are scoped-clean at P2 against the fork base.
BUN_CODEGEN_DIRselected the release-generated sources forbun run rust:check-all: 2 targets passed, 0 failed, 10 skipped because their standard libraries were not installed on the proof host.The upstream proposal remains open; this fork adaptation does not open a competing upstream PR.
CI on this head passed native Linux x64 and macOS arm64 build/test jobs, formatting, JavaScript/source lints, clippy, mordant, Miri, lol-html tests, and Socket Security. The only failed check is the existing
claude-find-issuesautomation: run 38530109349 fails environment validation before analysis because no Anthropic API, OAuth, or federation credential is configured. It produced no code finding and was not rerun.