Problem#
A streamed Browser dialog's message and defaultValue are cut at 4,000 UTF-16 units. #46538 stopped the cut from leaving a lone high surrogate, but a flag (two regional indicators) or a joined emoji across unit 4,000 is still cut between its parts, so the Browser panel's dialog card (and preview_status) ends in a lone boxed regional indicator, such as 🇺, or in an emoji missing its joined members. To reproduce: open a page that runs alert('Flag row?' + ' '.repeat(3989) + '🇺🇸') in the Browser panel.
Change#
cutDialogText in ServerBrowser.ts walks the text by grapheme cluster with Intl.Segmenter and keeps whole clusters up to 4,000 units, the same shape as the merged #46855 and #46740. A cut between clusters never splits a surrogate pair, so the cut still never leaves the lone surrogate #46538 guarded against. Text within the cap is returned as is, and the segmenter stops at the cap, so a very long message is not segmented in full.
Scope#
A small fix for an obvious bug, so no issue. It follows #46538 on the same helper and touches no other cut site.
Verification#
ServerBrowser.test.ts: the existing "reports a pending dialog…" case now also gives the dialog a defaultValue with 🇺🇸 across unit 4,000 and expects it to end before the flag. It fails on base (the value ends in 🇺) and passes with the fix; the existing 😀 message assertion is unchanged.
- The existing scenario
scripts/scenarios/browser-dialog-keeps-whole-emoji.e2e.ts gains a flag case: after the 😀 alert, it dismisses the card, clicks again for a second alert, Flag row? + spaces + 🇺🇸, and checks the card's text. The Flag row? prefix keeps the second card distinct from the first.
- One paired run,
vp run scenarios:prove scripts/scenarios/browser-dialog-keeps-whole-emoji.e2e.ts --base upstream/main, exited 0. Base 6043feb820 passes the 😀 case and fails the flag assertion with expected "Flag row? 🇺" to be "Flag row?". Head 0db4d93468 passes both. Both captures are from that run.
vp run check:changed upstream/main: format, lint, graphql, knip, typecheck (3 packages) and the changed-file tests (2 files, 128) pass.
| Base 6043feb820 | Head 0db4d93468 |
|---|
| Result | ❌ failed: expected "Flag row? 🇺" to be "Flag row?" | ✅ passed |
| Flag |  |  |
The scenario ran locally on macOS Chromium (web). A joined emoji (👨👩👧) across the cut was checked only with the same cut logic in Node, which drops the whole family where the old cut kept 👨; neither the test nor the scenario covers it. Not checked: desktop, Android and iOS.
Claude Opus 5.5 via T3 Code
Evidence#
On both commits, seed a fresh demo project and Replay thread, open the thread, toggle the right panel, select Browser, and navigate to a local real HTML page. Click the canvas to alert('Flag row?' + ' '.repeat(3989) + '🇺🇸'); dismiss, then click to prompt('Prompt row?', 'Default row?' + ' '.repeat(3986) + '🇺🇸'). Repeat both dialogs with 👩💻. In every long value the emoji starts at UTF-16 unit 3998. Focus each prompt input and press End before capturing. Capture all four states, dismiss each, and compare the rendered message/input values with the complete prefix before the emoji.
Environment: real Linux web app, Chromium, 1280×800, light theme; independent fresh databases and synthetic Replay threads on each commit. Prompt screenshots show the end of the input.
Scenario: Browser dialog caps preserve whole flags and joined emoji#
Proven: the scenario fails on base fc6ba3dab8 and passes on head 9fbc5889fa.
Scenario source