Skip to content

fix(terminal): keep CJK name punctuation inside terminal file links - #23061

Open
Yi-111-a wants to merge 5 commits into
stablyai:mainfrom
Yi-111-a:fix/terminal-link-cjk-punctuation
Open

Yi-111-a wants to merge 5 commits into
stablyai:mainfrom
Yi-111-a:fix/terminal-link-cjk-punctuation

Conversation

@Yi-111-a

Copy link
Copy Markdown
Contributor

ELI5

If a folder in your path had a Japanese middle dot in its name — 会社・事業 — Orca's terminal
only underlined the part of the path in front of the dot, and clicking the file part did nothing.
Now the whole path comes out as one link, the same way it already did for letters, digits and
accents.

What Changed

LOCAL_PATH_REGEX in src/renderer/src/lib/terminal-links.ts — the detector that claims local
paths in terminal output — accepted \p{L}\p{M}\p{N} plus a handful of ASCII path characters after
the first separator. Category Po was not in the class, and U+30FB ・ (KATAKANA MIDDLE DOT),
U+FF65 ・ (HALFWIDTH KATAKANA MIDDLE DOT), U+301C 〜 (WAVE DASH) and U+FF5E ~ (FULLWIDTH
TILDE) are all Po. The match stopped in front of the first one and the remainder of the path was
never part of the link.

printed path before after
//nas/base/会社・事業/個人事業主/確定申告/R7確定申告送信票.pdf link ends at 会社 whole path
C:/tmp/中黒・テスト/a.txt link ends at 中黒 whole path

The four characters are added to the trailing class. Nothing else about the detector changed: the
leading alternation, the :line:col suffixes, isInsideUriScheme, the spaced-path passes, the
boundary-punctuation trimming and the ReDoS profile are untouched.

Why

  • \p{Po} as a whole is not usable here. It reintroduces , ; " ' < > |, which are
    exactly the delimiters the boundary trimmer and the spaced-path passes rely on to stop a link
    before prose. Widening the class that way would make /tmp/report.txt, then one link.
  • The fullwidth forms the report also suggested (U+FF01–FF5E) have the same problem in a different
    shape: , and 。 are sentence punctuation, so cat /tmp/報告.txt,確認 would link
    /tmp/報告.txt,確認 instead of stopping at the path. I left the block out for that reason.
  • Only the middle dots and the tildes are left. All four are legal path characters on every
    platform, none of them reads as a delimiter next to a path, and together they cover the CJK
    folder names that the report's table reproduces.
  • \u30FB and \uFF65 look identical in a source file but are different code points, so the class
    uses escapes rather than literals.

Scope note: mobile/src/terminal/terminal-path-tap.ts has its own ASCII-only copy of this regex
for the mobile tap detector. It is a separate detector with a separate matcher, and the report is
about the desktop hover/click path, so I left it alone rather than widening this PR.

Linked Issue

Fixes #23019

Visual Proof

N/A — no visual or interaction change beyond the link range growing to cover the characters above.
The rendering of an already-detected link is unchanged; there is no new UI surface.

Testing

Ran the detectors and their regression suites on Linux with the repo's own config
(config/vitest.config.ts): src/renderer/src/lib/terminal-links.test.ts,
src/renderer/src/lib/terminal-links-redos.test.ts, src/renderer/src/lib/terminal-file-uri-link.test.ts
and src/shared/file-link-location.test.ts — 71 tests, all passing. oxfmt --check and
oxlint --config .oxlintrc.json are clean on both changed files.

The two new tests fail on the unmodified LOCAL_PATH_REGEX and pass with the change, so they are a
real regression guard:

  • keeps CJK name punctuation in the detected range — the two rows from the report's table.

  • still stops a CJK path at ASCII delimiters — a CJK path followed by , and ; still stops at
    the path, which is the property the narrower choice above protects.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

I could not drive a real terminal on all three platforms from this environment, so the manual
checkbox is unticked. The detector is platform-independent — it is one regex shared by the local
and SSH/remote terminal link providers, and the new characters are not path separators — so
macOS/Windows/SSH share the same behaviour; the report's own repro was on Windows and the fix is
verified by the unit tests rather than by a hand-run session.

AI Disclosure

This PR was produced with OpenCode (opencode/space-bunny-free) driving a local checkout. The
reporter supplied the diagnosis, the repro table and the character-class analysis in #23019; the
implementation is the four-character class widening plus the two regression tests, with a
deliberately narrower set than the report proposed. The full pnpm lint / pnpm typecheck /
pnpm build matrix was not run here (no pnpm install in this environment) — the targeted vitest
suite, oxfmt and oxlint were, and CI covers the rest.

Review

Agent review of the diff:

  • Cross-platform: the regex is shared by every platform's terminal link provider and adds no
    platform branch. The characters are valid in paths on Windows, macOS and Linux. Windows drive
    letters and UNC //host/share prefixes still match the leading alternation unchanged.
  • Remote SSH: the SSH terminal reuses the same renderer link provider, so remote workspaces get
    the fix with no extra work. No path is resolved on the remote host by this change.
  • Performance: adding four literals to a character class cannot change the backtracking
    profile. terminal-links-redos.test.ts (the large-line budget test) still passes.
  • False positives: the widening is four code points that never appear as prose delimiters after
    a path. The new delimiter test pins the ASCII , / ; behaviour that \p{Po} would have
    broken. Spaced paths were never affected — their negated class already accepted these characters.
  • Security: no new I/O, no new permission, no change to resolveTerminalFileLinkTarget or the
    authorizeExternalPath gate. A longer detected range means a longer path handed to the existing
    authorization check, which is the check that already gates every opened path.
  • Agent/integration compatibility: none — the change is inside one renderer's link detector and
    touches no agent, runtime or provider code.
  • Mobile: not changed, as noted above.

Agent skill upstream boundary

  • Not applicable — no skill-installer source, tests, fixtures, registry entries, path tables,
    comments or documentation are copied or translated.

Notes

No security, backwards-compatibility, mobile or remote-SSH impact beyond what is listed above.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass — targeted vitest, oxfmt and oxlint pass locally; the full matrix is left to CI

stablyai#13399 widened the local-path trailing class to \p{L}\p{M}\p{N} plus a few
ASCII path characters, which fixed letters but left category Po out. Japanese
folder names routinely contain the katakana middle dot, so the match stopped
in front of it and the rest of the path was never clickable:

  //nas/base/会社・事業/個人事業主/確定申告/R7確定申告送信票.pdf
  -> link ended at 会社, the file part was not a link

Take the four name characters that show up in real CJK paths --
U+30FB/U+FF65 middle dots and U+301C/U+FF5E tildes -- in the class. \p{Po}
as a whole is not safe here: it reintroduces the ASCII delimiters the spaced
detectors trim on, and the fullwidth forms of comma/period are sentence
punctuation that would swallow the prose printed after a path.

Refs stablyai#23019
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: fef5afb0-9db9-4ad9-abd5-1a6bad505259

📥 Commits

Reviewing files that changed from the base of the PR and between d4cb008 and 794aaf8.

📒 Files selected for processing (1)
  • src/renderer/src/lib/terminal-links.ts

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


📝 Walkthrough

Walkthrough

The terminal path regex now permits kana middle dots within paths and requires a valid character at the start of a relative path. The matcher trims Japanese wave dashes and following text from the final path segment. Tests cover punctuation retention, delimiters, and bullet-prefixed absolute paths.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 794aa

This change retains CJK punctuation in paths while trimming range-style wave-dash suffixes from final segments. The committed test expectations match that behavior, and no concrete merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to d4cb0

More CJK paths can be opened from terminal output after a user activates a link. The change does not appear to bypass the existing file-opening checks, but the full authorization behavior was not verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Terminal output can supply newly complete clickable paths, including local or network-style paths. The observed effect requires activation rather than execution on display.

Trust Boundaries and Controls

  • observed — The existing open route calls external-path authorization for applicable local paths before checking the target; remote paths use a separate runtime route. The underlying authorization policy was not verified.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: preserving CJK name punctuation in terminal file links.
Description check ✅ Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, testing, cross-platform considerations, security, and scope. It a…
Linked Issues check ✅ Passed The changes satisfy the coding requirements in [#23019]. LOCAL_PATH_REGEX accepts U+30FB and U+FF65 in path segments, including a relative first directory. The first relative segment still requires …
Out of Scope Changes check ✅ Passed The changes stay within [#23019]. The wave-dash handling preserves dashes in directory names and trims range prose from final path segments. The related tests and the relative-prefix guard support ter…
  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 532b638a-b7f4-4fce-80b9-3303c92fbbbd

📥 Commits

Reviewing files that changed from the base of the PR and between 15baf86 and 88c847a.

📒 Files selected for processing (2)
  • src/renderer/src/lib/terminal-links.test.ts
  • src/renderer/src/lib/terminal-links.ts

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

Comment thread src/renderer/src/lib/terminal-links.ts Resolved

@pullfrog pullfrog 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.

ℹ️ No critical issues — one behavioral regression worth a look.

Reviewed changes

  • Widened LOCAL_PATH_REGEX's trailing class in src/renderer/src/lib/terminal-links.ts to accept \u30FB/\uFF65 (kana middle dots) and \u301C/\uFF5E (wave dash / fullwidth tilde), so CJK folder names stay inside a detected path.
  • Added two regression tests covering the reported UNC and drive-letter paths, plus the existing ASCII-delimiter stop behavior.

ℹ️ Nitpicks

  • Only \u30FB is exercised by the new tests; \uFF65, \u301C, and \uFF5E have no regression guard, so a typo in any of the three would pass CI. Worth a case per added code point if the tildes stay.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/renderer/src/lib/terminal-links.ts Resolved
…ots in relative prefix

- 〜/~ are Japanese range punctuation, so a path followed by a
  range expression (`/var/log/app.log〜古いものは削除`) absorbed the prose
  and the link stopped resolving. Keep only the kana middle dots.
- Accept the middle dots in the relative first-directory prefix too, so
  `会社・事業/file.txt` is linked whole instead of from `事業/`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Yi-111-a

Copy link
Copy Markdown
Contributor Author

Thanks @pullfrog and CodeRabbit. You're right, the wave dash and fullwidth tilde are range punctuation, not name punctuation. Fixed in c07aa5b:

  • Dropped 〜/~ from the class, so only the kana middle dots ・/・ are added. Your probe ログ: /var/log/app.log〜古いものは削除 is now pinned by a test (it links /var/log/app.log), and the same goes for the fullwidth tilde.
  • Also added the middle dots to the relative first-directory prefix, so 会社・事業/file.txt links whole instead of starting at 事業/. That case has a test too.

src/renderer/src/lib tests: 5955 passed.

@pullfrog pullfrog 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.

ℹ️ No critical issues — the round-two commit resolves the earlier regression cleanly; one leading-class edge is worth a look inline.

Reviewed changes

  • Dropped \u301C/\uFF5E (wave dash / fullwidth tilde) from LOCAL_PATH_REGEX's trailing class — they are Japanese range punctuation, so a path followed by a range now stops at the path instead of absorbing the prose, and a test pins that.
  • Widened the leading alternation with \u30FB/\uFF65 (kana middle dots) so a relative path whose first directory contains a middle dot (会社・事業/file.txt) is claimed whole rather than starting at 事業/, with a regression test.
  • Kept the ASCII delimiter behavior covered by the existing stop-at-,/; test.

ℹ️ Nitpicks

  • \uFF65 (halfwidth kana middle dot) still has no dedicated test in the leading or trailing class.
  • The PR description says the leading alternation is untouched and only four trailing-class code points were added; commit c07aa5b changed both. Worth updating so reviewers see the current trade-off.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/renderer/src/lib/terminal-links.ts Resolved

@pullfrog pullfrog 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.

ℹ️ The delta resolves the earlier wave-dash regression cleanly; one leading-class edge remains open, so this review does not approve.

Reviewed changes

This run re-reviewed only the delta since the prior pullfrog review (88c847a5 → c07aa5b4), on top of the original widening.

  • Dropped the wave dashes from the path class. \u301C/\uFF5E are range punctuation in Japanese, so a path followed by a range expression (/var/log/app.log〜古いものは削除) no longer absorbs the following prose. Both forms now stop at the path, pinned by a new test that fails on the previous class.
  • Added the kana middle dots to the relative first-directory class. 会社・事業/file.txt now links whole instead of starting at 事業/; the new test fails on the prior class.
  • Updated the class comment to record why \p{Po} and the wave dashes stay out.

ℹ️ Leading middle dot is claimed as a path prefix

The leading-class widening also lets a bare ・/・ start a relative segment: ・/tmp/foo.txt now matches as ・/tmp/foo.txt instead of the absolute /tmp/foo.txt, so it resolves against the cwd and fails where it previously opened. The open inline thread at src/renderer/src/lib/terminal-links.ts:44 carries the repro and a suggested fix; I reproduced both sides independently and confirmed the proposed [\p{L}\p{N}\p{M}._-][\p{L}\p{N}\p{M}._\-\u30FB\uFF65]*[\\/] keeps 会社・事業/file.txt whole while restoring /tmp/foo.txt.

Technical details
# Leading middle dot absorbed as a relative-path prefix

## Affected sites
- `src/renderer/src/lib/terminal-links.ts:44` — `[\p{L}\p{N}\p{M}._\-\u30FB\uFF65]+[\\/]` added to the leading alternation.

## Evidence
- On `・/tmp/foo.txt`: old class matches `/tmp/foo.txt`; new class matches `・/tmp/foo.txt`.
- On `・/tmp/foo.txt ・/tmp/bar.txt`: new class matches both bullet-prefixed spans as relative paths.
- The proposed first-char guard matches `/tmp/foo.txt` and `/tmp/bar.txt` and still matches `会社・事業/file.txt` whole.

## Required outcome
- A path preceded by a bare `・`/`・` links the absolute path, while `会社・事業/file.txt` stays whole.

## Suggested approach
- Require a non-middle-dot first segment character: `[\p{L}\p{N}\p{M}._-][\p{L}\p{N}\p{M}._\-\u30FB\uFF65]*[\\/]`, plus a bullet-prefixed case in the regression tests.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

A bare bullet such as `・/tmp/foo.txt` began a relative segment and was
linked as one path. Require one letter/number/mark/._- before the
middle-dot run in the relative prefix, and pin the bullet case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Yi-111-a

Copy link
Copy Markdown
Contributor Author

Good catch, @pullfrog. Fixed in the latest commit. The relative prefix now needs a name character before the middle-dot run ([\p{L}\p{N}\p{M}._-][…\u30FB\uFF65]*[\/]). So ・/tmp/foo.txt and ・/tmp/foo.txt link /tmp/foo.txt, while 会社・事業/file.txt stays whole. The bullet case is now a test, and it fails on the previous regex. src/renderer/src/lib: 5956 passed.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

This run re-reviewed the delta since the prior Pullfrog review (c07aa5b4 → 60be095), on top of the kana middle-dot widening.

  • Require a name character before a leading middle dot. The relative prefix now starts with one \p{L}\p{N}\p{M}._- before the middle-dot run, so a bare bullet ・/tmp/foo.txt links the absolute /tmp/foo.txt instead of absorbing the dot and resolving against the cwd, while 会社・事業/file.txt still links whole. Independently reproduced both forms against the old and new classes.
  • Pinned the bullet case. A new test asserts ・/tmp/foo.txt and ・/tmp/foo.txt link /tmp/foo.txt; it matches the old class as one link, so it would fail on the prior regex.
  • The earlier wave-dash regression stays fixed and covered — the tildes remain outside the class.

The one collateral change is ・会社/file.txt (a bullet as the first character of the first segment) now linking 会社/file.txt rather than the bullet-prefixed span. That is the documented trade-off the leading class comment records, and a bullet-first directory is far rarer than a bullet-prefixed list item, so I consider it the right call.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

This run re-reviewed only the delta since the prior pullfrog review (c07aa5b4 → 60be095), on top of the earlier widening.

  • Required a name character before a leading middle dot. The leading alternation changed from [\p{L}\p{N}\p{M}._\-\u30FB\uFF65]+[\\/] to [\p{L}\p{N}\p{M}._-][\p{L}\p{N}\p{M}._\-\u30FB\uFF65]*[\\/], so ・/tmp/foo.txt links the absolute /tmp/foo.txt instead of absorbing the bullet as a relative prefix.
  • Added the regression test for it. A new case covers both ・ and ・ (the latter finally exercises \uFF65), and 会社・事業/file.txt still matches whole.
  • Extended the class comment to record the first-character rule.

Verified independently: the head regex returns /tmp/foo.txt for ・/tmp/foo.txt and ・/tmp/foo.txt, keeps 会社・事業/file.txt, C:/tmp/中黒・テスト/a.txt and the UNC path whole, and still stops /var/log/app.log〜古いものは削除 at the path. terminal-links.test.ts passes 57/57 at head; the new bullet assertion fails against the c07aa5b4 class, so it is a real guard.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Keep kana middle dots in CJK path names, including the first relative segment, and keep wave dashes out so a range marker after a path is not part of the link. stablyai#23322 added the dashes to the continuation class; the tests on this branch still stop at them.
@Yi-111-a

Copy link
Copy Markdown
Contributor Author

Merged current main. The only overlap was LOCAL_PATH_REGEX: #23322 keeps the wave dashes in the continuation class, and this branch still stops at them, so /var/log/app.log〜古いものは削除 links only the path. Middle dots stay in the name, including the first relative segment, and a bullet ・/tmp/foo.txt still links /tmp/foo.txt. I checked those regex cases locally; the renderer suite is not runnable from the partial checkout I used to resolve this.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 3/5

[Medium risk] Fixes terminal file link detection for CJK punctuation.

The PR is not safe to merge while wave-dash filenames remain truncated and wave-dash-separated paths become one invalid link.

Findings

  1. P1 Wave dash merges separate paths ▶
  2. P1 Wave dashes truncate file links ▶

Summary

The PR extends desktop terminal path detection to CJK middle dots and wave dashes, adds final-segment wave-dash trimming, and adds path-detection tests. The new trimming preserves the tested prose case but merges two paths separated by a wave dash into one link.

Reviews (2) · Last reviewed commit: "fix(terminal): keep a directory wave das..."

Comment thread src/renderer/src/lib/terminal-links.ts Outdated
// as `・/tmp/foo.txt` links the absolute path rather than absorbing the dot.
const LOCAL_PATH_REGEX =
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[\p{L}\p{N}\p{M}._-]+[\\/])[\p{L}\p{N}\p{M}._~\-/%+@\\()[\]\u30FB\uFF65\u301C\uFF5E]*(?::\d+)?(?::\d+)?/gu
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[\p{L}\p{N}\p{M}._-][\p{L}\p{N}\p{M}._\-\u30FB\uFF65]*[\\/])[\p{L}\p{N}\p{M}._~\-/%+@\\()[\]\u30FB\uFF65]*(?::\d+)?(?::\d+)?/gu

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Wave dashes truncate file links When a filename contains 〜 or ~, the detector now stops at that character. For example, /tmp/請求〜控え.pdf becomes a link to /tmp/請求, so clicking it cannot open the printed file. The new test checks a wave dash used in prose, but not one inside a filename.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 645d2ba5-8915-44df-9756-455e1467c7e9

📥 Commits

Reviewing files that changed from the base of the PR and between 60be095 and d4cb008.

📒 Files selected for processing (1)
  • src/renderer/src/lib/terminal-links.ts

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

Comment thread src/renderer/src/lib/terminal-links.ts Outdated
// as `・/tmp/foo.txt` links the absolute path rather than absorbing the dot.
const LOCAL_PATH_REGEX =
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[\p{L}\p{N}\p{M}._-]+[\\/])[\p{L}\p{N}\p{M}._~\-/%+@\\()[\]\u30FB\uFF65\u301C\uFF5E]*(?::\d+)?(?::\d+)?/gu
/(?:~[\\/]|[\\/]|\.{1,2}[\\/]|[A-Za-z]:[\\/]|[\p{L}\p{N}\p{M}._-][\p{L}\p{N}\p{M}._\-\u30FB\uFF65]*[\\/])[\p{L}\p{N}\p{M}._~\-/%+@\\()[\]\u30FB\uFF65]*(?::\d+)?(?::\d+)?/gu

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,110p' src/renderer/src/lib/terminal-links-cjk.test.ts
sed -n '28,55p' src/renderer/src/lib/terminal-links.ts
sed -n '115,190p' src/renderer/src/lib/terminal-links.test.ts
rg -n 'terminal-links-cjk|terminal-links.test|vitest' package.json src/renderer/package.json vitest.config.* src/renderer/vitest.config.* 2>/dev/null

Repository: stablyai/orca

Length of output: 7373


🏁 Script executed:

#!/bin/bash
set -u

echo '--- focused diff against merge base ---'
git diff --stat a5c7dd9671e9f3675ac36c2e99f1c5cecddda853 d4cb008e1dbae93dcd6fe30178bfec5068f40ce8 -- src/renderer/src/lib/terminal-links.ts src/renderer/src/lib/terminal-links.test.ts src/renderer/src/lib/terminal-links-cjk.test.ts
git diff --unified=35 a5c7dd9671e9f3675ac36c2e99f1c5cecddda853 d4cb008e1dbae93dcd6fe30178bfec5068f40ce8 -- src/renderer/src/lib/terminal-links.ts src/renderer/src/lib/terminal-links.test.ts src/renderer/src/lib/terminal-links-cjk.test.ts

echo '--- test configuration and scripts ---'
sed -n '1,80p' package.json
fd -i 'vitest.*config.*|package.json' . | head -40
for f in config/vitest.config.ts src/renderer/vitest.config.ts vitest.config.ts; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    sed -n '1,180p' "$f"
  fi
done

echo '--- concise history for focused files ---'
git log --oneline -15 -- src/renderer/src/lib/terminal-links.ts src/renderer/src/lib/terminal-links.test.ts src/renderer/src/lib/terminal-links-cjk.test.ts

Repository: stablyai/orca

Length of output: 21032


🏁 Script executed:

#!/bin/bash
set -u

echo '--- unit test inclusion ---'
sed -n '1,220p' config/scripts/ci-unit-files.mjs
rg -n 'terminal-links-cjk|detectTerminalFileLinkRanges|LOCAL_PATH_REGEX|SPACED_LOCAL_PATH_REGEXES|extractTerminalFileLinks|mergeTerminalFileLinkRanges' src/renderer/src/lib config/scripts/ci-unit-files.mjs

echo '--- extraction pipeline ---'
sed -n '80,330p' src/renderer/src/lib/terminal-links.ts
sed -n '1,260p' src/renderer/src/lib/terminal-file-link-detection-ranges.ts

echo '--- relevant history ---'
git show --stat --oneline c07aa5b4f10
git show --format=fuller --no-ext-diff --unified=18 c07aa5b4f10 -- src/renderer/src/lib/terminal-links.ts src/renderer/src/lib/terminal-links.test.ts src/renderer/src/lib/terminal-links-cjk.test.ts

Repository: stablyai/orca

Length of output: 28319


🏁 Script executed:

#!/bin/bash
set -u

echo '--- URI detector and explicit target parsing ---'
sed -n '1,260p' src/renderer/src/lib/terminal-file-uri-link.ts
sed -n '1,300p' src/renderer/src/lib/explicit-file-link-target.ts

