From bb4765d21ce0b8bb2c0187d0a1509b0b3b6dca9a Mon Sep 17 00:00:00 2001 From: "hermes-seaeye[bot]" <307254004+hermes-seaeye[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 00:35:03 +0000 Subject: [PATCH] fmt(js): `npm run fix` on merge (#71099) Co-authored-by: github-actions[bot] --- apps/desktop/electron/backend-env.test.ts | 2 ++ apps/desktop/electron/main.ts | 26 +++++++------------ .../hooks/use-composer-draft.test.tsx | 17 ++++++------ .../session/hooks/use-session-state-cache.ts | 1 + 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/apps/desktop/electron/backend-env.test.ts b/apps/desktop/electron/backend-env.test.ts index c42595a82472..a92ce6e062e7 100644 --- a/apps/desktop/electron/backend-env.test.ts +++ b/apps/desktop/electron/backend-env.test.ts @@ -75,6 +75,7 @@ test('buildDesktopBackendEnv forces PYTHONUTF8 unless the user set it explicitly platform: 'darwin', pathModule: path.posix }) + assert.equal(defaulted.PYTHONUTF8, '1') const optedOut = buildDesktopBackendEnv({ @@ -83,6 +84,7 @@ test('buildDesktopBackendEnv forces PYTHONUTF8 unless the user set it explicitly platform: 'darwin', pathModule: path.posix }) + assert.equal(optedOut.PYTHONUTF8, '0') }) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 573f867ff45a..98762242871d 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -2985,6 +2985,7 @@ function preflightStateDb(hermesHome, rememberLog) { if (!fileExists(stateDbPath)) { rememberLog('[updates] state.db pre-flight: not found (fresh install?)') + return } @@ -3015,23 +3016,19 @@ function preflightStateDb(hermesHome, rememberLog) { // Emergency timestamped backup, separate from the Python-level snapshot. const ts = new Date().toISOString().replace(/[:.]/g, '-') - const emergencyPath = path.join( - hermesHome, - `state.db.pre-update-emergency-${ts}.bak` - ) + + const emergencyPath = path.join(hermesHome, `state.db.pre-update-emergency-${ts}.bak`) try { fs.copyFileSync(stateDbPath, emergencyPath) const emergStat = fs.statSync(emergencyPath) - rememberLog( - `[updates] emergency state.db backup: ${emergencyPath} ` + - `(${emergStat.size} bytes)` - ) + rememberLog(`[updates] emergency state.db backup: ${emergencyPath} ` + `(${emergStat.size} bytes)`) // Prune to the 2 most recent emergency backups. try { const homeDir = fs.readdirSync(hermesHome) + const backups = homeDir .filter( f => @@ -3053,19 +3050,13 @@ function preflightStateDb(hermesHome, rememberLog) { void 0 } } catch (copyErr) { - rememberLog( - `[updates] emergency state.db backup failed: ${copyErr.message}` - ) + rememberLog(`[updates] emergency state.db backup failed: ${copyErr.message}`) } } else { - rememberLog( - `[updates] state.db too small (${stat.size} bytes) for a valid SQLite database` - ) + rememberLog(`[updates] state.db too small (${stat.size} bytes) for a valid SQLite database`) } } catch (statErr) { - rememberLog( - `[updates] could not stat state.db before update: ${statErr.message}` - ) + rememberLog(`[updates] could not stat state.db before update: ${statErr.message}`) } } @@ -3083,6 +3074,7 @@ async function applyUpdatesPosixInApp(opts: any) { if (!hermes) { emitUpdateProgress({ stage: 'manual', message: 'hermes update', percent: null }) + return { ok: true, manual: true, command: 'hermes update', hermesRoot: updateRoot } } diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-draft.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-draft.test.tsx index 18f8e4542377..81401482f693 100644 --- a/apps/desktop/src/app/chat/composer/hooks/use-composer-draft.test.tsx +++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-draft.test.tsx @@ -12,8 +12,7 @@ const mockComposerApi = { setText: vi.fn() } vi.mock('@assistant-ui/react', () => ({ useAui: () => ({ composer: () => mockComposerApi }), - useAuiState: (selector: (state: { composer: { text: string } }) => unknown) => - selector({ composer: { text: '' } }), + useAuiState: (selector: (state: { composer: { text: string } }) => unknown) => selector({ composer: { text: '' } }), useComposerRuntime: () => ({ getState: () => ({ text: '' }), subscribe: () => () => undefined @@ -60,11 +59,7 @@ describe('useComposerDraft — attachment scope stays coherent with the committe const snapshots: ComposerAttachment[][] = [] const { rerender } = render( - snapshots.push(s)} - sessionId="session-A" - /> + snapshots.push(s)} sessionId="session-A" /> ) // Mount loads session A's stashed attachment into the (module-level) main @@ -98,18 +93,24 @@ describe('useComposerDraft — rehydrate diagnostic log stays redacted', () => { it('logs counts/kinds/scope on restore but never the raw url, refText, or label', () => { const secretUrl = 'https://secret.example.com/private-workspace-path' + const attachment: ComposerAttachment = { id: 'url-secret', kind: 'url', label: 'do-not-leak-label', refText: `@url:${secretUrl}` } + stashSessionDraft('session-secret', '', [attachment]) const debugSpy = vi.spyOn(console, 'debug').mockImplementation(() => undefined) render( - undefined} sessionId="session-secret" /> + undefined} + sessionId="session-secret" + /> ) const rehydrateCalls = debugSpy.mock.calls.filter(call => call[0] === '[composer-rehydrate]') diff --git a/apps/desktop/src/app/session/hooks/use-session-state-cache.ts b/apps/desktop/src/app/session/hooks/use-session-state-cache.ts index 0f93d02a7999..2e732cb59254 100644 --- a/apps/desktop/src/app/session/hooks/use-session-state-cache.ts +++ b/apps/desktop/src/app/session/hooks/use-session-state-cache.ts @@ -77,6 +77,7 @@ export function useSessionStateCache({ selectedStoredSessionIdPropRef.current = selectedStoredSessionId selectedStoredSessionIdRef.current = selectedStoredSessionId } + const sessionStateByRuntimeIdRef = useRef(new Map()) const runtimeIdByStoredSessionIdRef = useRef(new Map()) const pendingViewStateRef = useRef<{ sessionId: string; state: ClientSessionState } | null>(null)