Repository navigation
Conversation
📝 WalkthroughWalkthroughAdds shared URL boundary predicates for ASCII whitespace, delimiters, trailing punctuation, and CJK/fullwidth punctuation. Terminal URL hit testing now imports these predicates instead of local implementations. Tests cover URL termination around fullwidth parentheses, CJK corner brackets, ideographic spaces, and half-width separators, including extracted URL spans. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.ts (1)
63-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for trailing CJK punctuation.
These tests cover bracket and whitespace boundaries, but not
isCjkUrlTrailingPunctuationfor characters such as。,、,!, or?. Add a case asserting both the extracted URL andendIndexexclude trailing punctuation.Based on the PR objective to cover trailing CJK punctuation, this path needs a direct regression case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7e9cbe17-e47c-4d28-b873-7247211b83d2
📥 Commits
Reviewing files that changed from the base of the PR and between 505967e and 2a4bb28a2a514c571dc2350ebb856a09ffc9bfcd.
📒 Files selected for processing (3)
src/renderer/src/components/terminal-pane/terminal-http-url-boundary.tssrc/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.tssrc/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.ts
|
Thanks for turning this around so fast — the diagnosis in #10571 is spot on, the ASCII-only predicates are exactly the bug. I dug in before approving and think the fix needs a different shape. Running this PR's predicates against a wider case set, the punctuation-only half of
Trailing-trim only strips from the end of an already-terminated candidate. Worth flagging what that output actually is: with no path, the WHATWG parser folds the CJK into the authority and IDNA-encodes it, so the link silently retargets to a different, registrable domain rather than 404ing. I confirmed it against the live module in a running renderer. That makes this a link-spoofing surface, which is why I want to be careful here. CodeRabbit's one nitpick on this PR was "add coverage for trailing CJK punctuation ( Two changes I'd make:
There's also a second detector in play: That adds up to a good deal more than this PR signed up for, so I'm going to pick it up in a follow-up with you as co-author rather than ask you to build the whole thing. Hope that's alright — the report and repro were genuinely useful and made this much faster to work through. |
Sync update (
|
URL scanning only treated ASCII whitespace/punctuation as boundaries, so Japanese/Chinese annotations glued after a URL (fullwidth parentheses, corner brackets, ideographic space) were swallowed into the link and opened as percent-encoded garbage (fixes stablyai#10571).
Address Amethyst review: non-ASCII body terminators via Unicode White_Space/P/Sm properties; authority rejects non-ASCII so CJK cannot IDNA-fold into the host; cover 、。・ and broader Unicode whitespace.
7d9e853 to
3c294e5
Compare
The stablyai#10573 review showed a trailing trim only fires when the tail is exactly what it strips. The letters-only form had the same hole: a particle followed by punctuation or ASCII left the whole span linked. plans/foo.mdを(参照) -> plans/foo.mdを(参照 plans/foo.mdへabc -> plans/foo.mdへabc docs/日本語.md」を 参照 -> docs/日本語.md」を 参照 The first two were regressions against main, where the ASCII-only class truncated at the first non-Latin byte by accident. Widening to \p{L} removes that accident, so the trim has to carry the boundary itself. Once an ASCII extension closes the name a real path only continues with ASCII (`/`, `\`, `:line`), so cut at the first \P{ASCII}. Same lookahead in all three copies of the spaced-path scan: renderer, mobile tap, and the injected webview mirror that carries its own regexes. Also pin \p{M} in the NFD test: the fixture decomposes to a combining mark, so dropping \p{M} now fails (flagged by coderabbit on stablyai#13399). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QDkPfyEHWNUW1JQZRe6tKb
Summary
Fixes #10571.
Why
Terminal URL extraction previously recognized only ASCII boundaries. Text such as a Japanese annotation directly after a GitHub URL could be included in the link, producing a percent-encoded or IDNA-transformed destination instead of the URL the user intended.
Scope and design
Test plan
Screenshots
No visual chrome changes.
Security audit
The authority guard prevents missed Unicode boundaries from being silently IDNA-folded into a different hostname. The change adds no external requests, persistence, or new routing destination.
Platform review
The scanner uses standard JavaScript Unicode property escapes and URL parsing already supported by the desktop terminal path. The behavior is platform-independent across macOS, Linux, and Windows.
ELI5
If a terminal prints a URL followed immediately by Japanese or other Unicode notes, Orca now links only the real URL. Unicode text inside the URL path still works.