fix(platform): chat markdown link routing + PII precheck send wedge#1647
Conversation
Markdown anchors previously always opened in a new tab. Same-origin links now navigate via TanStack router; external links keep the target=_blank + noopener treatment.
Without resetting sendingRef on the blocked path, a user who triggers PII detection once couldn't send any subsequent message — the toast fired only on the first attempt and later sends were silently no-ops.
LinkKind is only used as classifyLink's return type; exporting it trips knip's unused-exports check.
📝 WalkthroughWalkthroughThis PR introduces link classification and conditional markdown anchor rendering, alongside a state management bugfix in message sending. A new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@services/platform/lib/utils/link-classifier.ts`:
- Around line 1-5: The exported type LinkKind is currently unused and causing CI
failures; make it module-private by removing the export modifier (i.e., change
"export type LinkKind" to "type LinkKind") in link-classifier.ts so the type
remains available internally but is not exported, or alternatively, if another
module genuinely needs it, add an explicit import/usage in that module instead
of leaving an unused export.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 867011db-dab3-4152-a8f1-c1e608eecab0
📒 Files selected for processing (4)
services/platform/app/features/chat/components/message-bubble/markdown-renderer.tsxservices/platform/app/features/chat/hooks/__tests__/use-send-message.test.tsservices/platform/app/features/chat/hooks/use-send-message.tsservices/platform/lib/utils/link-classifier.ts
| export type LinkKind = | ||
| | { kind: 'internal'; to: string } | ||
| | { kind: 'external'; href: string } | ||
| | { kind: 'hash'; href: string } | ||
| | { kind: 'special'; href: string }; |
There was a problem hiding this comment.
Fix CI blocker: LinkKind should not be exported if unused.
knip is failing because LinkKind is an unused exported type. Make it module-private unless another file imports it.
Proposed fix
-export type LinkKind =
+type LinkKind =
| { kind: 'internal'; to: string }
| { kind: 'external'; href: string }
| { kind: 'hash'; href: string }
| { kind: 'special'; href: string };🧰 Tools
🪛 GitHub Actions: Lint
[error] 1-1: knip reported 'Unused exported types (1)'. LinkKind type is an unused exported type (reported at 1:13).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@services/platform/lib/utils/link-classifier.ts` around lines 1 - 5, The
exported type LinkKind is currently unused and causing CI failures; make it
module-private by removing the export modifier (i.e., change "export type
LinkKind" to "type LinkKind") in link-classifier.ts so the type remains
available internally but is not exported, or alternatively, if another module
genuinely needs it, add an explicit import/usage in that module instead of
leaving an unused export.
Summary
target=_blank+rel=noopener noreferrer. Addslib/utils/link-classifier.tsto classify internal/external/hash/special hrefs.sendingRefwhen the PII precheck blocks a message so subsequent sends aren't silently no-oped (toast now fires every time).Test plan
mailto:/ hash anchors — verify default browser behavior.bun run checkpasses.Summary by CodeRabbit
New Features
Bug Fixes