You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): collapsed PR comments no longer cut an emoji in half - #42663
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)
Notes cell reads "Release note" followed by a replacement glyph (lone high surrogate from the 1,200-unit cut)
Same emulator and comment: Notes cell reads "Release note" with no broken glyph
iOS 26.5 (simulator)
Notes cell shows "Release note" followed by a replacement 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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(inapps/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 sharedsplitsSurrogatePairhelper 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) whoseNotescell contains[Release note](<long link>) 😀 the release notes are ready for review.with😀straddling UTF-16 index 1,200, next to a three-sentenceAreacell so theNotestext 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
Notescolumn.20a3bed8(main)5f0e9fb0(this PR)Notes cell reads "Release note" followed by a replacement glyph (lone high surrogate from the 1,200-unit cut)
Same emulator and comment: Notes cell reads "Release note" with no broken glyph
Notes cell shows "Release note" followed by a replacement glyph
Same simulator and comment: Notes cell reads "Release note" with no broken glyph
Tests
PullRequestTimeline.logic.test.tsadds 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'sbody.slice(0, 1200)it fails withAssertionError(the received string ends inU+FFFD, 1 failed), and it passes here in 3 of 3 runs.vp run check:changedpasses.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