Skip to content

fix(session-ui): don't treat bare word/word inline code as file path - #51722

Open
rubencu wants to merge 1 commit into
anomalyco:devfrom
rubencu:fix/inline-code-slash-path-false-positive
Open

rubencu wants to merge 1 commit into
anomalyco:devfrom
rubencu:fix/inline-code-slash-path-false-positive

Conversation

@rubencu

@rubencu rubencu commented Sep 27, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #51723

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

inlineCodeKind treated any slash-containing inline code as a file path, so prose shorthand like write/edit rendered as a clickable file link that fails with 'File not found' on click. Slash tokens now need an explicit path signal (./, ~/, absolute, drive-letter, @scope/, trailing separator, depth > 2, or file-ish characters in a two-segment pair) to count as paths.

Examples (before -> after):

inline code before after
write/edit, and/or, input/output, TCP/UDP, 24/7 path (click -> 'File not found' toast) plain code
session/status path plain code
packages/desktop-electron, release/v1.2.3 path path (unchanged)
packages/app/src, ./scripts/setup, ~/x, C:\Users\x path path (unchanged)
app.tsx, SKILL.md, Dockerfile path path (unchanged)

Known trade-off: plain two-segment dirs like src/components also stop linking (structurally identical to prose shorthand, can't have both with a regex). Verified the change is strictly un-linking: across a 94-token corpus, every behavior delta is path -> plain, zero new links created.

How did you verify your code works?

Ran the real suite with bun in packages/session-ui: 4 pass, 0 fail (43 expects). Also ran an old-vs-new differential of the actual functions over 104 tokens (paths, prose, URLs, edge cases): 43 deltas, all strictly path -> plain, zero new links created.

Screenshots / recordings

N/A — classification-only change; the bug repro is in #51723.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

`write/edit`, `and/or` and similar prose shorthand were classified as
paths by inlineCodeKind, rendering them as clickable file links that fail
with 'File not found' on click. Only treat slash tokens as paths with
explicit signals: ./, ~/, absolute, drive-letter, @scope/, trailing
separator, depth > 2, or file-ish characters in a two-segment pair.
@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@kvnloo

kvnloo commented Sep 28, 2026

Copy link
Copy Markdown

Bare word/word inline code such as write/edit is treated as a file path.

Head 6e8bb8220f8c817ad32f63eed8d6460874f7b99a is unchanged from the tested tip.

Fork leaf kvnloo#195 recorded fail→pass on packages/session-ui/src/components/markdown-inline-code-kind.test.ts (4 pass, 1 fail with the assertion removed, 4 pass after restore).

That locks the bare word/word case. It does not reclassify real paths.

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.

Inline code with a slash (e.g. write/edit) is treated as a clickable file path

2 participants