Repository navigation
test(intl): cover Segmenter surrogate-pair boundaries - #112
Merged
Merged
Conversation
Requires OpenClaw WebKit with the oven-sh/WebKit#753 port. Check containing() against iteration across both halves of surrogate pairs, all three granularities and both lookup directions. Co-authored-by: robobun <117481402+robobun@users.noreply.github.com>
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.
Cover
Intl.Segments.containing()at every UTF-16 code-unit offset in a mixed Unicode corpus, in both lookup directions and for grapheme, word and sentence segmentation. The corpus includes surrogate pairs, flags, combining emoji, ZWJ sequences, an unpaired surrogate and ASCII, with out-of-range checks.The old engine returns the preceding segment for some surrogate-pair offsets. Comparing with iteration also checks segment indices, original input and word status. The engine correction is the port of oven-sh/WebKit#753; thanks @robobun. Requires OpenClaw WebKit. Related oven-sh#44432 remains open; no duplicate upstream PR is needed.
Before: all three added cases fail on old-engine Bun, while Node 24 passes the same corpus. After: all three added cases pass, and the full Intl suite passes all 44 cases. The fully integrated native build passes 873 surrounding tests with 4 skips, 61 todos and zero failures across 22 files. The expanded plain selection is 47/47 with zero regressions, and all four requested OpenClaw consumers pass on that same binary. The final branch passes scoped Codex P2 review. Both exact-head CI lanes pass: Linux x64 and macOS arm64.
Native proof was built at
bfe801e73fb70638c053bcbf5ea887e26565cdb2. Final head3d1f4d51a054f29cf7003ce23fced664de7189e1differs only by the inherited Rust safety comment from #110 and Node-oracle explanation from #111. Strict source comparison confirms unchanged runtime logic and test assertions.