Skip to content

fix(web): copied inline code keeps meaningful edge spaces - #36712

Merged
juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:t3/preserve-inline-code-spaces
Nov 14, 2026
Merged

juliusmarminge merged 4 commits into
pingdotgg:mainfrom
StiensWout:t3/preserve-inline-code-spaces

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

Copying rendered inline code with meaningful spaces on both edges loses those spaces when the copied Markdown is parsed again. Pad those code spans according to CommonMark, preserving the existing backtick and all-space behavior.

Small fast-lane fix: a private serializer rule and its existing parser/serializer contract tests. No rendering change. The shared copy path covers rendered user and assistant Markdown in web and desktop; native mobile has no equivalent DOM selection serializer. No provider, RPC, authorization, connection-mode, or lifecycle changes.

Found by the clipboard bughunt (GPT 6.1 Sol), independently confirmed on main by Claude Opus 5.5, and reproduced again on main 1535f3f32e77cebc46ec0937e17e039669512e32 before fixing.

Validation:

  • pnpm exec vp test run apps/web/src/markdown-clipboard.test.ts: paired-space round trip fails on base and passes with the fix; backtick and all-space controls pass.
  • pnpm exec vp run scenarios:prove scripts/scenarios/inline-code-copy-keeps-edge-spaces.e2e.ts --base 1535f3f32e77cebc46ec0937e17e039669512e32 --head fa1916b5c278576d948d77eaa65b2dff28ed7121: proven. A temporary scenario typed a real user message, selected its rendered paragraph with Range, and dispatched a copy event using DataTransfer. Base produced Use \ value ` here.; head produced Use ` value ` here.while the rendered code value stayed" value "`.
  • Primary Browser panel repeated the user-message copy event successfully. Plain Markdown preserved the spaces; HTML retained them too. No system clipboard was accessed. CSS collapses these spaces visually, so captures do not demonstrate this data-fidelity change.
  • pnpm exec vp run check:changed: passed.
  • Local cubic: no findings; repository-specific context was unavailable for the fork.

Council review

Reviewer Round 1
Claude Opus 5.5 9/10
GPT 6.1 Sol 10/10

No blockers. Opus suggested a mixed space/backtick test row as a nit; left out after trim because it repeats the same padding path. An unconfirmed empty-CODE selection edge is outside this fix. No separate proof audit in the fast lane. Third-party paste targets and the OS clipboard were not tested.

Created with GPT 6.1 Sol (lead and review), Claude Opus 5.5 (independent verifier, builder, trim and review), and Grok 4.7 (evidence), in T3 Code through the Codex, Claude and Grok harnesses.

Closes #36711

StiensWout and others added 3 commits November 14, 2026 13:04
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
Co-authored-by: Grok 4.7 <noreply@x.ai>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 14, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6942e10

Macroscope's review found this PR approvable — Copied inline-code Markdown now preserves meaningful spaces at both ends. The change is limited to clipboard serialization, with no change to stored content or product defaults.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 14, 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 6942e10 and 1792249.

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

Inline-code Markdown wrapping now adds padding when content has leading and trailing spaces and at least one non-space character. New tests check that serialization and parsing preserve inline-code values with edge spaces, backticks, and spaces only.

Changes: Inline-code copy fidelity

Layer / File(s) Summary
Inline-code padding and round-trip tests
apps/web/src/markdown-clipboard.ts, apps/web/src/markdown-clipboard.test.ts
wrapInlineCode adds padding for values with meaningful leading and trailing spaces. Tests cover serialization and parsing for values with edge spaces, backticks, and spaces only.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge, tsapa44

Merge Risk: Minimal · previous review 6942e

