refactor(web): chat markdown links and file chips live in their own modules#22693
ChatMarkdown.tsx was a 3,560-line file that held every markdown renderer. This stack splits it into focused modules so each piece is readable on its own.
The file-link chip moves to chat/MarkdownFileLink.tsx, and its pure action helpers to MarkdownFileLink.logic.ts. External-link favicons and URL wrapping move to chat/MarkdownExternalLink.tsx. Same-document fragment clicks and heading ids move to chat/markdownFragments.ts, and the hast text helpers to chat/markdownHast.logic.ts.
This is a pure move. Each renderer was already its own component, so no render boundary changes. Behavior is unchanged.
| Before | After | |
|---|---|---|
ChatMarkdown.tsx lines | 2776 | 2068 |
| New files | chat/MarkdownFileLink.tsx (411), MarkdownFileLink.logic.ts (62), MarkdownExternalLink.tsx (110), markdownFragments.ts (113), markdownHast.logic.ts (42) | |
| Renders | unchanged: no component, subscription or context boundary moved | unchanged |
Renders were not measured for this layer. It changes no render boundaries: the components, their props, and the two contexts stay exactly as they were.
Tests run:
vp test run --project browser src/components/ChatMarkdown.browser.test.tsx src/components/ChatMarkdown.permissions.browser.test.tsx(11 passed)vp test run --project unit src/reactCompilerCoverage.test.tsfor every touched file (0 bailouts)tsc --noEmitfor apps/web, andvp linton changed files
🤖 Generated with Claude Code
Checks
- SuccessfulCodeRabbitGitHub
Review completed
- Skipped
- Skipped
- Skipped
- SuccessfulRemove preview downloadGitHub
- SuccessfulCheckGitHub
- SkippedRustGitHub
- Skipped
- SkippedRelease SmokeGitHub
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest WebGitHub
- SuccessfulTestGitHub
- SuccessfulLabel PR 22693GitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulChangesGitHub
- SuccessfulLintGitHub
- SuccessfulNative fingerprint diffGitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulCheckGitHub
- SkippedRustGitHub
- SkippedRelease SmokeGitHub
- Skipped
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTestGitHub
- SuccessfulTest WebGitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulLintGitHub
- SuccessfulChangesGitHub
- SuccessfulLabel PR 22693GitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- Skipped
- CancelledLabel PR sizeGitHub
- CancelledLabel PR 22693GitHub
- CancelledRelease SmokeGitHub
- CancelledBuild and TypecheckGitHub
- CancelledRustGitHub
- Cancelled
- CancelledTestGitHub
- CancelledTest WebGitHub
- Skipped
- FailedCheckGitHub
- SuccessfulNative fingerprint diffGitHub
- SkippedDeploy web previewGitHub
- Skipped
- SkippedEAS PreviewGitHub
- SkippedDeploy web previewGitHub
- SkippedEAS PreviewGitHub
- CancelledTest Server 8GitHub
- CancelledTest Server 2GitHub
- CancelledTest Server 3GitHub
- CancelledChangesGitHub
- CancelledTest Server 7GitHub
- CancelledTest Server 5GitHub
- CancelledTest Server 6GitHub
- CancelledTest Server 1GitHub
- CancelledTest Server 4GitHub
- SuccessfulPrepare PR size configGitHub
- CancelledLintGitHub
- CancelledNative fingerprint diffGitHub
- SuccessfulCollect PR targetsGitHub
- SuccessfulCollect PR targetsGitHub
- Skipped
- SuccessfulPrepare PR size configGitHub
- Skipped
Approvability
Verdict: Approved at 717a53e
Macroscope's review found this PR approvable — This refactor moves existing markdown link, file-chip, fragment, and HAST-rendering code into focused modules without changing call sites, props, or behavior. The large diff is primarily deletion and re-addition from relocating code, with no product-default, schema, configuration-suppression, or sensitive-area changes.
No code changes detected at e113e20. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Important
Review skipped
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
cd850f14-9123-4f43-89de-f4d8f6d8ce03
📥 Commits
Reviewing files that changed from the base of the PR and between 717a53e868d8965865b6e89fc26c8a6519163f73 and e113e20a3ef097439956f98e500d23e65581c354.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
be9c83cb-aaf8-4797-8c3b-16ae81211edd
📥 Commits
Reviewing files that changed from the base of the PR and between deaa44462acc287c5960b75def7307bdc4ef3615 and 717a53e868d8965865b6e89fc26c8a6519163f73.
📒 Files selected for processing: 6
apps/web/src/components/ChatMarkdown.tsxapps/web/src/components/chat/MarkdownExternalLink.tsxapps/web/src/components/chat/MarkdownFileLink.logic.tsapps/web/src/components/chat/MarkdownFileLink.tsxapps/web/src/components/chat/markdownFragments.tsapps/web/src/components/chat/markdownHast.logic.ts
Limit details: You’ve used all 10 included reviews currently available.
📝 Walkthrough
Markdown link rendering, file actions, fragment navigation, and HAST text utilities now reside in dedicated modules.
ChatMarkdown.tsximports these modules instead of defining their implementations locally.Changes: Markdown rendering components
Layer / File(s) Summary File-link actions and rendering
apps/web/src/components/chat/MarkdownFileLink.logic.ts,apps/web/src/components/chat/MarkdownFileLink.tsxFile-link logic selects available actions and builds copy-menu items. The component handles previews, editor and browser opening, file reveal, copying, context menus, and action feedback. External-link rendering and HAST text
apps/web/src/components/chat/MarkdownExternalLink.tsx,apps/web/src/components/chat/markdownHast.logic.tsExternal links render a host icon or fallback, with break opportunities in link text. HAST utilities extract direct or descendant text and detect non-whitespace text. Fragment navigation and heading IDs
apps/web/src/components/chat/markdownFragments.tsFragment clicks resolve a target and scroll it into view. The rehype plugin assigns unique, prefixed IDs to headings without IDs. ChatMarkdown integration
apps/web/src/components/ChatMarkdown.tsxChatMarkdown.tsximports the extracted modules and removes the local implementations and exported file-link action helpers.Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Refactor
Merge Risk: ⚪ Minimal · up to 717a5
This refactor moves markdown link and fragment code into separate modules without changing behavior. No actionable merge-blocking risk was identified.
Pre-merge checks: Passed 3 · Failed 1
Failed Failed checks: 1 warning
Check name Status Explanation Resolution Description check Warning The description explains the refactor and lists verification results, but it does not follow the required section structure. It omits the Problem, Change, and Scope and approval headings, provides no … Restructure the description using the required Problem, Change, Scope and approval, and Verification headings. Add the linked issue or explicit maintainer approval, include before and after screenshots if this qualifies as a UI change, and … Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title clearly and concisely describes the main change: moving chat Markdown links and file chips into separate modules. 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.
Full details: Description check
Explanation
The description explains the refactor and lists verification results, but it does not follow the required section structure. It omits the Problem, Change, and Scope and approval headings, provides no issue or maintainer approval reference, and does not include required UI screenshots or a complete model and harness attribution.
Resolution
Restructure the description using the required Problem, Change, Scope and approval, and Verification headings. Add the linked issue or explicit maintainer approval, include before and after screenshots if this qualifies as a UI change, and identify the model and harness used by the agent.
✨ Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Added 1 commit
- refactor(web): chat markdown links and file chips live in their own modulese113e20
Thread transfer impact
⚠️ The latest CI run did not produce a thread transfer result for e113e20.
This comment will update automatically after the next completed run.