From a6c9a4999e64b4e43d0aebaf3d36fa77d0581657 Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:05 -0800 Subject: [PATCH 1/2] test(web): cover a review finding that ends on an emoji at the 997-unit cut --- .../components/pullRequest/pullRequestDetail.logic.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts b/apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts index 7c1cc47883f6f..bd9b3069fcd26 100644 --- a/apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts +++ b/apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts @@ -685,6 +685,12 @@ describe("fix findings handoff", () => { }); expect(handoff.reviewComments[0]?.text).toHaveLength(1_000); expect(handoff.reviewComments[0]?.text.endsWith("...")).toBe(true); + const emojiAtCut = buildFixFindingsHandoff({ + ...base, + reviewThreads: [thread(`${"x".repeat(986)}😀 and more of the review.${"y".repeat(100)}`)], + checks: [], + }); + expect(emojiAtCut.reviewComments[0]?.text).toBe(`reviewer: ${"x".repeat(986)}...`); }); it("keeps the newest threads and the failing checks when it has to cut", () => { From 591c3d54d99e19f4c436166078a7268e9d706a3c Mon Sep 17 00:00:00 2001 From: spoukyii <61633921+spoukyii@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:31 -0800 Subject: [PATCH 2/2] fix(web): review findings handed to a thread no longer end in a broken character Fixing pull request findings in a thread caps each piece of review text at 1,000 UTF-16 code units, cutting at 997 and adding "...". When an emoji straddled the cut, the text kept only its high surrogate and showed a replacement character before the "...", in the review comment card on the composer and in the handoff prompt. The cut now steps back one unit when it would land between a high and a low surrogate, the same check #29158 added to context chip labels and #29563 added to thread titles. Bug: a review finding handed to a thread ends in a broken character when an emoji sits at the 997-unit cut --- .../components/pullRequest/pullRequestDetail.logic.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/pullRequest/pullRequestDetail.logic.ts b/apps/web/src/components/pullRequest/pullRequestDetail.logic.ts index 2a7dc7151b92d..74af967a7a7ec 100644 --- a/apps/web/src/components/pullRequest/pullRequestDetail.logic.ts +++ b/apps/web/src/components/pullRequest/pullRequestDetail.logic.ts @@ -761,9 +761,14 @@ const FINDING_BODY_MAX_LENGTH = 1_000; function bounded(value: string): string { const trimmed = value.trim(); - return trimmed.length <= FINDING_BODY_MAX_LENGTH - ? trimmed - : `${trimmed.slice(0, FINDING_BODY_MAX_LENGTH - 3)}...`; + if (trimmed.length <= FINDING_BODY_MAX_LENGTH) return trimmed; + let end = FINDING_BODY_MAX_LENGTH - 3; + const previous = trimmed.charCodeAt(end - 1); + const next = trimmed.charCodeAt(end); + if (previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) { + end -= 1; + } + return `${trimmed.slice(0, end)}...`; } function boundedField(value: string): string {