Skip to content

fix(client-runtime): a line of inline triple-backtick code no longer breaks media in PR descriptions - #30571

Open
MarcoDotIO wants to merge 1 commit into
pingdotgg:mainfrom
MarcoDotIO:fix/rt-hunt
Open

MarcoDotIO wants to merge 1 commit into
pingdotgg:mainfrom
MarcoDotIO:fix/rt-hunt

Conversation

@MarcoDotIO

@MarcoDotIO MarcoDotIO commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A pull request body with a line such as ```npm test``` passes. gets the wrong media embeds. In CommonMark that line is inline code, because a backtick fence's info string cannot contain a backtick, and the Markdown renderer (remark) treats it that way. splitPullRequestBody in packages/client-runtime/src/pullRequestMarkdown.ts reads it as a fence opener instead. That flips every fence after it inside out:

  • a video or image link on its own line after it stays a plain link instead of becoming a player or image, and
  • a media link inside a later real code block is lifted out as an attachment, so the code block is cut in two and its closing fence renders as a new, empty block.

Where it shows up: the web PullRequestMarkdown (apps/web/src/components/pullRequest/PullRequestMarkdown.tsx) and the mobile PullRequestMarkdown and PullRequestDescription all render the segments from splitPullRequestBody(body).

Repro body:

```npm test``` passes.

https://example.com/demo.mp4

```
https://example.com/b.png
```

Expected: prose, a video, then a code block holding the PNG URL. Actual on main: one Markdown segment that ends in an unclosed fence, then the PNG lifted out as an image, then a lone ```.

Live repro

The next two lines are a live repro. On main, T3 Code's PR view shows the image URL below as plain text, and the fences in the rest of this description come out inside out.

vp test passes.

https://gist.githubusercontent.com/MarcoDotIO/13fbc29322df98233b54dc4b2e60187b/raw/demo-image.png

Change

When no fence is open, a backtick fence line whose info string contains a backtick is not treated as an opener. It drops through to the normal line handling as prose. Tilde fences are unchanged, since their info strings may contain backticks, and so are lines inside an open fence.

Scope and approval

A small, focused fix for an obvious bug, so no issue is needed. It's one condition in one function, following the CommonMark rule the renderer already uses, plus a regression test. It does not touch the CRLF fence fix in #30352, and the two merge cleanly.

Before and after

This PR open in the web dev client's pull request view, scrolled to the live repro above.

Before (upstream/main) After
Before: the image URL shows as a plain link After: the image renders under the inline code line

Verification

Added does not open a fence on a line of inline triple-backtick code to packages/client-runtime/src/pullRequestMarkdown.test.ts.

Before the fix (on main):

- "text": "```npm test``` passes."
+ "text": "```npm test``` passes.\n\nhttps://example.com/demo.mp4\n\n```"
...
- "url": "https://example.com/demo.mp4", "media": "video"
+ "url": "https://example.com/b.png", "media": "image"
...
 Tests  1 failed | 17 passed (18)

After the fix:

 Test Files  1 passed (1)
      Tests  18 passed (18)

Also ran:

  • apps/mobile/src/features/pull-requests/pullRequestDescriptionContent.test.ts: passes.
  • vp lint and vp fmt --check on packages/client-runtime/src, and tsc --noEmit in packages/client-runtime: all clean.
  • I parsed the repro body with remark-parse from the web app's dependencies. It gives inline code, then a paragraph, then a code block whose value is the PNG URL, which is what the splitter now matches.

Proof: a regression test that fails on main, plus before/after captures of this PR in the web client. Reviewed with GPT-6.1 Sol through the Codex CLI.

Created with Claude Opus 5.5 in the Claude Code desktop app.

🤖 Generated with Claude Code

…flips later code blocks in pull request bodies

A backtick fence's info string cannot hold a backtick, so a line such as
"```npm test``` passes." is inline code. The pull request body splitter
read it as a fence opener, which inverted every fence after it: media
links outside code stayed as plain links, and a media link inside a later
code block was lifted out, splitting the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 4, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7d6d9a3

Macroscope's review found this PR approvable — This fixes inline triple-backtick code disrupting subsequent media rendering in PR descriptions on web and mobile. The change is limited to parsing and retains existing media handling and URL validation.

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

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates Markdown fence parsing and adds a regression test. A backtick in the info string no longer opens a fence when no fence is open, so a following standalone video link can be extracted as an attachment.

Changes: Pull request body Markdown parsing

Layer / File(s) Summary
Fence detection and regression coverage
packages/client-runtime/src/pullRequestMarkdown.ts, packages/client-runtime/src/pullRequestMarkdown.test.ts
When no fence is open, a backtick in a fence-shaped line’s info string prevents that line from opening a fence. The regression test checks that the video link is extracted and that the inline-code text and later fenced block remain Markdown.

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

Change: Bug fix

Suggested labels: bugfix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 7d6d9

The parser fix and regression coverage are consistent with the stated behavior and are ready to merge.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title names the main change: a line of inline triple-backtick code no longer breaks media embeds in PR descriptions. The raw summary and objectives confirm that backtick fence lines with a backtic…
Description check Passed The description follows the required template sections: Problem, Change, Scope and approval, and Verification. The Problem section gives the expected and actual behavior with a reproduction body. The …
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 main change: a line of inline triple-backtick code no longer breaks media embeds in PR descriptions. The raw summary and objectives confirm that backtick fence lines with a backtick in the info string are no longer treated as fence openers in splitPullRequestBody. The title follows conventional commit form and is specific, though it is long at 100 characters.

Full details: Description check

Explanation

The description follows the required template sections: Problem, Change, Scope and approval, and Verification. The Problem section gives the expected and actual behavior with a reproduction body. The Change section explains the fix. The Scope section argues the change is a small, focused fix of an obvious bug, which the template allows without a prior issue. The Verification section lists a failing-before and passing-after regression test, plus lint, format, and type checks. The description is missing the template's HTML comment guidance, which is not required content. It also does not state a linked issue or maintainer approval, but the template permits a small-fix explanation in place of one. The author also names the model used, as the template asks for agent-based work. Before and after screenshots are included, as the UI section requires.

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 d51bc58 and 7d6d9a3.

Files selected for processing: 2
  • packages/client-runtime/src/pullRequestMarkdown.test.ts
  • packages/client-runtime/src/pullRequestMarkdown.ts

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

This branch has not been deployed

No deployments
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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant