fix(app): verify inline Markdown paths before linking - #2989
Open
smsunarto wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:MarkdownLocalFileLinkRoutinggains an optionalinlineCodeFileLinks.hostIdthat says which host to check paths against.markdown-preview.tsx:resolveInlineCodeMarkdownFileHrefbecomesresolveInlineCodeMarkdownFileLinkand returns the resolved absolute path alongside the href. A newMarkdownInlineCodeFileLinkcomponent callsuseHostPathExistencefor that path and only renders the anchor when the host reports the file exists. Without a host id the span stays plain code.ThreadTimelineSurface→ThreadTimelineRows→ConversationMessageContent) andThreadDetailViewthread the environment'shostIdinto the routing so assistant messages and file previews get the existence check.No wire changes.
How you verified
links only inline-code Markdown file paths that existinapps/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/apppnpm exec turbo run test --filter=@bb/app