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(desktop): certificate dialog does not split an emoji in a long name - #44754
The desktop certificate trust dialog can show half an emoji when it cuts a long certificate name.
Steps (Linux, desktop app):
Make a certificate whose common name has an emoji at character 120, and serve it: openssl req -x509 -newkey rsa:2048 -nodes -utf8 -days 1 -keyout k.pem -out c.pem -subj "/CN=$(printf 'a%.0s' $(seq 119))😀 dev"
then npx http-server -S -C c.pem -K k.pem -p 18443.
In the desktop app, open https://localhost:18443/ in the browser panel.
The "localhost:18443 has an untrusted certificate" dialog shows "Issued to: aaa…a" with a broken character box before the "…". Expected: the name ends cleanly at the last whole character.
Cause
promptCertificateName in apps/desktop/src/preview/BrowserSession.ts cuts names over 120 UTF-16 units with slice(0, 120) and no surrogate check. When an emoji straddles unit 120, the dialog gets a lone high surrogate.
Change
Strip a trailing surrogate after the cut: .replace(/\p{Surrogate}$/u, ""). This is the same pattern as the other desktop cuts fixed in #43031 (release-note items), #43182 (update error messages) and #42642 (picked element preview). One line in one file.
Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New case in apps/desktop/src/preview/BrowserSession.test.ts, "cuts a long certificate name without splitting an emoji": it raises a certificate error with a 119-letter name plus an emoji and checks the "Issued to" line of the dialog detail.
Test commit alone, on main 3993c6b (fails on main ba0d3eb):
FAIL |unit| src/preview/BrowserSession.test.ts > BrowserSession > cuts a long certificate name without splitting an emoji
Expected: "Issued to: aaa…a…"
Received: "Issued to: aaa…a\ud83d…" (shown as a replacement character)
Tests 1 failed | 23 passed (24)
With the fix, BrowserSession.test.ts: 24 of 24 passed.
vp run check:changed: format, lint, knip, typecheck (2 packages) and test (1 file) all pass.
Not verified: I did not open the dialog in a running desktop app with the openssl certificate; the test drives the certificate-error handler and checks the text passed to the dialog.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.
Reviewing files that changed from the base of the PR and between 99345af and fe59271.
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
The certificate name truncation removes a trailing unmatched UTF-16 surrogate before adding an ellipsis. A test checks that a subject name ending with an emoji at the truncation boundary displays without the emoji.
promptCertificateName removes a trailing unmatched surrogate from the truncated name. The test checks that the displayed “Issued to” detail ends after 119 ASCII characters and does not include the emoji.
This fixes a broken character that could appear in the certificate trust dialog when a long name is cut in the middle of an emoji. The change is small and covered by a test, so merge-readiness risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual change: the desktop certificate dialog no longer splits an emoji when it truncates a long name. The raw summary confirms the one-line fix in promptCertificateName removes a …
Description check
The description follows the template. It covers the problem with reproduction steps, the cause, the change, the scope (a small bug fix that needs no issue, with a reason), and verification. Verificati…
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 names the actual change: the desktop certificate dialog no longer splits an emoji when it truncates a long name. The raw summary confirms the one-line fix in promptCertificateName removes a trailing unmatched surrogate after the 120-character cut. The title is specific, follows conventional commit form, and fits the single change.
Full details: Description check
Explanation
The description follows the template. It covers the problem with reproduction steps, the cause, the change, the scope (a small bug fix that needs no issue, with a reason), and verification. Verification lists the focused test, the before and after results, and what was not checked. It also names the model and harness as the template asks. The template's Change section asks for how the fix works, and the description gives that with the regex. The description is complete. Minor gap: it does not include a screenshot, but this is not a UI change that the template requires one for, since the author states the dialog was not opened.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 3993c6b and 99345af.
Files selected for processing: 2
apps/desktop/src/preview/BrowserSession.test.ts
apps/desktop/src/preview/BrowserSession.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.
Reproduced in the real Linux Electron desktop app under Xvfb/Openbox, light theme, 1600×1000 app window, with fresh isolated state on each commit and T3CODE_DEV_SEED=0.
Steps on both sides: serve a self-signed certificate at https://localhost:18443/ with DNS:localhost and subject = issuer CN of 119 × a + 😀 + dev certificate; click Start without importing history; add an empty git repository through Add project > Local folder; open right panel > Browser; enter the HTTPS URL and press Enter.
Base shows three replacement glyphs before the ellipsis on both name lines. Head shows 119 letters followed directly by the ellipsis. Both native screenshots were stable across captures 500 ms apart.
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:XS0-9 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.
Problem
The desktop certificate trust dialog can show half an emoji when it cuts a long certificate name.
Steps (Linux, desktop app):
openssl req -x509 -newkey rsa:2048 -nodes -utf8 -days 1 -keyout k.pem -out c.pem -subj "/CN=$(printf 'a%.0s' $(seq 119))😀 dev"then
npx http-server -S -C c.pem -K k.pem -p 18443.https://localhost:18443/in the browser panel.Cause
promptCertificateNameinapps/desktop/src/preview/BrowserSession.tscuts names over 120 UTF-16 units withslice(0, 120)and no surrogate check. When an emoji straddles unit 120, the dialog gets a lone high surrogate.Change
Strip a trailing surrogate after the cut:
.replace(/\p{Surrogate}$/u, ""). This is the same pattern as the other desktop cuts fixed in #43031 (release-note items), #43182 (update error messages) and #42642 (picked element preview). One line in one file.Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New case in
apps/desktop/src/preview/BrowserSession.test.ts, "cuts a long certificate name without splitting an emoji": it raises a certificate error with a 119-letter name plus an emoji and checks the "Issued to" line of the dialog detail.Test commit alone, on main 3993c6b (fails on main ba0d3eb):
With the fix,
BrowserSession.test.ts: 24 of 24 passed.vp run check:changed: format, lint, knip, typecheck (2 packages) and test (1 file) all pass.Not verified: I did not open the dialog in a running desktop app with the openssl certificate; the test drives the certificate-error handler and checks the text passed to the dialog.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.