Repository navigation
fix(web): preserve Mermaid source when copying selected text - #16249
NikitaMGrimm wants to merge 3 commits into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, well-contained clipboard bug fix that preserves Mermaid source while keeping structured context exports limited to actually selected chips. The production changes are localized to existing chat rendering and copy handling, with targeted regression coverage and no product-default or static-analysis configuration changes. You can add or adjust custom eligibility rules. Learn more. |
|
Note 🤖 gpt-6.1-sol responding on behalf of NikitaMGrimm Verified the structured-context concern and fixed it in 7c7a2d1. The user-message copy handler now excludes Mermaid source overrides when choosing context records; the source still copies as fenced Markdown. The regression failed before the fix and now confirms that an image link hidden in a Mermaid comment exports no image record unless its chip is selected. All 115 tests across the timeline and clipboard suites, web typecheck, and targeted lint/format checks passed (existing lint warnings only). |
|
Note Written by Hi! We are cleaning up open PRs, and this one does not say which model or harness was used to create it. If this change is really important, we recommend rebuilding the PR with a newer model and noting the model and harness in the PR description. |
|
Note Written by Reopening, this was closed by mistake. Sorry for the noise! |
Dismissing prior approval to re-evaluate 7c7a2d1
Problem
Selecting prose across a rendered Mermaid diagram drops the diagram from copied Markdown in assistant and sent-user messages. Drag from the text above a diagram to the text below it, copy, and paste: only the prose remains.
Change
Give rendered diagrams the existing Markdown copy override containing fenced Mermaid source. Crossing selections preserve the selected surrounding prose; selections wholly inside a diagram copy its complete source. Partial “Show code” selections remain partial. Because the restored diagram source can contain context-looking links, those links do not authorize exporting context records whose chips were not selected.
Scope and approval
Submitted under the very small, focused obvious-bug exception: the established selection-to-Markdown workflow loses rendered message content. The fix stays in the shared web/desktop renderer and adds no dependency or setting. No prior maintainer approval is claimed.
Verification
Previously recorded on this PR head; not rerun in this audit:
vp test run apps/web/src/components/chat/MessagesTimeline.test.tsx apps/web/src/markdown-clipboard.mermaid.test.ts apps/web/src/markdown-clipboard.test.ts: passed. Regressions cover crossing, inside, start/end-inside selections, source backticks, partial source-view copying, and exporting an image record only when its chip is selected, even when its link appears in a Mermaid comment.Dragging from a diagram label still does not start a text selection. Native mobile was not exercised.
Desktop: The author uses this change daily in the packaged Windows desktop app, in a personal build of the official nightly with their open PRs merged in, and confirms it works there. That use was manual and is not recorded.
Before is left; after is right. The recording copies the first three blocks of an expanded user message, leaving its final instruction unselected.
mermaid-selection-copy-before-after.mp4
Head
85382ed960mergesmainatab3a3cd162(no conflicts; this PR's diff is unchanged). The previous CI run was created on 2026-10-11 whilemainbriefly failed Typecheck inpackages/ssh(between #14598 and #18078), so it would have failed for reasons unrelated to this PR. On the merged head,MessagesTimeline.test.tsxandmarkdown-clipboard.mermaid.test.tspass (96 tests) andapps/webtypechecks.Note
🤖 Agent assistance: gpt-6.1-sol via Codex