Skip to content

test(native-chat): keep #26586's path-link cases as regression tests - #26819

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/chat-link-cases-from-26586
Oct 11, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/chat-link-cases-from-26586

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​170 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​170
Prod 0 0 0 0

ELI5

Chat used to underline things that only looked like files (slash commands such as /code-review, web routes such as /api/v1, version numbers such as HTTP/1.1, web addresses missing their https://). Clicking one showed "File not found."
#26675 (merged) fixed the cause: chat now asks the workspace's machine whether a path exists before underlining it, the same way the terminal does.
Kelvin's #26586 attacked the same bug with chat-only text rules. This PR keeps his examples as regression tests against the merged check and adds no new rules. It is a tests-only PR.

What Changed

The problem it guards against. A chat reply mentioning /code-review, /api/v1, HTTP/1.1, z-ai/glm-5.3, example.com/docs/guide.html or git log origin/main..HEAD got an underline that led to "File not found." On main these already stay plain, because none of them exists on the host. Nothing tested that with Kelvin's examples until now.

What is different for you: nothing. No product code changes. Chat and terminal behave exactly as on main.

What the tests pin down, in rendered chat markdown and in the terminal's own link detection (a mocked host answers which paths exist):

  • Slash commands, routes, versions, model names, scheme-less web addresses and a git command stay plain when they don't exist.
  • Real paths keep their links: dotted folders (conf.d/nginx.conf, v1.2/notes.md), numeric extensions (man/ls.1, lib/libfoo.so.1, docs/archive.7z), absolute paths under any root (/etc/hosts, /data/raw, /mnt/c/Users/me/notes.md), spaced paths (~/Library/Application Support/…, C:\My Folder\notes.txt:12:3, My Folder/notes.md) and file:// links (including file:///tmp/Makefile and %20-encoded names with #L4).
  • If text shaped like a command or web address really is a path on the host (/code-review, example.com/docs/guide.html inside the workspace), it links in both chat and terminal.
  • The terminal still links docs/Makefile and .github/CODEOWNERS and leaves BUILD SUCCESSFUL alone.

Each #26586 case, decided against main

#26586 case or rule Decision Why
/code-review, /clear and /compact, /orca-native-chat:orca-chat-visuals Already handled by the existence check; test added No such path on the host, so no underline. A real /code-review path would still link, as in the terminal.
/api/v1 Already handled; test added Same: missing means plain.
HTTP/1.1, 1.5/2.0, z-ai/glm-5.3 Already handled; test added Missing means plain, so no version rule is needed.
git log origin/main..HEAD in inline code Already handled; test added Not a path on the host.
example.com/docs/guide.html, 127.0.0.1/api/data.json Already handled; test added They resolve inside the workspace, where no such folder exists. A real example.com/ folder still links, which a list of web-address endings would get wrong.
conf.d/nginx.conf, v1.2/notes.md, docs/archive.7z, man/ls.1, lib/libfoo.so.1 Already handled; test added Confirmed paths keep their link.
/etc/hosts, /usr/local/bin, /data/out.json, /data/raw, /mnt/c/…, /Users/…/main.ts:12 Already handled; test added Existing absolute paths link under any root, including roots #26586's list left out (/data), which matters on SSH hosts and containers.
~/Library/Application Support/…, C:\My Folder\notes.txt:12:3 Already handled; test added Spaced paths from a root link when they exist.
file:// links, including extensionless names, %20 and #L4 Already handled; test added They decode to a rooted path and go through the same check. Missing ones stay plain.
Bare /tmp never links Dropped /tmp exists on every Mac and Linux host, so chat links it, as the terminal does. Text alone can't tell a slash command from a real top-level folder; the host can.
Stop linking unrooted spaced paths (My Folder/notes.md, "Brennan's Folder/notes.md") Dropped With the check, these link only when the file is really there, and quotes or inline code mark where the path ends. main already tests this; Kelvin's examples are added.
docs/Makefile, .github/CODEOWNERS linking in chat Not in this PR Chat still needs an extension, a root or a line number before it asks about a relative path. Extensionless names have the same shape as folders (src/components), and #26675 split folders and bare names into a later PR. The terminal already links them, which a test here now covers.
Grow the extensionless filename list from 11 to 26 (Brewfile, Justfile, …), shared with the terminal Dropped The list only matters for bare words like Justfile, and every new name is one more existence check on each terminal hover, including over SSH. Paths with a folder (docs/Makefile) don't use the list. It belongs with the bare-names PR.
Chat-only root list, version rule and web-address rule (lib/hostname-segment.ts) Dropped The existence check replaces them. Measured as a pre-filter, they save nothing worth a second rule set: each chat render sends all its candidates to the host as one batched request (up to 128 paths) and caches the answers per chat. A few command-shaped words add a few stat calls inside a request already being sent, not another SSH round trip.

Why

#26675 fixed the cause. A path is underlined only when the machine that owns the workspace says it exists, and chat and terminal share that step. Re-adding shape rules on top would make chat and terminal disagree again. It would also wrongly hide real paths that happen to look like a command or web address.
Kelvin's examples are still the best list of what used to go wrong, so they live on as regression tests on both surfaces.
This replaces draft #26697, which carried the same tests while #26675 was still open. This one is based on main.
Kelvin Amoaba (@AmoabaKelvin) wrote the original cases in #26586 and is credited with a Co-authored-by: trailer on the commit.

Linked Issue

Refs STA-9683. Follows #26675 and carries over the cases from #26586.

Visual Proof

N/A: tests only. Nothing changes on screen.

Testing

  • tsc for the renderer project (config/tsconfig.tc.web.json): passes.

  • 18 explicit suites pass with --maxWorkers=2: the two new files plus terminal link detection, batching, click fallback, file-link target, file://, CJK and regex-safety suites, CommentMarkdown link suites, and the native-chat file-link existence, click and paced-markdown suites.

  • orca-ci-checks --no-typecheck passes locally.

  • Not run by hand: no app launch, since nothing on screen changes. The SSH, WSL and Windows existence paths come from fix(native-chat): underline a file path only once its workspace confirms it exists #26675; these tests mock the host's answer.

  • I manually tested these changes locally

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

Review

Tests only; reviewed against #26675's merged behaviour and #26586's diff.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH and remote: no new existence checks. The dropped filename-list growth would have added them.
  • Cross-platform: the cases include Windows drive paths and WSL /mnt/c/… paths; behaviour comes from the shared resolver.
  • Performance: unchanged; see the pre-filter row 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 (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author: Brennan Benson (@BrennanKB5)

Command-, route-, version- and host-shaped text stays plain unless the
host confirms the path, in chat and terminal alike, since #26675.

Co-authored-by: Kelvin Amoaba <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: dd7021b7-2da5-4a3b-ac10-92ab27b8419f

📥 Commits

Reviewing files that changed from the base of the PR and between 39a01f9 and 2f3f4a2.


📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/CommentMarkdown.file-link-cases.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-link-provider-chat-cases.test.ts

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



📝 Walkthrough

Walkthrough

Added regression tests for file links in terminal text and rendered comments. Terminal tests cover command-like text, URLs, versions, file paths, and file:// paths with mocked path-existence results. Comment tests check rendered anchor text and verify that each anchor routes as a file.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2f3f4

The added file-link regression tests present no identified merge-blocking risk; normal checks remain appropriate.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the change as regression tests for the native chat path-link cases. It is concise and directly matches the test-only changes.
Description check Passed The description is complete and directly addresses the required sections. It explains the user impact, changes, rationale, linked issue, testing, cross-platform considerations, and why visual proof is…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@brennanb2025
brennanb2025 merged commit 79a5973 into main Oct 11, 2026
30 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/chat-link-cases-from-26586 branch October 12, 2026 00:21
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.

1 participant