Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a long browser dialog no longer ends in half a flag or joined emoji #46906

Mergedtiliakoos(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/46906/headmerged by juliusmarminge View on GitHub

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 6043feb820Head 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

    1. Pushed9fbc588

    2. 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.

      Base fc6ba3dab8Head 9fbc5889fa
      Result❌ retains U+1F1FA for flags and U+1F469 for joined emoji (4,000 units)✅ drops the entire crossing grapheme (3,998 units)
      flag messageBase fc6ba3dab8: flag messageHead 9fbc5889fa: flag message
      flag prompt defaultBase fc6ba3dab8: flag prompt defaultHead 9fbc5889fa: flag prompt default
      joined emoji messageBase fc6ba3dab8: joined emoji messageHead 9fbc5889fa: joined emoji message
      joined emoji prompt defaultBase fc6ba3dab8: joined emoji prompt defaultHead 9fbc5889fa: joined emoji prompt default
      RecordingBeforeAfter
      Same interactionBase recordingHead recording

      Scenario source

    3. juliusmarminge added labelstakeover:ready

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge merged this51f2c97

    6. juliusmarminge closed this

    7. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.