Skip to content

fix(mobile): collapsed PR comments no longer cut an emoji in half - #42663

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/mobile-pr-comment-preview-surrogate-slice
Nov 25, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/mobile-pr-comment-preview-surrogate-slice

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

In the mobile app's pull request Activity tab, a long comment collapses to its first 1,200 UTF-16 code units, so an emoji straddling that cut leaves a lone high surrogate that renders as a broken character in the collapsed preview. It is visible when the cut text lands on screen above the card's bottom fade, such as in the right cell of a GFM table after a long markdown link target that the preview hides.

The cut now lives in collapsedTimelineCommentMarkdown (in apps/mobile/src/features/pull-requests/PullRequestTimeline.logic.ts), which backs up one code unit when index 1,200 would split a surrogate pair, using the existing shared splitsSurrogatePair helper the same way other call sites do. Expanded and linked comments still render the full body.

Setup

Native dev clients on an Android 17 emulator and an iOS 26.5 simulator, connected to an isolated dev server with synthetic data only (server named "Test machine") and a local stand-in GitHub Enterprise API serving one PR. Its comment is a two-column GFM table (Area / Notes) whose Notes cell contains [Release note](<long link>) 😀 the release notes are ready for review. with 😀 straddling UTF-16 index 1,200, next to a three-sentence Area cell so the Notes text sits at the top of the row above the card's bottom fade.

Steps

Open the PR, switch to the Activity tab, and scroll the collapsed comment's table horizontally to its Notes column.

Platform 20a3bed8 (main) 5f0e9fb0 (this PR)
Android 17 (emulator) Android collapsed PR comment showing "Release note" followed by a replacement glyph
Notes cell reads "Release note" followed by a replacement glyph (lone high surrogate from the 1,200-unit cut)
Android collapsed PR comment showing "Release note" with no broken glyph
Same emulator and comment: Notes cell reads "Release note" with no broken glyph
iOS 26.5 (simulator) iOS collapsed PR comment showing "Release note" followed by a replacement glyph
Notes cell shows "Release note" followed by a replacement glyph
iOS collapsed PR comment showing "Release note" with no broken glyph
Same simulator and comment: Notes cell reads "Release note" with no broken glyph

Tests

  • PullRequestTimeline.logic.test.ts adds one case (keeps emoji whole at the collapsed comment preview limit) for a surrogate pair at the 1,200-code-unit boundary; with the helper reduced to main's body.slice(0, 1200) it fails with AssertionError (the received string ends in U+FFFD, 1 failed), and it passes here in 3 of 3 runs.
  • vp run check:changed passes.

An AI agent ran each check.

Mobile only (iOS and Android share the component). Web and desktop have no collapsed-comment cut of this kind. No copy, contract, provider, or docs change.

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 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 5f0e9fb and 6f59c4a.

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

Collapsed timeline comment previews now use a helper that avoids ending on half of an emoji when the 1,200-character boundary splits a surrogate pair. Expanded and short comments still render their full body.

Changes: Collapsed comment preview

Layer / File(s) Summary
Truncation and timeline rendering
apps/mobile/src/features/pull-requests/PullRequestTimeline.logic.ts, apps/mobile/src/features/pull-requests/PullRequestTimeline.tsx, apps/mobile/src/features/pull-requests/PullRequestTimeline.logic.test.ts
The new helper returns up to 1,200 characters, or 1,199 when the boundary splits a surrogate pair. Long collapsed comments use the helper. The test checks the emoji boundary case.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review 5f0e9

This change stops collapsed pull-request comment previews on mobile from cutting an emoji in half. It affects only the preview text; expanded comments are unchanged. A regression test covers the boundary case, and I found no merge-blocking risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile): collapsed PR comments no longer cut an emoji in half" matches the main change. The PR changes the collapsed comment preview cut at 1,200 UTF-16 code units so it backs up one un…
Description check Passed The description covers the problem, the change, scope, and verification. Problem: a long comment collapses at 1,200 UTF-16 code units, so an emoji on the cut leaves a lone high surrogate that renders …
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 "fix(mobile): collapsed PR comments no longer cut an emoji in half" matches the main change. The PR changes the collapsed comment preview cut at 1,200 UTF-16 code units so it backs up one unit when it would split a surrogate pair. The title is a conventional commit title, specific, and within the expected length. It names the platform scope and the user-visible result.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification. Problem: a long comment collapses at 1,200 UTF-16 code units, so an emoji on the cut leaves a lone high surrogate that renders as a broken glyph. Change: the cut moves into collapsedTimelineCommentMarkdown and uses the existing splitsSurrogatePair helper. Scope: it is a bug fix and says expanded and linked comments are unchanged. Verification: it gives a focused test, a failing-then-passing result against the old slice, and before/after screenshots for Android and iOS, plus the model and harness line. It does not link an issue or explain why no issue is needed, which the template asks for. Some minor items are not required, such as the broader check results.

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 c6c8b20 and 5f0e9fb.

Files selected for processing: 3

  • apps/mobile/src/features/pull-requests/PullRequestTimeline.logic.test.ts
  • apps/mobile/src/features/pull-requests/PullRequestTimeline.logic.ts
  • apps/mobile/src/features/pull-requests/PullRequestTimeline.tsx

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 25, 2026
…-preview-surrogate-slice

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the fix/mobile-pr-comment-preview-surrogate-slice branch from ddfdc3c to 6f59c4a Compare November 25, 2026 06:58
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment on both sides: Pixel 9, Android API 36, portrait 1080×2424, light theme; real dev client and each commit's Metro bundle against separate fresh servers.

Steps: Create a synthetic GitLab MR with a 1,280-UTF-16-unit GFM table comment whose emoji crosses indices 1199–1200. Open Pulls → MR → Activity, pan left to Notes, inspect the collapsed preview, then tap Show more and pan farther left. Base shows see details �; head ends cleanly at see details. Expanded comments show the full emoji and tail on both sides.

Before After
ca81b7b97a 6f59c4a8ac
Before: collapsed preview shows broken glyph After: collapsed preview ends cleanly
Before: expanded full emoji After: expanded full emoji
Before recording After recording

Capture driver · Seed script · Exact synthetic comment

Not shown:

  • iOS was not exercised; this comparison used Android to match the reported reproduction.

@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 25, 2026
@juliusmarminge
juliusmarminge merged commit 024da4f into pingdotgg:main Nov 25, 2026
56 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 25, 2026
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:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants