Skip to content

fix(web): copying a chat table as CSV keeps a space at line breaks - #43358

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-6c66c0d8f2
Nov 26, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-6c66c0d8f2

Conversation

@saphid

@saphid saphid commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Copy table → Copy as CSV on an assistant message read each cell's raw textContent. A <br> inside a cell, which GFM tables use for line breaks, adds no text there. So the words on either side ran together in the copied CSV.

Deterministic repro on origin/main (fc1f1bafde): the assistant message must contain this table. A message sent with t3 thread send renders as a user message, which shows <br> as literal text and does not reproduce the bug.

| Step | Tool | Result |
| --- | --- | --- |
| Test | `execute` | 12 passed<br>0 failed |

Click Copy table → Copy as CSV and paste.

  • Observed: Test,execute,12 passed0 failed
  • Expected: Test,execute,12 passed 0 failed

To reproduce with the free Replay provider, put that <br> in the table row of the final agent_message_chunk in apps/server/scripts/dev-replay/showcase_transcript.ndjson. Then run a showcase turn.

Change

csvCellText now collects cell text with collectHtmlCellText, the helper that Copy as HTML already uses. CSV turns each line break or block edge it marks into a space, so a cell stays on one line. The helper also outputs formulas as TeX, as the old code did. It skips the hidden UI chrome that the Markdown and HTML copies already skip. The serializer exists only in the web app, and desktop runs the same code. Mobile has no table copy.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Real app: I ran an e2e scenario against the real server and web app. It used the free Replay showcase turn, with its table edited locally as above. The scenario clicked Copy table → Copy as CSV and pasted the system clipboard into the composer with Ctrl+V. Base pasted 12 passed0 failed. Head pasted 12 passed 0 failed.

    Base Head
    before after
  • Unit: I added a case, copying a table as CSV, to apps/web/src/markdown-clipboard.test.ts. On the base source it fails with line 1line 2,para 1para 2. On head it passed on 3 consecutive runs (39/39 tests in the file).

  • vp run check:changed exited 0 (format, lint, knip, typecheck, affected tests, React Compiler).

  • Transcript: https://gist.github.com/saphid/a4d2b09958297ecf722eefd11fd30bbd

Not shown:

  • I did not paste into a spreadsheet app.
  • I did not check the desktop (Electron) build by hand. It runs the same web serializer.
  • The edited Replay transcript and the scenario were throwaway files and are not committed, so CI does not run this real-app check.
  • The unit case also checks that hidden elements (.sr-only, aria-hidden) are left out. I found no chat-rendered table cell where hidden text reaches the copy, so I don't claim that as a user-visible bug.

Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.1 Sol (Codex).

The CSV copy read each cell's raw textContent, so a `<br>` inside a cell
ran its words together ("12 passed0 failed"). It now collects cell text
with the helper Copy as HTML uses and turns each line break or block edge
into a space. That helper also skips hidden UI chrome, matching the
Markdown and HTML copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 312025d and 29f2dd1.

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.

Walkthrough

The CSV serializer now collects cell text through the HTML-cell text collector and converts block-edge and line-break markers to spaces. Tests cover header and row output, hidden content, and quoting fields that contain commas.

Changes: CSV cell text serialization

Layer / File(s) Summary
Collect and validate CSV cell text
apps/web/src/markdown-clipboard.ts, apps/web/src/markdown-clipboard.test.ts
csvCellText uses the HTML-cell text collector and replaces block-edge and line-break markers with spaces. Tests check headers, rows, hidden content, and comma quoting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, pfaisant

Merge Risk: Minimal · previous review 31202

Copying a table as CSV now keeps separate spaces where cells contain line breaks, so values like "12 passed" and "0 failed" are no longer run together. The change is small, web-only and covered by unit tests. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected behavior: copying a chat table as CSV kept a space at line breaks. The changeset replaces raw textContent collection in csvCellText with collectHtmlCellText, w…
Description check Passed The description follows the repository template closely. It covers the Problem (raw textContent drops the space at
, with a deterministic repro and expected versus observed output), the Change (us…
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: Title check

Explanation

The title names the fix and the affected behavior: copying a chat table as CSV kept a space at line breaks. The changeset replaces raw textContent collection in csvCellText with collectHtmlCellText, which turns line breaks and block edges into spaces, and adds a CSV test case. The title matches the main change and uses the repo's conventional commit form.

Full details: Description check

Explanation

The description follows the repository template closely. It covers the Problem (raw textContent drops the space at <br>, with a deterministic repro and expected versus observed output), the Change (use of collectHtmlCellText, TeX formulas, hidden-chrome skipping, and the web-only and desktop scope), Scope (small obvious bug, no issue needed under CONTRIBUTING.md), and Verification (real-app e2e with before/after images, unit test results, check:changed exit code, and a list of what was not checked). It also ends with the model and harness line the template requests. Minor gap: the Scope section does not link an issue or a maintainer request, but it gives the reason for omitting one, as the template allows.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fc1f1ba and 312025d.

Files selected for processing: 2

  • apps/web/src/markdown-clipboard.test.ts
  • apps/web/src/markdown-clipboard.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Evidence: real web app, Chromium, 1280×800, light theme, fresh synthetic data on both commits. Replayed the showcase table with 12 passed<br>0 failed, clicked Copy table → Copy as CSV, then pasted into the composer.

Before After
3fa136a5c5 29f2dd1ba6
Test,execute,12 passed0 failed Test,execute,12 passed 0 failed
Before: CSV loses the space at the rendered line break After: CSV preserves the space at the rendered line break
Before recording After recording

Scenario driver and fixture setup. The scenario runner exited 0: failed on base and passed on head.

Not shown:

  • Block boundaries and hidden elements were not exercised; this proof covers the reported rendered BR case only.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge
juliusmarminge merged commit 7891c72 into pingdotgg:main Nov 26, 2026
61 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 26, 2026
luckyou-02 pushed a commit to luckyou-02/t3code that referenced this pull request Nov 26, 2026
包含上游提交:
- pingdotgg#43318 (8ec9f43) 含三个反引号代码块后的线程链接正常渲染
- pingdotgg#43342 (6ea8886) 截断的颜色码不再残留字符到命令输出
- pingdotgg#43337 (fc1f1ba) Web Notebook 预览显示仅含 text/markdown 的输出
- pingdotgg#43331 (3fa136a) 分块 Markdown 预览保留 ... frontmatter 后的链接定义
- pingdotgg#43360 (65fc371) 文件侧栏支持复制文件路径
- pingdotgg#43358 (7891c72) 聊天表格复制为 CSV 在换行处保留空格
- pingdotgg#43344 (2a99314) Git 操作 toast 描述截断不再出现半个 emoji
- pingdotgg#43357 (5fda4f7) agent auto 发送 steer 绕过显式队列
- pingdotgg#43380 (147028a) ACP 可选布尔和选择题允许跳过
- pingdotgg#43383 (6ac4ede) 设置页快捷键胶囊按平台渲染修饰键和键名
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…ingdotgg#43358)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 7891c72)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…ingdotgg#43358)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 7891c72)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…ingdotgg#43358)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 7891c72)
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 26, 2026
…ingdotgg#43358)

Co-authored-by: SAPHID <saphid@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 7891c72)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants