fix(string): index WTF-8 positions without unchecked UTF-8 - #10989
proggeramlug wants to merge 2 commits into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 8 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe UTF-16 offset helper now traverses raw WTF-8 bytes. ChangesWTF-8 position handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to String searches now preserve UTF-16 positions across lone surrogates, with regression coverage for the affected behavior. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings
🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
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. Comment |
|
Landed on main in merge train 257 (#11039, v0.5.1640), main Carried at head This train was split by blast radius after an earlier 35-PR assembly hit five gap regressions: it carries only PRs touching no lowering path. Trains rebase-merge, so commits get new SHAs and GitHub cannot mark this merged. Closed as landed. |
Fixes #10725.
The UTF-16-position walker already reads bytes through
wtf8_step, so it now accepts a byte slice directly.startsWithandendsWithpass the string payload without constructing an unchecked&strfrom WTF-8 that may contain a lone surrogate. The other walker call site passes its bytes to the new signature.A runtime unit test covers positions before and after lone high and low surrogates. A gap fixture checks the same cases against Node.
Verification:
CARGO_TARGET_DIR=/Users/amlug/projects/perry/agent-trees/fix-10645/target RUST_TEST_THREADS=1 cargo test -p perry-runtime --lib starts_and_ends_positions_cross_lone_surrogates -- --test-threads=1node --experimental-strip-types test-files/test_gap_10725_wtf8_starts_ends_position.tsrustfmt --check --edition 2021on the three changed Rust files, andgit diff --checkSummary by CodeRabbit
Bug Fixes
startsWithandendsWithbehavior for strings containing lone surrogate characters.Tests