Skip to content

fix(app): verify inline Markdown paths before linking - #2989

Open
smsunarto wants to merge 1 commit into
get-bb:mainfrom
smsunarto:scott/prevent-missing-file-tabs
Open

fix(app): verify inline Markdown paths before linking#2989
smsunarto wants to merge 1 commit into
get-bb:mainfrom
smsunarto:scott/prevent-missing-file-tabs

Conversation

@smsunarto

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Inline code spans that looked like Markdown file paths (for example docs/notes.md) were turned into local-file links purely from their shape. Clicking one for a file that does not exist on the host opened an empty file tab. The renderer had no way to check the path because it did not know which host the thread ran on.

What changed

  • markdown-link-routing.ts: MarkdownLocalFileLinkRouting gains an optional inlineCodeFileLinks.hostId that says which host to check paths against.
  • markdown-preview.tsx: resolveInlineCodeMarkdownFileHref becomes resolveInlineCodeMarkdownFileLink and returns the resolved absolute path alongside the href. A new MarkdownInlineCodeFileLink component calls useHostPathExistence for that path and only renders the anchor when the host reports the file exists. Without a host id the span stays plain code.
  • Thread timeline (ThreadTimelineSurfaceThreadTimelineRowsConversationMessageContent) and ThreadDetailView thread the environment's hostId into the routing so assistant messages and file previews get the existence check.

No wire changes.

How you verified

  • Added links only inline-code Markdown file paths that exist in apps/app/src/components/ui/markdown-preview.test.tsx. It renders two inline-code paths, one present and one missing on the host, and asserts only the present one becomes a link. Fails before, passes after.
  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run test --filter=@bb/app

AGENT GENERATED

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