Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop): r5-m1 preserve ZWJ/ZWNJ shaping joiners in app tab titles
Diego Zacariasc6e2f586c93c
diff --git a/desktop-app/ui/src/components/WorkspaceTabStrip/WorkspaceTabStrip.test.tsx b/desktop-app/ui/src/components/WorkspaceTabStrip/WorkspaceTabStrip.test.tsxindex 535ebece7..0cef9f58a 100644--- a/desktop-app/ui/src/components/WorkspaceTabStrip/WorkspaceTabStrip.test.tsx+++ b/desktop-app/ui/src/components/WorkspaceTabStrip/WorkspaceTabStrip.test.tsx@@ -296,6 +296,29 @@ describe('WorkspaceTabStrip — sanitized plugin title reaches the rendered chroexpect(container.querySelector('.chat-view-tab__label')?.textContent).toBe('EVIL report')expect(screen.getByRole('button', { name: 'Close EVIL report' })).toBeTruthy()})++ it('keeps a legitimate ZWJ emoji sequence joined in the rendered label', () => {+ // The 👩💻 sequence (👩 + ZWJ + 💻) must survive the border and render as one+ // glyph, not split into 👩💻 — the shaping joiner is legitimate, not a hazard.+ const withEmoji = `Build ${cp(0x1f469)}${cp(0x200d)}${cp(0x1f4bb)}`+ const state = setAppTabTitle(+ openAppTab(createEmptyWorkspaceTabsState(), { id: 'app-1', appRef: 'ns/app', title: 'App' }),+ 'app-1',+ withEmoji+ )+ const { container } = render(+ <WorkspaceTabStrip+ tabs={state.tabs}+ activeTabId="app-1"+ onSelect={vi.fn()}+ onClose={vi.fn()}+ onReorder={vi.fn()}+ />+ )++ expect(container.querySelector('.chat-view-tab__label')?.textContent).toBe(withEmoji)+ expect(screen.getByRole('button', { name: `Close ${withEmoji}` })).toBeTruthy()+ })})describe('WorkspaceTabStrip — reorder (drag & keyboard)', () => {diff --git a/desktop-app/ui/src/lib/__tests__/sanitizeAppTabTitle.test.ts b/desktop-app/ui/src/lib/__tests__/sanitizeAppTabTitle.test.tsindex aff30a249..db47fe8f6 100644--- a/desktop-app/ui/src/lib/__tests__/sanitizeAppTabTitle.test.ts+++ b/desktop-app/ui/src/lib/__tests__/sanitizeAppTabTitle.test.ts@@ -63,6 +63,15 @@ describe('sanitizeAppTabTitle (mini-spec 08 §2)', () => {expect(sanitizeAppTabTitle(`a${cp(0x1d173)}b`)).toBe(`a${cp(0x1d173)}b`) // musical (astral)})+ it('preserves the ZWJ/ZWNJ shaping joiners (legitimate Unicode, not a hazard)', () => {+ // ZWJ (U+200D) fuses an emoji sequence into one glyph; stripping it splits+ // 👩💻 into 👩💻. ZWNJ (U+200C) controls shaping/ligatures in Persian and+ // Indic scripts. The denylist leaves the U+200C-U+200D gap open for both.+ const zwjEmoji = `Build ${cp(0x1f469)}${cp(0x200d)}${cp(0x1f4bb)}`+ expect(sanitizeAppTabTitle(zwjEmoji)).toBe(zwjEmoji)+ expect(sanitizeAppTabTitle(`a${cp(0x200c)}b`)).toBe(`a${cp(0x200c)}b`)+ })+it('truncates to MAX_TAB_TITLE_LEN with a trailing ellipsis', () => {const out = sanitizeAppTabTitle('x'.repeat(MAX_TAB_TITLE_LEN + 50))expect(out.length).toBe(MAX_TAB_TITLE_LEN)diff --git a/desktop-app/ui/src/lib/sanitizeAppTabTitle.ts b/desktop-app/ui/src/lib/sanitizeAppTabTitle.tsindex f5c719769..8dafeb3b5 100644--- a/desktop-app/ui/src/lib/sanitizeAppTabTitle.ts+++ b/desktop-app/ui/src/lib/sanitizeAppTabTitle.ts@@ -30,6 +30,13 @@ import { MAX_TAB_TITLE_LEN } from '../constants/workspaceTabs'* corrupts non-Latin text; the denylist targets only the actual layout/order/* invisibility hazards and leaves every legitimate script formatter alone.*+ * The two zero-width SHAPING joiners are likewise preserved: ZWNJ (U+200C) and+ * ZWJ (U+200D). ZWJ fuses an emoji sequence into one glyph (stripping it splits+ * a "woman technologist" into a separate woman + laptop); ZWNJ controls+ * ligatures/shaping in Persian and Indic scripts. The denylist leaves the gap+ * U+200C-U+200D open between the ZWSP entry (U+200B) and the bidi marks (U+200E-+ * U+200F) for exactly this reason.+ ** The denylist is declared as numeric code-point ranges and compiled with* `new RegExp`, NOT written as embedded literal bytes or `\u` escapes. A* security denylist built from invisible characters can be mutated with no@@ -48,7 +55,7 @@ const UNSAFE_RANGES: ReadonlyArray<readonly [number, number]> = [[0x000e, 0x001f], // C0 controls (excludes CR)[0x007f, 0x009f], // DEL + C1 controls[0x061c, 0x061c], // ARABIC LETTER MARK (bidi)- [0x200b, 0x200d], // ZWSP, ZWNJ, ZWJ (zero-width)+ [0x200b, 0x200b], // ZWSP (U+200C ZWNJ / U+200D ZWJ deliberately preserved)[0x200e, 0x200f], // LRM, RLM (bidi marks)[0x202a, 0x202e], // LRE, RLE, PDF, LRO, RLO (bidi embeddings/overrides)[0x2060, 0x2064], // WORD JOINER + invisible math operators