From a726a4aee6dc6bd3bf42e32e51d391b60eb53aaf Mon Sep 17 00:00:00 2001 From: "hermes-seaeye[bot]" <307254004+hermes-seaeye[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 20:20:18 +0000 Subject: [PATCH] fmt(js): `npm run fix` on merge (#81997) Co-authored-by: github-actions[bot] --- .../gateway/hooks/use-gateway-boot.test.tsx | 1 + .../src/app/gateway/hooks/use-gateway-boot.ts | 1 + apps/desktop/src/lib/time.test.ts | 21 ++++++++++++++++--- ui-tui/src/__tests__/clipboard.test.ts | 20 +++++++++++++----- ui-tui/src/lib/clipboard.ts | 1 + 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx index 85e8957ee1b6e..a86446d3a168a 100644 --- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx +++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.test.tsx @@ -367,6 +367,7 @@ describe('useGatewayBoot remote reconnect loop (real hook, fake socket)', () => // end-state assertion would pass anyway (the seed would run later in the // same flush). The construction-time snapshot is what proves ordering. let cwdAtConnect = '' + class RecordingSocket extends FakeWebSocket { constructor(url: string) { super(url) diff --git a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts index 3de644dc0fb77..d1c926afc1aba 100644 --- a/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts +++ b/apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts @@ -500,6 +500,7 @@ export function useGatewayBoot({ progress: 95 }) publish(conn) + // Seed the workspace BEFORE the gateway opens: every session-restore // path is gated on gatewayState === 'open', so nothing can be active yet // and ensureDefaultWorkspaceCwd's live-session guard passes. The diff --git a/apps/desktop/src/lib/time.test.ts b/apps/desktop/src/lib/time.test.ts index 4c7c39829c2e3..daf34ec5216e7 100644 --- a/apps/desktop/src/lib/time.test.ts +++ b/apps/desktop/src/lib/time.test.ts @@ -1,6 +1,17 @@ import { describe, expect, it } from 'vitest' -import { calendarBucket, DAY, fmtMonth, fmtMonthYear, formatAgo, HOUR, MINUTE, nominalDayStart, SECOND, sessionBucketLabel } from './time' +import { + calendarBucket, + DAY, + fmtMonth, + fmtMonthYear, + formatAgo, + HOUR, + MINUTE, + nominalDayStart, + SECOND, + sessionBucketLabel +} from './time' const labels = { ageNow: 'now', @@ -123,12 +134,16 @@ describe('sessionBucketLabel', () => { // any host locale (the formatters intentionally use the runtime locale). const monthBucket = calendarBucket(secondsAt(2026, 2, 3), THU_NOON, 1) - if (monthBucket.kind !== 'month') {throw new Error(`expected month bucket, got ${monthBucket.kind}`)} + if (monthBucket.kind !== 'month') { + throw new Error(`expected month bucket, got ${monthBucket.kind}`) + } expect(sessionBucketLabel(monthBucket, labels)).toBe(fmtMonth.format(monthBucket.at)) const monthYearBucket = calendarBucket(secondsAt(2025, 11, 3), THU_NOON, 1) - if (monthYearBucket.kind !== 'monthYear') {throw new Error(`expected monthYear bucket, got ${monthYearBucket.kind}`)} + if (monthYearBucket.kind !== 'monthYear') { + throw new Error(`expected monthYear bucket, got ${monthYearBucket.kind}`) + } expect(sessionBucketLabel(monthYearBucket, labels)).toBe(fmtMonthYear.format(monthYearBucket.at)) }) }) diff --git a/ui-tui/src/__tests__/clipboard.test.ts b/ui-tui/src/__tests__/clipboard.test.ts index 6ba55d0b559c6..a06a73485445c 100644 --- a/ui-tui/src/__tests__/clipboard.test.ts +++ b/ui-tui/src/__tests__/clipboard.test.ts @@ -21,7 +21,12 @@ describe('readClipboardText', () => { await expect(readClipboardText('win32', run)).resolves.toBe('from windows\r\n') expect(run).toHaveBeenCalledWith( 'powershell', - ['-NoProfile', '-NonInteractive', '-Command', '[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard -Raw)))'], + [ + '-NoProfile', + '-NonInteractive', + '-Command', + '[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard -Raw)))' + ], expect.objectContaining({ encoding: 'utf8', maxBuffer: 4 * 1024 * 1024, windowsHide: true }) ) }) @@ -35,7 +40,12 @@ describe('readClipboardText', () => { ) expect(run).toHaveBeenCalledWith( 'powershell.exe', - ['-NoProfile', '-NonInteractive', '-Command', '[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard -Raw)))'], + [ + '-NoProfile', + '-NonInteractive', + '-Command', + '[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes((Get-Clipboard -Raw)))' + ], expect.objectContaining({ encoding: 'utf8', maxBuffer: 4 * 1024 * 1024, windowsHide: true }) ) }) @@ -89,9 +99,9 @@ describe('readClipboardText', () => { const b64 = Buffer.from(cjkText, 'utf8').toString('base64') const run = vi.fn().mockResolvedValue({ stdout: b64 }) - await expect( - readClipboardText('linux', run, { WSL_INTEROP: '/tmp/socket' } as NodeJS.ProcessEnv) - ).resolves.toBe(cjkText) + await expect(readClipboardText('linux', run, { WSL_INTEROP: '/tmp/socket' } as NodeJS.ProcessEnv)).resolves.toBe( + cjkText + ) }) }) diff --git a/ui-tui/src/lib/clipboard.ts b/ui-tui/src/lib/clipboard.ts index 13b557ea07195..e6979daf2eb22 100644 --- a/ui-tui/src/lib/clipboard.ts +++ b/ui-tui/src/lib/clipboard.ts @@ -3,6 +3,7 @@ import { promisify } from 'node:util' const execFileAsync = promisify(execFile) const CLIPBOARD_MAX_BUFFER = 4 * 1024 * 1024 + // PowerShell read: base64-encode the clipboard content to avoid ANSI codepage // corruption (same problem as the write path — see comment at line 94). const POWERSHELL_READ_ARGS = [