echo '--- focused CJK test with line numbers ---'
sed -n '1,70p' src/renderer/src/lib/terminal-links-cjk.test.ts | cat -n

Repository: stablyai/orca

Length of output: 7386


🏁 Script executed:

#!/bin/bash
set -u
sed -n '1,240p' src/shared/terminal-file-url-target.ts
rg -n 'function parseFileLinkLocation|export function parseFileLinkLocation|parseFileLinkLocation' src/shared
sed -n '1,220p' src/shared/file-link-location.ts

Repository: stablyai/orca

Length of output: 3729


Split the local-path and URI wave-dash cases in terminal-links-cjk.test.ts.

The local path assertions for U+301C and U+FF5E conflict with the intended matcher contract and can fail in the supported Vitest workflow. Keep the local-path delimiter behavior. Keep URI coverage in separate tests because file URIs use a different detector.

Suggested test correction
-  for (const character of ['・', '・', '〜', '~']) {
+  for (const character of ['・', '・']) {
...
-    it(`keeps URI handling separate for ${character}`, () => {
-      expect(extractTerminalFileLinks(`https://example.com/前${character}後/a.txt`)).toEqual([])
-      expect(extractTerminalFileLinks(`file:///tmp/前${character}後/a.txt`)[0]?.pathText).toBe(
-        `/tmp/前${character}後/a.txt`
-      )
-    })
   }
+
+  for (const character of ['・', '・', '〜', '~']) {
+    it(`keeps URI handling separate for ${character}`, () => {
+      expect(extractTerminalFileLinks(`https://example.com/前${character}後/a.txt`)).toEqual([])
+      expect(extractTerminalFileLinks(`file:///tmp/前${character}後/a.txt`)[0]?.pathText).toBe(
+        `/tmp/前${character}後/a.txt`
+      )
+    })
+  }

@pullfrog pullfrog 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.

Important

Merging main pulled #23322's terminal-links-cjk.test.ts into this branch, and this PR's regex now fails it — the branch is not mergeable until the wave-dash expectations are reconciled.

Reviewed changes

This run re-reviewed only the delta since the prior Pullfrog review (60be095 → d4cb008).

  • Merged main into the branch. main had already landed #23322 — the same middle-dot widening plus \u301C/\uFF5E in the continuation class, with its own src/renderer/src/lib/terminal-links-cjk.test.ts. The merge kept this branch's narrower regex (no wave dashes), so the branch tree now carries a test that contradicts it.
  • Added a comment recording the #23322 decision. Two comment lines now state that #23322 added the wave dashes to the continuation class and this branch keeps them out.

⚠️ This branch reverts part of a merged PR and carries its failing test

#23322 is already on main: it added \u301C/\uFF5E to the path class and a test asserting both wave dashes are retained. The merge brought that test into this branch unchanged, so the branch fails terminal-links-cjk.test.ts even though the diff here does not touch that file. This is not a line-level nit — the two test files encode opposite expectations, and only the author can decide whether wave dashes belong in the class (keep #23322) or out (update/trim #23322's test and accept that this PR supersedes it). The concrete repro is in the inline comment on the class.

Technical details
# Branch regex conflicts with #23322's merged test

## Affected sites
- `src/renderer/src/lib/terminal-links.ts:48` — trailing class omits `\u301C`/`\uFF5E`, reverting part of `#23322`.
- `src/renderer/src/lib/terminal-links-cjk.test.ts:5` — iterates `['・','・','〜','~']` and expects each retained; brought in by the merge from `main`.
- `src/renderer/src/lib/terminal-links.test.ts:162` — this branch's own test expects `\u301C`/`\uFF5E` to stop the path, the inverse expectation.

## Evidence
- At head `d4cb008`, `pnpm test src/renderer/src/lib/terminal-links-cjk.test.ts` fails: 28 assertions across the `〜` and `~` groups (path splits into `['/tmp/前','後/a.txt']`, `resolveTerminalFileLinkText` returns `null`, the URI case yields `後/a.txt`).
- `git show origin/main:src/renderer/src/lib/terminal-links.ts` still contains `[\u30FB\uFF65\u301C\uFF5E]`; `#23322` merged `2026-09-26`.

## Required outcome
- The branch's test suite passes: wave dashes either retained (align with `#23322`) or their `#23322` test cases removed/updated alongside a documented decision to supersede `#23322`.

## Open questions for the human
- Is this PR intended to supersede `#23322`, or should it fold into the already-merged behavior? If superseding, `terminal-links-cjk.test.ts` must drop the `〜`/`~` expectations.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/renderer/src/lib/terminal-links.ts Resolved
stablyai#23322 expects a wave dash inside a directory name. A dash in the final segment is still range prose, so the link stops there.
@Yi-111-a

Copy link
Copy Markdown
Contributor Author

Directory names keep their wave dash, which is what terminal-links-cjk.test.ts from #23322 checks. A dash in the final segment is still trimmed, so /var/log/app.log〜古いものは削除 stops at app.log. Both sets of cases pass locally.

Comment on lines +186 to +189
const lastSeparator = Math.max(range.text.lastIndexOf('/'), range.text.lastIndexOf('\\'))
const dashAt = range.text.slice(lastSeparator + 1).search(/[\u301C\uFF5E]/)
if (dashAt < 0) {
return range

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Wave dash merges separate paths When terminal output shows two paths separated by a wave dash, such as /tmp/a.txt〜/tmp/b.txt, the widened regex matches them as one range. This trim checks only after the last slash, so it leaves one link to the nonexistent combined path instead of linking the two printed paths.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

This run re-reviewed only the delta since the prior Pullfrog review (d4cb008 → 794aaf82), on top of the CJK widening.

  • Put the wave dashes back in the continuation class. \u301C/\uFF5E are accepted again, so a directory name like 前〜後 links whole and terminal-links-cjk.test.ts (from #23322 on main) passes — resolving the prior blocker.
  • Added trimFinalSegmentWaveDash. A wave dash in the final path segment still ends the link (/var/log/app.log from app.log〜古い), so the branch's own range-prose test keeps passing while a dash in an earlier directory stays inside the path.
  • Rewrote the class comment to record the directory-vs-final-segment distinction.

Verified at head: terminal-links-cjk.test.ts 60/60 and terminal-links.test.ts 57/57 (117 total, the #23322 conflict is gone). Probed independently: /tmp/前〜後/a.txt links whole, /var/log/app.log〜古いものは削除 stops at the path, and /tmp/a〜b〜c/d.txt and /tmp/foo〜/bar.txt link whole. The final-segment trim is deliberately permissive — a real filename like /tmp/app〜old.log now links only /tmp/app — but that is exactly the trade-off the new comment documents.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@szsip239

szsip239 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Related pre-existing hard-wrap coverage gap, not a regression introduced by this PR: #14291 (comment).

On Orca 1.4.218/macOS, a valid CJK/parentheses local file link printed by Codex CLI becomes unclickable when the TUI inserts a newline inside the path. Replaying the same text with no Codex process, using the real pinned xterm buffer and unmodified Orca detector, gives:

Fixture Single row Explicit hard wrap
ASCII pass pass
CJK directory pass fail
CJK filename pass fail
Filename parentheses pass fail

The standalone Python fixture and scope of the GUI/parser evidence are in the linked comment. Ordinary LOCAL_PATH_REGEX detection succeeds for these targets; hard-wrapped-terminal-path-fragments.ts rejects them before a complete candidate reaches detection/existence checks. That module is outside this PR's changed-file list and remained byte-identical between v1.4.218 and current main when checked today (2026-10-02).

I have not run this PR's full branch, so this is not a claimed branch-test failure or a reason to block the narrower punctuation fix. It identifies a complementary hard-wrap regression to cover separately: the complete path and xterm cell range should be identical when hovering/clicking either row, without merging adjacent prose or sibling links.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Terminal link regex still cuts CJK paths at Unicode punctuation such as KATAKANA MIDDLE DOT (U+30FB) after #13399

3 participants