Copying rendered inline code that has meaningful leading and trailing spaces now keeps those spaces when the Markdown is pasted and parsed again. Rendering is unchanged and the change is limited to the clipboard serializer. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected area (copied inline code, meaningful edge spaces, web package), which matches the changeset: wrapInlineCode now pads code spans with edge spaces so the parsed …
Description check Passed The description covers the problem (copied inline code loses meaningful edge spaces on re-parse), the change (padding per CommonMark, existing backtick and all-space behavior kept), scope (small fix, …
Linked Issues check Passed Issue #36711 requires that copied inline code with meaningful edge spaces keeps its parsed value when the copied Markdown is parsed again. The reviewed diff of apps/web/src/markdown-clipboard.ts adds …
Out of Scope Changes check Passed The whole-PR changes are limited to two files. apps/web/src/markdown-clipboard.ts changes only the pad computation in wrapInlineCode, with a comment. apps/web/src/markdown-clipboard.test.ts adds 18 li…
Full details: Title check

Explanation

The title names the fix and the affected area (copied inline code, meaningful edge spaces, web package), which matches the changeset: wrapInlineCode now pads code spans with edge spaces so the parsed value keeps its spaces. It is a conventional commit title in plain language, and it is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description covers the problem (copied inline code loses meaningful edge spaces on re-parse), the change (padding per CommonMark, existing backtick and all-space behavior kept), scope (small fix, linked issue #36711, no provider or RPC changes), and verification (focused test run, scenario proof, browser panel check, check:changed). It follows the template's section intent. Minor gaps: the Scope section does not explicitly describe the bug-report link beyond the closing line, and the Verification section lists results without a screenshot. The template's UI screenshot rule does not apply because the change has no rendering change.

Full details: Linked Issues check

Explanation

Issue #36711 requires that copied inline code with meaningful edge spaces keeps its parsed value when the copied Markdown is parsed again. The reviewed diff of apps/web/src/markdown-clipboard.ts adds spaceEdges, which is true when the code starts and ends with a space and contains a non-space character. The pad then becomes one space on each side, so a value of " value " serializes as " value ". CommonMark strips one edge space from each side of such content, so the parsed value is " value ". The existing backtick-edge padding is unchanged. All-space content gets no new padding, so the all-space behavior is preserved. The added parameterized tests in apps/web/src/markdown-clipboard.test.ts cover backtick edges, surrounding spaces, and spaces only through serialize-parse round trips. The author reports the paired-space round trip fails on base and passes at head. I did not inspect the test file directly, so test results rest on the PR summary and the author's validation report. No unmet coding requirement is identified.

Full details: Out of Scope Changes check

Explanation

The whole-PR changes are limited to two files. apps/web/src/markdown-clipboard.ts changes only the pad computation in wrapInlineCode, with a comment. apps/web/src/markdown-clipboard.test.ts adds 18 lines of tests for the same serializer contract. The code fence construction is unchanged. The PR description reports no rendering, provider, RPC, authorization, connection-mode, or lifecycle changes. Every change connects directly to issue #36711, so no out-of-scope change is identified.

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 71c2410 and 6942e10.

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; 1 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 14, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real web app, Chromium, 1280×800, light theme, fresh synthetic data and replay provider on both commits. Send Use ` value ` here., select the complete rendered paragraph, copy, paste as plain text, and send again. The inspection panel displays actual clipboard and DOM values; · marks spaces.

Before After
Commit dafd053a19 1792249917
Result Copied code has one space per edge; resent value is "value". Copied code has two spaces per edge; resent value remains " value ".
Pasted source Before: clipboard loses required padding After: clipboard preserves required padding
Resent value Before: meaningful edge spaces lost After: meaningful edge spaces preserved
Recording Before interaction After interaction

Scenario source · Runner configuration with clipboard grants

scenarios:prove exited 0: fails on base and passes on head.

@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 14, 2026
@juliusmarminge
juliusmarminge merged commit 666631e into pingdotgg:main Nov 14, 2026
52 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 14, 2026
Pipyakas pushed a commit to Pipyakas/t3code that referenced this pull request Nov 15, 2026
…36712)

Co-authored-by: Grok 4.7 <noreply@x.ai>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
(cherry picked from commit 666631e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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.

[Bug]: Copied inline code loses meaningful edge spaces

2 participants