fmt(js): npm run fix on merge (#73666)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
hermes-seaeye[bot]
2026-07-28 21:55:38 +00:00
committed by GitHub
parent 03af12c5c9
commit 66e20786d0
6 changed files with 43 additions and 53 deletions

View File

@@ -190,11 +190,7 @@ import {
} from './update-relaunch'
import { isOfficialSshRemote, OFFICIAL_REPO_HTTPS_URL } from './update-remote'
import { spawnUpdaterProcess } from './updater-process'
import {
formatBlockerMessage,
formatProbeFailedMessage,
scanVenvBlockers,
} from './venv-blocker-scan'
import { formatBlockerMessage, formatProbeFailedMessage, scanVenvBlockers } from './venv-blocker-scan'
import { fetchMarketplaceThemes, searchMarketplaceThemes } from './vscode-marketplace'
import {
computeWindowOptions,

View File

@@ -19,7 +19,7 @@ import {
formatProbeFailedMessage,
parseVenvBlockerScanOutput,
resolveVenvPython,
scanVenvBlockers,
scanVenvBlockers
} from './venv-blocker-scan'
// ---------------------------------------------------------------------------
@@ -56,9 +56,7 @@ describe('formatBlockerMessage', () => {
it('includes PID, name, cmdline, remote-client warning, and retry suggestion', () => {
const msg = formatBlockerMessage({
blocked: true,
processes: [
{ pid: 101, name: 'python.exe', cmdline: 'serve --host 10.0.0.1' },
],
processes: [{ pid: 101, name: 'python.exe', cmdline: 'serve --host 10.0.0.1' }]
})
assert.ok(msg.includes('PID 101'))
@@ -91,10 +89,12 @@ describe('parseVenvBlockerScanOutput', () => {
})
it('valid blocked', () => {
const o = parseVenvBlockerScanOutput(ok({
blocked: true,
processes: [{ pid: 1, name: 'p', cmdline: 'c' }],
}))
const o = parseVenvBlockerScanOutput(
ok({
blocked: true,
processes: [{ pid: 1, name: 'p', cmdline: 'c' }]
})
)
assert.equal(o.kind, 'blocked')
})
@@ -106,49 +106,43 @@ describe('parseVenvBlockerScanOutput', () => {
it('ok=false is rejected', () => {
assert.equal(
parseVenvBlockerScanOutput(JSON.stringify({ ok: false, blocked: false, processes: [] })).kind,
'probe-failure',
'probe-failure'
)
})
it('blocked must be boolean', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ blocked: 'false' })).kind,
'probe-failure',
)
assert.equal(parseVenvBlockerScanOutput(ok({ blocked: 'false' })).kind, 'probe-failure')
})
it('blocked=true with empty processes rejected', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ blocked: true, processes: [] })).kind,
'probe-failure',
)
assert.equal(parseVenvBlockerScanOutput(ok({ blocked: true, processes: [] })).kind, 'probe-failure')
})
it('blocked=false with non-empty processes rejected', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ processes: [{ pid: 1, name: 'p', cmdline: 'c' }] })).kind,
'probe-failure',
'probe-failure'
)
})
it('process pid must be positive integer', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 0, name: 'p', cmdline: 'c' }] })).kind,
'probe-failure',
'probe-failure'
)
})
it('process name must be non-empty string', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 1, name: '', cmdline: 'c' }] })).kind,
'probe-failure',
'probe-failure'
)
})
it('process missing cmdline is rejected', () => {
assert.equal(
parseVenvBlockerScanOutput(ok({ blocked: true, processes: [{ pid: 1, name: 'p' }] })).kind,
'probe-failure',
'probe-failure'
)
})
})
@@ -162,7 +156,9 @@ describe('scanVenvBlockers', () => {
const okJson = JSON.stringify({ ok: true, blocked: false, processes: [] })
const blockedJson = JSON.stringify({
ok: true, blocked: true, processes: [{ pid: 1, name: 'p', cmdline: 'c' }],
ok: true,
blocked: true,
processes: [{ pid: 1, name: 'p', cmdline: 'c' }]
})
function execReturn(json: string): any {
@@ -170,7 +166,12 @@ describe('scanVenvBlockers', () => {
}
function execThrow(status: number, stderr: string): any {
return (async (...args: any[]) => { const e: any = new Error(); e.status = status; e.stderr = Buffer.from(stderr); throw e }) as any
return (async (...args: any[]) => {
const e: any = new Error()
e.status = status
e.stderr = Buffer.from(stderr)
throw e
}) as any
}
it('clear scan returns clear', async () => {
@@ -214,4 +215,4 @@ describe('scanVenvBlockers', () => {
assert.equal(typeof c.timeout, 'number')
assert.ok(c.timeout > 0)
})
})
})

View File

@@ -117,7 +117,7 @@ export function parseVenvBlockerScanOutput(raw: string): ScanOutcome {
export async function scanVenvBlockers(
updateRoot: string,
execOverride?: typeof execFileAsync,
resolveOverride?: typeof resolveVenvPython,
resolveOverride?: typeof resolveVenvPython
): Promise<ScanOutcome> {
const execFn = execOverride || execFileAsync
const resolveFn = resolveOverride || resolveVenvPython
@@ -130,22 +130,20 @@ export async function scanVenvBlockers(
let stdout: string
try {
const proc = await execFn(
venvPython,
['-m', SCAN_MODULE],
{
cwd: updateRoot,
encoding: 'utf-8',
timeout: SCAN_TIMEOUT_MS,
windowsHide: true,
} as any,
)
const proc = await execFn(venvPython, ['-m', SCAN_MODULE], {
cwd: updateRoot,
encoding: 'utf-8',
timeout: SCAN_TIMEOUT_MS,
windowsHide: true
} as any)
stdout = String((proc as any).stdout ?? '')
} catch (err: any) {
const diag = [`exit code ${err.status ?? err.code ?? -1}`]
if (err.stderr) {diag.push(String(err.stderr).slice(0, 200))}
if (err.stderr) {
diag.push(String(err.stderr).slice(0, 200))
}
return { kind: 'probe-failure', error: diag.join('; ') }
}
@@ -182,7 +180,7 @@ export function formatBlockerMessage(result: VenvBlockerScanResult): string {
'Update aborted: another Hermes process is using this installation.',
'',
'These processes must be stopped before updating:',
'',
''
]
for (const proc of result.processes.slice(0, 10)) {
@@ -196,11 +194,9 @@ export function formatBlockerMessage(result: VenvBlockerScanResult): string {
lines.push('')
lines.push(
'Close the terminal, app, or service owning that process. If it is a ' +
'remote backend, stopping it will disconnect remote clients.',
)
lines.push(
'Then retry the update.',
'remote backend, stopping it will disconnect remote clients.'
)
lines.push('Then retry the update.')
return lines.join('\n')
}
@@ -215,4 +211,4 @@ export function formatProbeFailedMessage(): string {
'Close other Hermes windows and terminals, then retry. If the problem\n' +
'persists, run `hermes update` in a terminal for detailed diagnostics.'
)
}
}

View File

@@ -217,8 +217,7 @@ export function useVoiceConversation({
// voice-playback sequence has advanced past what we captured at speech
// start — don't auto-start the next sentence, the user chose to stop.
const stoppedByUser =
speechStartSequenceRef.current > 0 &&
$voicePlayback.get().sequence > speechStartSequenceRef.current
speechStartSequenceRef.current > 0 && $voicePlayback.get().sequence > speechStartSequenceRef.current
speechStartSequenceRef.current = 0

View File

@@ -2192,7 +2192,6 @@ describe('usePromptActions file attachment sync', () => {
})
})
it('uploads Windows file bytes when local mode fronts a POSIX WSL/Docker backend', async () => {
$connection.set({ mode: 'local' } as never)
$currentCwd.set('/root')
@@ -2207,6 +2206,7 @@ describe('usePromptActions file attachment sync', () => {
path: 'C:\\Users\\alice\\Downloads\\report.txt',
refText: '@file:`C:\\Users\\alice\\Downloads\\report.txt`'
}
const calls: { method: string; params?: Record<string, unknown> }[] = []
const requestGateway = vi.fn(async (method: string, params?: Record<string, unknown>) => {

View File

@@ -10,9 +10,7 @@ describe('sanitizeTextForSpeech', () => {
})
it('still keeps normal prose and inline code readable', () => {
expect(sanitizeTextForSpeech('Use `git status` after the change.')).toBe(
'Use git status after the change.'
)
expect(sanitizeTextForSpeech('Use `git status` after the change.')).toBe('Use git status after the change.')
})
it('skips markdown table data while preserving surrounding human text', () => {