fmt(js): `npm run fix` on merge (#81997)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
hermes-seaeye[bot] 2026-08-08 20:20:18 +00:00 committed by GitHub
parent 6f1870cd11
commit a726a4aee6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 36 additions and 8 deletions

View File

@ -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)

View File

@ -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

View File

@ -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))
})
})

View File

@ -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
)
})
})

View File

@ -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 = [