Skip to content

The agent that grows with you

test: purge low-value tests, lane js02 (156 removed)

teknium10e8486d3c134
diff --git a/apps/desktop/electron/update-api-check.test.ts b/apps/desktop/electron/update-api-check.test.ts
index ec7edeee9c2..aece7168c17 100644
--- a/apps/desktop/electron/update-api-check.test.ts
+++ b/apps/desktop/electron/update-api-check.test.ts
@@ -89,7 +89,7 @@ test('compare payload maps to the behind count and a newest-first commit list; m
// genuine rate limit (x-ratelimit-remaining: 0) must name the shared-address
// cause, the real reset time and the GITHUB_TOKEN remedy; any other 403 must
// not be reported as a rate limit.
-test('a rate-limited 403 names the shared-IP cause, the reset time and GITHUB_TOKEN; a plain 403 is not a rate limit', () => {
+test('a rate-limited 403 names the reset time and GITHUB_TOKEN; a plain 403 is not a rate limit', () => {
const now = 1_700_000_000_000
const limited = {
@@ -100,17 +100,16 @@ test('a rate-limited 403 names the shared-IP cause, the reset time and GITHUB_TO
const message = describeUpdateCheckFailure(limited, now)
- assert.match(message, /60 per hour per network address/)
assert.match(message, /in about 25 minutes/)
assert.match(message, /GITHUB_TOKEN/)
assert.match(describeUpdateCheckFailure({ ...limited, authenticated: true }, now), /for your GITHUB_TOKEN/)
// Missing or non-zero rate-limit headers: an ordinary 403, reported as such.
- assert.equal(describeUpdateCheckFailure({ statusCode: 403 }), 'api.github.com answered HTTP 403.')
- assert.equal(
+ assert.doesNotMatch(describeUpdateCheckFailure({ statusCode: 403 }), /GITHUB_TOKEN/)
+ assert.doesNotMatch(
describeUpdateCheckFailure({ statusCode: 403, ...rateLimitFromHeaders({ 'x-ratelimit-remaining': '57' }) }),
- 'api.github.com answered HTTP 403.'
+ /GITHUB_TOKEN/
)
})
diff --git a/apps/desktop/electron/update-handoff-marker.test.ts b/apps/desktop/electron/update-handoff-marker.test.ts
index a8f48e6a387..6d4cc5fa43b 100644
--- a/apps/desktop/electron/update-handoff-marker.test.ts
+++ b/apps/desktop/electron/update-handoff-marker.test.ts
@@ -8,7 +8,6 @@ import { test } from 'vitest'
const REPO_ROOT = path.resolve(__dirname, '..', '..', '..')
const POSIX_SCRIPT = path.join(REPO_ROOT, 'scripts', 'desktop-update', 'posix.sh')
-const WINDOWS_SCRIPT = path.join(REPO_ROOT, 'scripts', 'desktop-update', 'windows.ps1')
function sandbox(tag: string) {
const home = fs.mkdtempSync(path.join(os.tmpdir(), `hermes-handoff-marker-${tag}-`))
@@ -39,33 +38,6 @@ function runPosix(installRoot: string, startedAt?: string) {
})
}
-function runWindows(installRoot: string, startedAt?: string) {
- const env = { ...process.env }
-
- if (startedAt === undefined) {
- delete env.HERMES_UPDATE_STARTED_AT
- } else {
- env.HERMES_UPDATE_STARTED_AT = startedAt
- }
-
- return spawnSync(
- 'powershell.exe',
- [
- '-NoProfile',
- '-ExecutionPolicy',
- 'Bypass',
- '-File',
- WINDOWS_SCRIPT,
- '-InstallRoot',
- installRoot,
- '-NoUi',
- '-NoMarkerCleanup',
- '-SelfTestMarker'
- ],
- { env, encoding: 'utf8' }
- )
-}
-
function assertScriptHandoff(run: (installRoot: string, startedAt?: string) => ReturnType<typeof spawnSync>) {
const preserved = sandbox('preserved')
const acquiredAt = Math.floor(Date.now() / 1000) - 300
@@ -101,7 +73,3 @@ function assertScriptHandoff(run: (installRoot: string, startedAt?: string) => R
test.skipIf(process.platform === 'win32')('POSIX hand-off preserves the Desktop marker acquisition time', () => {
assertScriptHandoff(runPosix)
})
-
-test.skipIf(process.platform !== 'win32')('PowerShell hand-off preserves the Desktop marker acquisition time', () => {
- assertScriptHandoff(runWindows)
-})
diff --git a/apps/desktop/electron/update-marker.test.ts b/apps/desktop/electron/update-marker.test.ts
index 412fab013e1..8607515aaa6 100644
--- a/apps/desktop/electron/update-marker.test.ts
+++ b/apps/desktop/electron/update-marker.test.ts
@@ -192,12 +192,3 @@ test('an expired marker does not block a hand-off (self-heals)', () => {
writeMarker(home, 1010, Math.floor((now - UPDATE_MARKER_MAX_AGE_MS - 60_000) / 1000))
assert.equal(updateHandoffConflict(home, { kill: ALIVE, now: () => now }), null)
})
-
-test('minutes-scale elapsed time is formatted as "Nm Ss"', () => {
- const home = tmpHome('conflict-minutes')
- const now = 1_000_000_000_000
- writeMarker(home, 1010, Math.floor(now / 1000) - 125) // 2m 5s old
- const conflict = updateHandoffConflict(home, { kill: ALIVE, now: () => now })
- assert.ok(conflict)
- assert.match(conflict.message, /2m 5s/)
-})
diff --git a/apps/desktop/electron/updater-process.test.ts b/apps/desktop/electron/updater-process.test.ts
index 76b61a33ce6..00aeaf57be3 100644
--- a/apps/desktop/electron/updater-process.test.ts
+++ b/apps/desktop/electron/updater-process.test.ts
@@ -403,9 +403,7 @@ test('describeUpdaterHandoffFailure leads with plain copy and confines the raw o
const text = describeUpdaterHandoffFailure({ message: raw })
const [lead, details] = text.split('\n\nDetails: ')
- assert.match(lead, /Hermes keeps running/)
- assert.match(lead, /Try again/)
- assert.doesNotMatch(lead, /exited|spawn|ENOENT|settle window|hermes update|\d/)
+ assert.ok(lead && !lead.includes(raw))
assert.equal(details, raw)
}
diff --git a/apps/desktop/electron/venv-blocker-scan.test.ts b/apps/desktop/electron/venv-blocker-scan.test.ts
index 367e5f8760c..eb181251c87 100644
--- a/apps/desktop/electron/venv-blocker-scan.test.ts
+++ b/apps/desktop/electron/venv-blocker-scan.test.ts
@@ -83,7 +83,7 @@ describe('resolveVenvPython', () => {
// ---------------------------------------------------------------------------
describe('formatBlockerMessage', () => {
- it('includes PID, name, cmdline, remote-client warning, and retry suggestion', () => {
+ it('includes PID, name and cmdline of each blocker', () => {
const msg = formatBlockerMessage({
blocked: true,
processes: [{ pid: 101, name: 'python.exe', cmdline: 'serve --host 10.0.0.1', kind: 'other', safeToStop: false }]
@@ -92,23 +92,13 @@ describe('formatBlockerMessage', () => {
assert.ok(msg.includes('PID 101'))
assert.ok(msg.includes('python.exe'))
assert.ok(msg.includes('serve'))
- assert.ok(msg.includes('remote backend'))
- assert.ok(msg.includes('retry'))
- assert.ok(!msg.includes('force-venv'))
})
})
describe('formatProbeFailedMessage', () => {
- it('suggests retry and hermes update', () => {
- const msg = formatProbeFailedMessage()
- assert.ok(msg.includes('hermes update'))
- assert.ok(msg.includes('retry'))
- })
-
- it('distinguishes a timeout from a confirmed blocker', () => {
+ it('carries the probe failure detail', () => {
const msg = formatProbeFailedMessage('timed out after 60 seconds')
assert.ok(msg.includes('timed out after 60 seconds'))
- assert.ok(msg.includes('no blocking process was confirmed'))
})
})
@@ -368,23 +358,6 @@ describe('scanVenvBlockers', () => {
assert.equal(o.kind, 'probe-failure')
})
- it('calls subprocess with correct args, cwd and timeout', async () => {
- const calls: any[] = []
-
- const spy = (async (cmd: string, args: string[], opts: any) => {
- calls.push({ cmd, args, cwd: opts.cwd, timeout: opts.timeout })
-
- return { stdout: okJson, stderr: '' }
- }) as any
-
- await scanVenvBlockers('/update/root', spy, stubVenv)
- assert.equal(calls.length, 1)
- const c = calls[0]
- assert.ok(c.cmd.endsWith('python.exe'))
- assert.deepEqual(c.args, ['-m', 'hermes_cli._scan_venv_blockers'])
- assert.equal(c.cwd, '/update/root')
- assert.equal(c.timeout, 60_000)
- })
})
describe('stopSafeVenvBlockers', () => {
diff --git a/apps/desktop/electron/wake-indicator.test.ts b/apps/desktop/electron/wake-indicator.test.ts
index 1aa22913ffc..c9d15e71cfc 100644
--- a/apps/desktop/electron/wake-indicator.test.ts
+++ b/apps/desktop/electron/wake-indicator.test.ts
@@ -82,16 +82,12 @@ beforeEach(() => {
describe('wake indicator window', () => {
it('centers the helper window at the top of the selected display', () => {
- expect(
- wakeIndicatorWindowBounds({
- bounds: { height: 982, width: 1512, x: -120, y: 40 }
- })
- ).toEqual({
- height: 52,
- width: 176,
- x: 548,
- y: 40
+ const bounds = wakeIndicatorWindowBounds({
+ bounds: { height: 982, width: 1512, x: -120, y: 40 }
})
+
+ expect(bounds.x).toBe(-120 + (1512 - bounds.width) / 2)
+ expect(bounds.y).toBe(40)
})
it('prefers the internal display and falls back to the primary display', () => {
diff --git a/apps/desktop/electron/window-controls.test.ts b/apps/desktop/electron/window-controls.test.ts
index a7fc9c873fe..0166a0f577e 100644
--- a/apps/desktop/electron/window-controls.test.ts
+++ b/apps/desktop/electron/window-controls.test.ts
@@ -5,8 +5,7 @@ import { describe, test } from 'vitest'
import {
customWindowControlsEnabled,
performWindowControl,
- registerWindowControlIpc,
- windowControlState
+ registerWindowControlIpc
} from './window-controls'
class FakeWindow {
@@ -87,16 +86,6 @@ describe('performWindowControl', () => {
})
})
-test('windowControlState exposes the custom-control and maximize state', () => {
- const win = new FakeWindow()
- win.maximized = true
-
- assert.deepEqual(windowControlState(win, true), {
- customWindowControls: true,
- isMaximized: true
- })
-})
-
test('custom window controls use the same WSL kernel fallback as the main process', () => {
assert.equal(
customWindowControlsEnabled({ env: {}, kernelRelease: '6.6.87.2-microsoft-standard-WSL2', platform: 'linux' }),
@@ -122,14 +111,6 @@ describe('registerWindowControlIpc', () => {
}
}
- test('registers the hermes:window-control channel', () => {
- const ipc = fakeIpc()
-
- registerWindowControlIpc(ipc as Parameters<typeof registerWindowControlIpc>[0], () => new FakeWindow())
-
- assert.equal(ipc.handlers.has('hermes:window-control'), true)
- })
-
test('dispatches the incoming action to performWindowControl on the resolved window', () => {
const ipc = fakeIpc()
const win = new FakeWindow()
diff --git a/apps/desktop/electron/window-renderer-lifecycle.test.ts b/apps/desktop/electron/window-renderer-lifecycle.test.ts
index 468c3d03844..ac785594f6b 100644
--- a/apps/desktop/electron/window-renderer-lifecycle.test.ts
+++ b/apps/desktop/electron/window-renderer-lifecycle.test.ts
@@ -3,10 +3,8 @@ import assert from 'node:assert/strict'
import { test } from 'vitest'
import {
- describeRendererLifecycleEvent,
installWindowRendererLifecycle,
pruneReloadTimes,
- pushReloadTime,
shouldReloadAfterFailedLoad,
shouldReloadAfterRendererGone
} from './window-renderer-lifecycle'
@@ -86,12 +84,6 @@ test('pruneReloadTimes drops timestamps outside the rolling window', () => {
assert.deepEqual(pruneReloadTimes([], now, 60_000), [])
})
-test('pushReloadTime records the timestamp', () => {
- const times: number[] = []
-
- assert.deepEqual(pushReloadTime(times, 42), [42])
-})
-
test('shouldReloadAfterRendererGone reloads crashed/oom on a live window', () => {
assert.deepEqual(shouldReloadAfterRendererGone({ reason: 'crashed', isDestroyed: false, recentReloadTimes: [] }), {
reload: true
@@ -282,7 +274,7 @@ test('unresponsive is logged, never reloaded', () => {
win.webContents.emit('unresponsive')
assert.equal(win.reloadCalls.length, 0)
- assert.equal(logs[0], '[renderer:secondary] webContents became unresponsive')
+ assert.equal(logs.length, 1)
})
test('did-fail-load on the main frame is logged, not reloaded', () => {
@@ -376,32 +368,6 @@ test('dispose removes every listener (no stacking on window recreation)', () =>
assert.equal(win.webContents.listenerCount('render-process-gone'), before - 1)
})
-test('describeRendererLifecycleEvent sanitizes unknown fields', () => {
- assert.equal(
- describeRendererLifecycleEvent({ kind: 'secondary', event: 'render-process-gone' }),
- '[renderer:secondary] render-process-gone reason=? exitCode=?'
- )
- assert.equal(
- describeRendererLifecycleEvent({
- kind: 'secondary',
- event: 'render-process-gone',
- reason: 'crashed',
- exitCode: undefined
- }),
- '[renderer:secondary] render-process-gone reason=crashed exitCode=?'
- )
- assert.equal(
- describeRendererLifecycleEvent({
- kind: 'main',
- event: 'render-process-gone',
- reason: 'killed',
- exitCode: 1,
- isDestroyed: true
- }),
- '[renderer:main] render-process-gone reason=killed exitCode=1 (expected teardown)'
- )
-})
-
// --- #95575: white-screen recovery for main-frame load failures -------------
// A torn renderer bundle (update replaced the app while its files were
// locked) or a missing index.html used to leave the primary window blank with
diff --git a/apps/desktop/electron/windows-child-options.test.ts b/apps/desktop/electron/windows-child-options.test.ts
index a68b9dfc5e7..b527e196c35 100644
--- a/apps/desktop/electron/windows-child-options.test.ts
+++ b/apps/desktop/electron/windows-child-options.test.ts
@@ -13,10 +13,6 @@ test('hiddenWindowsChildOptions preserves an existing windowsHide:false on Windo
assert.deepEqual(hiddenWindowsChildOptions({ windowsHide: false }, true), { windowsHide: false })
})
-test('hiddenWindowsChildOptions preserves an existing windowsHide:true on Windows', () => {
- assert.deepEqual(hiddenWindowsChildOptions({ windowsHide: true }, true), { windowsHide: true })
-})
-
test('hiddenWindowsChildOptions leaves options unchanged off Windows', () => {
assert.deepEqual(hiddenWindowsChildOptions({}, false), {})
assert.deepEqual(hiddenWindowsChildOptions({ stdio: 'ignore' }, false), { stdio: 'ignore' })
@@ -30,13 +26,6 @@ test('hiddenWindowsChildOptions merges windowsHide alongside other options on Wi
})
})
-test('hiddenWindowsChildOptions defaults isWindows from process.platform when omitted', () => {
- const result = hiddenWindowsChildOptions({})
- const expectedHide = process.platform === 'win32'
-
- assert.equal(Boolean(result.windowsHide), expectedHide)
-})
-
function makeChild(overrides: Partial<{ pid: number | null; killed: boolean }> = {}) {
const calls: string[] = []
diff --git a/apps/desktop/electron/windows-remote-lifecycle.test.ts b/apps/desktop/electron/windows-remote-lifecycle.test.ts
index ab6acf37d46..ebc971cac17 100644
--- a/apps/desktop/electron/windows-remote-lifecycle.test.ts
+++ b/apps/desktop/electron/windows-remote-lifecycle.test.ts
@@ -33,7 +33,6 @@ test('Windows spawn holds the update mutex across marker check and helper spawn'
assert.match(script, /\$mutexPath=\$marker\+"\.mutex"/)
assert.match(script, /\.Lock\(0,1\)/)
assert.match(script, /windows_ssh_runtime.*spawn/)
- assert.match(script, /remote update marker is present/)
})
test('Windows spawn publishes the initial ownership record before releasing the mutex', () => {
diff --git a/apps/desktop/electron/windows-remote-live.test.ts b/apps/desktop/electron/windows-remote-live.test.ts
deleted file mode 100644
index 8a499f31ec6..00000000000
--- a/apps/desktop/electron/windows-remote-live.test.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-import assert from 'node:assert/strict'
-
-import { test } from 'vitest'
-
-import { pickLocalPort, SshConnection } from './ssh-connection'
-import { connectWindowsRemote } from './windows-remote-lifecycle'
-
-// Live test against a real Windows host over SSH. Opt-in: set the env trio to
-// your test rig; skipped everywhere else (CI, other machines).
-// HERMES_WIN_SSH_HOST ssh alias/host of the Windows box
-// HERMES_WIN_SSH_USER remote user
-// HERMES_WIN_SSH_HERMES absolute path to the remote hermes.exe under test
-const liveHost = process.env.HERMES_WIN_SSH_HOST || ''
-const liveUser = process.env.HERMES_WIN_SSH_USER || ''
-const configuredHermes = process.env.HERMES_WIN_SSH_HERMES || ''
-const ownershipId = '89abcdef0123456789abcdef01234567'
-
-function fetchJson(url, token, path) {
- return fetch(`${url}${path}`, { headers: { 'X-Hermes-Session-Token': token } }).then(async response => {
- if (!response.ok) {
- throw new Error(`${response.status}: ${await response.text()}`)
- }
-
- return response.json()
- })
-}
-
-test.skipIf(!liveHost || !liveUser || !configuredHermes)(
- 'live Windows remote lifecycle spawns, authenticates, reuses, and cleans exact ownership',
- async () => {
- const ssh = new SshConnection({ host: liveHost, user: liveUser, port: 22, keyPath: '' }, { mux: true })
- await ssh.open()
-
- const common = {
- ssh,
- ownershipId,
- profile: '',
- remoteHermesPath: configuredHermes,
- pickLocalPort,
- forward: (local, remote) => ssh.forward(local, remote),
- cancelForward: (local, remote) => ssh.cancelForward(local, remote),
- waitForHermes: async (baseUrl, token) => {
- for (let i = 0; i < 40; i++) {
- try {
- await fetchJson(baseUrl, token, '/api/status')
-
- return
- } catch {
- void 0
- }
-
- await new Promise(resolve => setTimeout(resolve, 250))
- }
-
- throw new Error('status timeout')
- },
- probeReuseProof: async (baseUrl, token, nonce) => {
- const body: any = await fetchJson(baseUrl, token, '/api/ssh/ownership')
-
- return body.sshOwnerNonce === nonce ? 'authenticated-ok' : 'authenticated-stale'
- },
- rememberLog: () => {}
- }
-
- let first
- let second
-
- try {
- first = await connectWindowsRemote(common)
- assert.equal(first.platform.os, 'Windows')
- assert.equal(first.reused, false)
- const status: any = await fetchJson(first.baseUrl, first.token, '/api/status')
- assert.ok(status)
- await ssh.cancelForward(first.localPort, first.remotePort)
- second = await connectWindowsRemote({ ...common, reuseToken: first.token })
- assert.equal(second.reused, true)
- assert.equal(second.pid, first.pid)
- assert.equal(second.spawnNonce, first.spawnNonce)
- } finally {
- if (second) {
- await ssh.cancelForward(second.localPort, second.remotePort)
- }
-
- const runtimeScript = `& '${configuredHermes.replace('hermes.exe', 'python.exe')}' -m hermes_cli.windows_ssh_runtime read-lock '${ownershipId}'`
-
- const lock: any = JSON.parse(
- await ssh.exec(`powershell.exe -NoProfile -NonInteractive -Command "${runtimeScript}"`)
- )
-
- if (lock) {
- const python = configuredHermes.replace('hermes.exe', 'python.exe')
- const terminate = `& '${python}' -m hermes_cli.windows_ssh_runtime terminate '${lock.pid}' '${lock.creationTimeNs}' '${lock.hermesPath}' '${lock.spawnNonce}'`
- await ssh.exec(`powershell.exe -NoProfile -NonInteractive -Command "${terminate}"`)
- await ssh.exec(
- `powershell.exe -NoProfile -NonInteractive -Command "& '${python}' -m hermes_cli.windows_ssh_runtime remove-lock '${ownershipId}'"`
- )
- await ssh.exec(
- `powershell.exe -NoProfile -NonInteractive -Command "& '${python}' -m hermes_cli.windows_ssh_runtime remove-log '${ownershipId}' '${lock.spawnNonce}'"`
- )
- }
-
- await ssh.close()
- }
- },
- 90_000
-)
diff --git a/apps/desktop/electron/wsl-clipboard-image.test.ts b/apps/desktop/electron/wsl-clipboard-image.test.ts
index 311d11ca7da..beef796e2d2 100644
--- a/apps/desktop/electron/wsl-clipboard-image.test.ts
+++ b/apps/desktop/electron/wsl-clipboard-image.test.ts
@@ -5,7 +5,6 @@ import { test } from 'vitest'
import {
decodeClipboardImageBase64,
encodePowerShellCommand,
- powershellCandidates,
readWslWindowsClipboardImage
} from './wsl-clipboard-image'
@@ -116,9 +115,3 @@ test('readWslWindowsClipboardImage returns null when every candidate throws', ()
const result = readWslWindowsClipboardImage({ exec, candidates: ['a', 'b'] })
assert.equal(result, null)
})
-
-test('powershellCandidates lists the bare name first, then the absolute fallback', () => {
- const candidates = powershellCandidates()
- assert.equal(candidates[0], 'powershell.exe')
- assert.ok(candidates.some(c => c.endsWith('WindowsPowerShell/v1.0/powershell.exe')))
-})
diff --git a/apps/desktop/electron/wsl-path-bridge-gate.test.ts b/apps/desktop/electron/wsl-path-bridge-gate.test.ts
deleted file mode 100644
index 1b864f922eb..00000000000
--- a/apps/desktop/electron/wsl-path-bridge-gate.test.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Windows-platform regression for the WSL path-bridge gate (#66433).
- *
- * The behavioural tests in wsl-path-bridge.test.ts prove the no-op contract
- * (paths pass through unchanged when the bridge is inactive). This file goes
- * one rung further: with `process.platform` stubbed to `win32` and
- * `child_process.execFileSync` mocked, it proves the actual `wsl.exe` spawn is
- * suppressed — not just that the return value looks right.
- *
- * Each test re-imports the module fresh (vi.resetModules) so IS_WINDOWS is
- * re-evaluated against the stubbed platform.
- */
-import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
-
-const execFileSyncMock = vi.fn(() => 'Ubuntu\n')
-
-vi.mock('node:child_process', () => ({ execFileSync: execFileSyncMock }))
-
-describe('WSL bridge gate on Windows (#66433)', () => {
- const realPlatform = process.platform
-
- beforeEach(() => {
- Object.defineProperty(process, 'platform', { value: 'win32', configurable: true })
- vi.resetModules()
- execFileSyncMock.mockClear()
- })
-
- afterEach(() => {
- Object.defineProperty(process, 'platform', { value: realPlatform, configurable: true })
- })
-
- test('wsl.exe IS probed for a POSIX path when the bridge is active (control)', async () => {
- const { resolveLocalReadPath } = await import('./wsl-path-bridge')
- resolveLocalReadPath('/home/ubuntu/project')
- expect(execFileSyncMock).toHaveBeenCalled()
- // Sanity: it really was wsl.exe, not some other binary.
- expect(execFileSyncMock).toHaveBeenNthCalledWith(
- 1,
- 'wsl.exe',
- expect.arrayContaining(['-l', '-q']),
- expect.anything()
- )
- })
-
- test('wsl.exe is NEVER probed when the bridge is inactive — even for POSIX paths', async () => {
- const { resolveLocalReadPath, setWslBridgeActive } = await import('./wsl-path-bridge')
- setWslBridgeActive(false)
- // A POSIX path that WOULD trigger bridging (and the wsl.exe probe) when
- // active — but with the bridge off, resolveDefaultWslDistro is never
- // reached because resolveLocalReadPath returns before it.
- const result = resolveLocalReadPath('/home/ubuntu/project')
- expect(execFileSyncMock).not.toHaveBeenCalled()
- expect(result).toBe('/home/ubuntu/project')
- })
-
- test('the picker default-path also skips the wsl.exe probe when inactive', async () => {
- const { resolvePickerDefaultPath, setWslBridgeActive } = await import('./wsl-path-bridge')
- setWslBridgeActive(false)
- const result = resolvePickerDefaultPath('/home/ubuntu')
- expect(execFileSyncMock).not.toHaveBeenCalled()
- expect(result).toBe('/home/ubuntu')
- })
-
- test('re-enabling the bridge restores wsl.exe probing', async () => {
- const { resolveLocalReadPath, setWslBridgeActive } = await import('./wsl-path-bridge')
- setWslBridgeActive(false)
- resolveLocalReadPath('/home/ubuntu/project')
- expect(execFileSyncMock).not.toHaveBeenCalled()
-
- setWslBridgeActive(true)
- execFileSyncMock.mockClear()
- resolveLocalReadPath('/home/ubuntu/project')
- expect(execFileSyncMock).toHaveBeenCalled()
- })
-})
diff --git a/apps/desktop/electron/wsl-path-bridge.test.ts b/apps/desktop/electron/wsl-path-bridge.test.ts
index 04ebf572674..238e64a84ac 100644
--- a/apps/desktop/electron/wsl-path-bridge.test.ts
+++ b/apps/desktop/electron/wsl-path-bridge.test.ts
@@ -108,27 +108,3 @@ test('setWslBridgeActive(true) restores picker bridging', () => {
setWslBridgeActive(true)
assert.equal(resolvePickerDefaultPath('/home/alex', 'Ubuntu'), '\\\\wsl.localhost\\Ubuntu\\home\\alex')
})
-
-test('toggling the bridge is idempotent and does not corrupt cached state', () => {
- // Toggle twice each way.
- setWslBridgeActive(false)
- assert.equal(isWslBridgeActive(), false)
- setWslBridgeActive(false)
- assert.equal(isWslBridgeActive(), false)
-
- setWslBridgeActive(true)
- assert.equal(isWslBridgeActive(), true)
- setWslBridgeActive(true)
- assert.equal(isWslBridgeActive(), true)
-
- // Bridging still works after the toggles.
- assert.equal(resolvePickerDefaultPath('/home/alex', 'Ubuntu'), '\\\\wsl.localhost\\Ubuntu\\home\\alex')
-})
-
-// ── state isolation: every test sees a clean active bridge ────────────
-
-test('state isolation: bridge is active after a previous test toggled it off', () => {
- // This test relies on afterEach resetting the bridge.
- // If isolation is broken, isWslBridgeActive() would be false here.
- assert.equal(isWslBridgeActive(), true)
-})
diff --git a/apps/desktop/electron/wslg-launch-process.test.ts b/apps/desktop/electron/wslg-launch-process.test.ts
index 2ec6e5e104b..708cbcc990b 100644
--- a/apps/desktop/electron/wslg-launch-process.test.ts
+++ b/apps/desktop/electron/wslg-launch-process.test.ts
@@ -193,7 +193,7 @@ test.skipIf(process.platform !== 'linux')(
test
.skipIf(process.platform !== 'linux')
- .each(['', 'seven', '0', '1', '2', '-1', '3.5', '0x7', '999999999999999999', '100000'])(
+ .each(['', 'seven', '0', '1', '2', '0x7', '100000'])(
'ignores invalid or closed ready fd %j without breaking child stdio',
async readyFd => {
await withLauncher(
diff --git a/apps/desktop/electron/zoom.test.ts b/apps/desktop/electron/zoom.test.ts
index 9d973fc970b..20bd5d70fb2 100644
--- a/apps/desktop/electron/zoom.test.ts
+++ b/apps/desktop/electron/zoom.test.ts
@@ -19,7 +19,6 @@ import {
ZOOM_REASSERT_MAX_SETTLE_CHECKS,
ZOOM_REASSERT_SETTLE_DELAY_MS,
ZOOM_RESIZE_REASSERT_DELAY_MS,
- ZOOM_STEP,
ZOOM_STORAGE_KEY,
zoomLevelToPercent,
zoomReassertWindowEvents,
@@ -30,12 +29,6 @@ test('storage key stays stable so persisted zoom survives upgrades', () => {
assert.equal(ZOOM_STORAGE_KEY, 'hermes:desktop:zoomLevel')
})
-test('default zoom matches the Appearance 90% preset', () => {
- assert.equal(ZOOM_STEP, 0.1)
- assert.equal(zoomLevelToPercent(DEFAULT_ZOOM_LEVEL), 90)
- assert.equal(DEFAULT_ZOOM_LEVEL, percentToZoomLevel(90))
-})
-
test('clampZoomLevel rejects garbage and enforces bounds', () => {
assert.equal(clampZoomLevel(NaN), DEFAULT_ZOOM_LEVEL)
assert.equal(clampZoomLevel(Infinity), DEFAULT_ZOOM_LEVEL)
@@ -105,30 +98,6 @@ test('installZoomReassertOnWindowEvents wires show, restore, focus, resize, and
assert.equal(calls, 5)
})
-test('focus event reasserts zoom immediately without debounce on Windows (high-DPI alt-tab, #50837)', () => {
- const handlers = new Map()
-
- const win = {
- isDestroyed: () => false,
- on(event, listener) {
- handlers.set(event, listener)
- }
- }
-
- let calls = 0
- installZoomReassertOnWindowEvents(
- win,
- () => {
- calls += 1
- },
- 'win32'
- )
-
- // focus on Windows triggers immediate reassert — no timer involved
- handlers.get('focus')()
- assert.equal(calls, 1)
-})
-
test('isDebouncedReassertEvent debounces focus only on Linux, not Windows/macOS', () => {
assert.equal(isDebouncedReassertEvent('focus', 'linux'), true)
assert.equal(isDebouncedReassertEvent('focus', 'win32'), false)
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 34f0acba1b9..8190bc3d4ec 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -62,7 +62,6 @@
"fmt": "prettier --write 'src/**/*.{ts,tsx}' 'electron/**/*.ts' 'vite.config.ts'",
"fix": "npm run lint:fix && npm run fmt",
"test:ui": "vitest run --project ui",
- "test:task-scroll": "node --test scripts/tasks-scroll.test.mjs",
"test:desktop:platforms": "vitest run --project electron",
"test:find-in-page-native": "electron electron/find-in-page-native-fixture",
"test": "vitest run",
@@ -75,8 +74,7 @@
"test:e2e": "npm run build && playwright test e2e/",
"test:e2e:visual": "npm run build && WLR_BACKENDS=headless WLR_NO_HARDWARE_CURSORS=1 cage -- npx playwright test e2e/ --reporter=list",
"test:e2e:update-snapshots": "npm run build && WLR_BACKENDS=headless WLR_NO_HARDWARE_CURSORS=1 cage -- npx playwright test e2e/ --reporter=list --update-snapshots",
- "repro:short-session-hang": "node scripts/run-short-session-hang-repro.mjs",
- "repro:short-session-hang:test": "node --test scripts/run-short-session-hang-repro.test.mjs"
+ "repro:short-session-hang": "node scripts/run-short-session-hang-repro.mjs"
},
"dependencies": {
"@assistant-ui/core": "0.2.23",
diff --git a/apps/desktop/scripts/after-extract.test.mjs b/apps/desktop/scripts/after-extract.test.mjs
index eee0852f46f..f2377c7ca5a 100644
--- a/apps/desktop/scripts/after-extract.test.mjs
+++ b/apps/desktop/scripts/after-extract.test.mjs
@@ -1,6 +1,5 @@
import assert from 'node:assert/strict'
import path from 'node:path'
-import { createRequire } from 'node:module'
import { fileURLToPath } from 'node:url'
import { test, vi } from 'vitest'
@@ -9,19 +8,7 @@ vi.mock('./set-exe-identity.mjs', () => ({ stampExeIdentity }))
const { default: afterExtract } = await import('./after-extract.mjs')
-const require = createRequire(import.meta.url)
const desktopRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
-const desktopPackage = require(path.join(desktopRoot, 'package.json'))
-
-// #105629: the identity stamp must run BEFORE electron-builder's ASAR-integrity
-// rewrite of the exe (beforeCopyExtraFiles), i.e. from afterExtract, never from
-// afterPack — rcedit cannot commit changes to the resedit-rewritten PE. And the
-// fix must keep the integrity check on (no disableAsarIntegrity workaround).
-test('the exe identity stamp is wired to afterExtract, not afterPack, with ASAR integrity kept on', () => {
- assert.equal(desktopPackage.build.afterExtract, 'scripts/after-extract.mjs')
- assert.equal(desktopPackage.build.afterPack, undefined)
- assert.equal(desktopPackage.build.disableAsarIntegrity, undefined)
-})
test('stamps the stock electron.exe on win32 only, before it is renamed to Hermes.exe', async () => {
stampExeIdentity.mockClear()
diff --git a/apps/desktop/scripts/assert-root-install.test.mjs b/apps/desktop/scripts/assert-root-install.test.mjs
index 0d7ea4af6f6..8bc012cee2e 100644
--- a/apps/desktop/scripts/assert-root-install.test.mjs
+++ b/apps/desktop/scripts/assert-root-install.test.mjs
@@ -54,19 +54,6 @@ test('checkRootInstall fails when katex is missing but vite is present', () => {
}
})
-test('checkRootInstall fails when electron is missing', () => {
- const { tempRoot, appDir } = makeTree({
- rootPackages: BUILD_CRITICAL.filter(name => name !== 'electron')
- })
- try {
- const result = checkRootInstall(appDir, tempRoot)
- assert.equal(result.ok, false)
- assert.match(result.error, /electron/)
- } finally {
- fs.rmSync(tempRoot, { recursive: true, force: true })
- }
-})
-
test('checkRootInstall reports every missing package at once', () => {
const { tempRoot, appDir } = makeTree({ rootPackages: ['vite'] })
try {
diff --git a/apps/desktop/scripts/desktop-update-ui.test.mjs b/apps/desktop/scripts/desktop-update-ui.test.mjs
index bc69320a4a9..53eefa9e8f3 100644
--- a/apps/desktop/scripts/desktop-update-ui.test.mjs
+++ b/apps/desktop/scripts/desktop-update-ui.test.mjs
@@ -72,8 +72,6 @@ test.each(['disconnect', 'hung', 'hung-body', 'http', 'invalid'])('bounds %s pro
const document = openPage(fetch)
await vi.advanceTimersByTimeAsync(20_000)
assert.equal(document.body.className, 'disconnected')
- assert.equal(document.getElementById('title').textContent, 'Update status unavailable')
- assert.match(document.getElementById('line').textContent, /Check Hermes/)
assert.ok(attempts <= 4, `unbounded retry loop: ${attempts}`)
})
@@ -87,7 +85,6 @@ test.each(['legacy', 'transient', 'ack-failure'])('preserves terminal truth with
const document = openPage(fetch)
await vi.advanceTimersByTimeAsync(20_000)
assert.equal(document.body.className, 'done')
- assert.equal(document.getElementById('title').textContent, 'Update complete')
})
test('continues displaying a healthy long update while progress remains reachable', async () => {
@@ -95,6 +92,5 @@ test('continues displaying a healthy long update while progress remains reachabl
const document = openPage(fetch)
await vi.advanceTimersByTimeAsync(60_000)
assert.equal(document.body.className, '')
- assert.equal(document.getElementById('title').textContent, 'Updating Hermes')
assert.equal(document.getElementById('line').textContent, 'Building Desktop')
})
diff --git a/apps/desktop/scripts/fixtures/tasks-scroll.html b/apps/desktop/scripts/fixtures/tasks-scroll.html
deleted file mode 100644
index 02c976e3a27..00000000000
--- a/apps/desktop/scripts/fixtures/tasks-scroll.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<!doctype html>
-<html lang="en"><head><meta charset="UTF-8"><title>Task scroll regression fixture</title></head>
-<body><div id="root"></div><script type="module" src="./tasks-scroll.tsx"></script></body></html>
diff --git a/apps/desktop/scripts/fixtures/tasks-scroll.md b/apps/desktop/scripts/fixtures/tasks-scroll.md
deleted file mode 100644
index 1c41124c905..00000000000
--- a/apps/desktop/scripts/fixtures/tasks-scroll.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Task-list clipping regression
-
-From `apps/desktop`, after the locked workspace dependencies and Playwright Chromium are installed:
-
-```sh
-npm run test:task-scroll
-```
-
-The two tests mount the production `ComposerStatusStack` (including status grouping,
-section collapse, task rows and the production stylesheet) with 14 and 20 synthetic
-task records. Real Chromium wheel input must expose and hit-test the final row
-inside the capped viewport, above a composer boundary. Collapse and re-expand must
-preserve scrolling. No inline CSS treatment or `scrollIntoView` repairs the page.
-The fixture uses no backend, model, native Electron bridge or user session data;
-it is a renderer-component regression, not a native-app end-to-end test.
-
-The runner serves only loopback port 18120 and cleans up its browser and Vite
-server. Its Vite cache is private. Set `TASK_SCROLL_OUTPUT` to retain the JSON
-geometry and screenshots in a chosen directory. Otherwise these are retained in
-the printed test run's temporary directory. In shared campaigns wrap the command
-with the campaign's `flock tests.lock`, and isolate `HOME` and `HERMES_HOME`.
diff --git a/apps/desktop/scripts/fixtures/tasks-scroll.tsx b/apps/desktop/scripts/fixtures/tasks-scroll.tsx
deleted file mode 100644
index cfc6c672fc5..00000000000
--- a/apps/desktop/scripts/fixtures/tasks-scroll.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import '@/styles.css'
-
-import { createRoot } from 'react-dom/client'
-import { MemoryRouter } from 'react-router'
-
-import { ComposerStatusStack } from '@/app/chat/composer/status-stack'
-import { RootTooltipProvider } from '@/components/ui/tooltip'
-import { I18nProvider } from '@/i18n'
-import { $todosBySession } from '@/store/todos'
-
-// Input records only: the status grouping, rows, collapse and CSS are production code.
-const count = Number(new URLSearchParams(location.search).get('tasks') ?? 20)
-$todosBySession.set({
- 'task-scroll-fixture': Array.from({ length: count }, (_, i) => ({
- id: `task-${i + 1}`,
- content: `Phase ${i + 1}: renderer geometry task ${'long description '.repeat(i % 3)}`,
- status: 'completed' as const
- }))
-})
-
-createRoot(document.getElementById('root')!).render(
- <I18nProvider>
- <RootTooltipProvider>
- <MemoryRouter>
- <div style={{ position: 'absolute', bottom: 30, left: 200, width: 700 }}>
- <ComposerStatusStack queue={null} sessionId="task-scroll-fixture" />
- <div data-slot="fixture-composer" style={{ position: 'relative', height: 90, background: '#ddd' }}>
- Composer boundary — component fixture, no backend
- </div>
- </div>
- </MemoryRouter>
- </RootTooltipProvider>
- </I18nProvider>
-)
diff --git a/apps/desktop/scripts/local-pack-publish.test.mjs b/apps/desktop/scripts/local-pack-publish.test.mjs
index 0dd1dc042e3..6d149199373 100644
--- a/apps/desktop/scripts/local-pack-publish.test.mjs
+++ b/apps/desktop/scripts/local-pack-publish.test.mjs
@@ -63,15 +63,6 @@ afterEach(() => {
})
describe('local desktop pack stays out of the publish path', () => {
- test('the pack script pins an explicit publish policy', () => {
- // electron-builder 26 infers `onTagOrDraft` from CI when --publish is
- // absent, and `hermes desktop` runs the pack with CI=1 (_npm_lifecycle_env).
- // v27 drops the implicit behavior, so being explicit is also forward-safe.
- const pack = desktopPkg.scripts.pack
- assert.match(pack, /--dir\b/)
- assert.match(pack, /--publish\s+never\b/)
- })
-
test('publish resolution succeeds with a GitHub token present', async () => {
// The #87758 failure mode: CI=1 makes isPublish true, a GITHUB_TOKEN in the
// environment auto-selects the github provider, and the provider needs a
diff --git a/apps/desktop/scripts/run-short-session-hang-repro.test.mjs b/apps/desktop/scripts/run-short-session-hang-repro.test.mjs
deleted file mode 100644
index 95526c16d2d..00000000000
--- a/apps/desktop/scripts/run-short-session-hang-repro.test.mjs
+++ /dev/null
@@ -1,171 +0,0 @@
-import assert from 'node:assert/strict'
-import { existsSync, writeFileSync } from 'node:fs'
-import test from 'node:test'
-import { join } from 'node:path'
-
-import {
- ReproductionError,
- classify,
- pairedSoftSignal,
- resultForError,
- validateSummary,
- waitFor,
- waitForPredicate,
- waitForResponsive,
- withTemporarySandbox,
- withTimeout
-} from './run-short-session-hang-repro.mjs'
-
-const result = (outcome, latency = 10) => ({
- hardFailure: outcome !== 'not-reproduced',
- maxGapMs: latency,
- maxOperationMs: latency,
- outcome
-})
-
-test('separates harness errors from reproduction timeouts', () => {
- const harness = resultForError(new Error('fixture mismatch'))
- const reproduced = resultForError(new ReproductionError('renderer operation exceeded 5000ms'))
-
- assert.equal(harness.outcome, 'harness-error')
- assert.equal(harness.maxGapMs, null)
- assert.equal(harness.maxOperationMs, null)
- assert.equal(reproduced.outcome, 'reproduced')
-})
-
-test('preserves timeout semantics through the actual nested helpers', async () => {
- const immediate = await withTimeout(Promise.reject(new Error('precondition')), 30, 'outer', ReproductionError).catch(
- error => error
- )
- assert.equal(resultForError(immediate).outcome, 'harness-error')
-
- const stalledCdp = { eval: async () => false }
- const inner = await withTimeout(
- waitFor(stalledCdp, 'false', 10, 'inner product operation', ReproductionError),
- 50,
- 'outer product operation',
- ReproductionError
- ).catch(error => error)
- assert.ok(inner instanceof ReproductionError)
- assert.match(inner.message, /inner product operation/)
-
- const outer = await withTimeout(
- waitFor(stalledCdp, 'false', 50, 'inner product operation', ReproductionError),
- 10,
- 'outer product operation',
- ReproductionError
- ).catch(error => error)
- assert.ok(outer instanceof ReproductionError)
- assert.match(outer.message, /outer product operation/)
-
- const nearDeadline = await withTimeout(
- new Promise(resolve => setTimeout(() => resolve('responsive'), 20)),
- 50,
- 'responsive operation',
- ReproductionError
- )
- assert.equal(nearDeadline, 'responsive')
-})
-
-test('distinguishes a responsive false condition from a stalled renderer evaluation', { timeout: 2_000 }, async () => {
- let transientEvaluations = 0
- await waitForResponsive(
- {
- eval: async () => {
- transientEvaluations += 1
-
- if (transientEvaluations === 1) {
- throw new Error('execution context was destroyed')
- }
-
- return true
- }
- },
- 'true',
- 500,
- 'transient condition',
- 50
- )
- assert.equal(transientEvaluations, 2)
-
- await assert.rejects(
- waitForResponsive({ eval: async () => false }, 'false', 10, 'responsive condition', 1_000),
- error => !(error instanceof ReproductionError) && /renderer remained responsive/.test(error.message)
- )
- await assert.rejects(
- waitForResponsive({ eval: () => new Promise(() => {}) }, 'false', 50, 'stalled condition', 10),
- ReproductionError
- )
- await assert.rejects(
- waitForPredicate(() => false, 10, 'provider request'),
- /provider request/
- )
-})
-
-test('invalidates a target when warmup or measured runs have harness errors', () => {
- const passing = Array.from({ length: 5 }, () => result('not-reproduced'))
-
- assert.equal(classify(passing, result('harness-error')).classification, 'invalid')
- assert.equal(
- classify([result('harness-error'), ...passing.slice(1)], result('not-reproduced')).classification,
- 'invalid'
- )
- assert.equal(classify(passing, result('not-reproduced')).classification, 'not-reproduced')
- assert.equal(
- classify(
- [result('reproduced'), result('reproduced'), result('reproduced'), result('reproduced'), passing[0]],
- passing[0]
- ).classification,
- 'reproduced'
- )
-})
-
-test('suppresses soft-signal comparisons when a run is invalid or reproduced', () => {
- const passing = Array.from({ length: 5 }, () => result('not-reproduced', 10))
-
- assert.equal(pairedSoftSignal([], passing).reason, 'insufficient-runs')
- assert.equal(pairedSoftSignal(passing, []).reason, 'insufficient-runs')
- assert.equal(pairedSoftSignal(passing, passing).reason, undefined)
- assert.equal(pairedSoftSignal([result('harness-error'), ...passing.slice(1)], passing).reason, 'hard-or-invalid-run')
- assert.equal(pairedSoftSignal([result('reproduced'), ...passing.slice(1)], passing).reason, 'hard-or-invalid-run')
-})
-
-test('rejects contradictory summary semantics', () => {
- const passing = Array.from({ length: 5 }, () => result('not-reproduced'))
- const classification = classify(passing, result('not-reproduced'))
- const target = { ...classification, runs: passing, warmup: result('not-reproduced') }
- const summary = { baseline: target, candidate: target, invalid: false }
-
- assert.doesNotThrow(() => validateSummary(summary, 5))
- assert.throws(
- () => validateSummary({ ...summary, baseline: { ...target, classification: 'reproduced' } }, 5),
- /inconsistent baseline summary classification/
- )
- assert.throws(
- () =>
- validateSummary(
- {
- ...summary,
- baseline: { ...target, runs: [{ ...passing[0], hardFailure: true }, ...passing.slice(1)] }
- },
- 5
- ),
- /inconsistent baseline run outcome and hardFailure/
- )
-})
-
-test('removes the exact temporary sandbox when the run body throws', async () => {
- let sandbox
-
- await assert.rejects(
- withTemporarySandbox('cleanup-test', path => {
- sandbox = path
- writeFileSync(join(path, 'diagnostic.txt'), 'temporary')
- throw new Error('teardown report failed')
- }),
- /teardown report failed/
- )
-
- assert.ok(sandbox)
- assert.equal(existsSync(sandbox), false)
-})
diff --git a/apps/desktop/scripts/set-exe-identity.test.mjs b/apps/desktop/scripts/set-exe-identity.test.mjs
index 56ad299be7b..0267ab74d05 100644
--- a/apps/desktop/scripts/set-exe-identity.test.mjs
+++ b/apps/desktop/scripts/set-exe-identity.test.mjs
@@ -30,7 +30,7 @@ test('retries transient rcedit commit failures with bounded backoff', async () =
})
assert.equal(attempts, 3)
- assert.deepEqual(delays, [500, 1000])
+ assert.equal(delays.length, 2)
} finally {
fs.rmSync(root, { recursive: true, force: true })
}
diff --git a/apps/desktop/scripts/stage-native-deps.test.mjs b/apps/desktop/scripts/stage-native-deps.test.mjs
index f5f01472888..cfbc53ee0c7 100644
--- a/apps/desktop/scripts/stage-native-deps.test.mjs
+++ b/apps/desktop/scripts/stage-native-deps.test.mjs
@@ -238,27 +238,6 @@ test('cross-target: matching prebuild IS staged for a foreign target', () => {
}
})
-test('cross-target: foreign target with no prebuild throws (fail closed)', () => {
- const tmp = fs.mkdtempSync(join(os.tmpdir(), 'hermes-stage-'))
- try {
- const srcRoot = join(tmp, 'node-pty')
- const destRoot = join(tmp, 'dest')
-
- // Create a tree with a host build/Release but no foreign prebuild.
- makeFakeNodePty(srcRoot)
- makeFakeNode(join(srcRoot, 'build', 'Release', 'pty.node'), process.platform)
-
- const foreignPlatform = process.platform === 'linux' ? 'darwin' : 'linux'
-
- assert.throws(
- () => stageNodePtyInto(srcRoot, destRoot, { platform: foreignPlatform, arch: 'x64' }),
- /cannot cross-compile/i
- )
- } finally {
- fs.rmSync(tmp, { recursive: true, force: true })
- }
-})
-
test('host-target: host build/Release IS staged for a matching target', () => {
const tmp = fs.mkdtempSync(join(os.tmpdir(), 'hermes-stage-'))
try {
diff --git a/apps/desktop/scripts/tasks-scroll.test.mjs b/apps/desktop/scripts/tasks-scroll.test.mjs
deleted file mode 100644
index 82275ea8758..00000000000
--- a/apps/desktop/scripts/tasks-scroll.test.mjs
+++ /dev/null
@@ -1,92 +0,0 @@
-import assert from 'node:assert/strict'
-import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
-import { tmpdir } from 'node:os'
-import path from 'node:path'
-import { after, before, test } from 'node:test'
-import { fileURLToPath } from 'node:url'
-import { chromium } from 'playwright'
-import { createServer } from 'vite'
-
-const app = fileURLToPath(new URL('../', import.meta.url))
-const scratch = await mkdtemp(path.join(tmpdir(), 'hermes-task-scroll-'))
-const output = process.env.TASK_SCROLL_OUTPUT ?? scratch
-let server
-let browser
-let url
-
-before(async () => {
- await mkdir(output, { recursive: true })
- console.log(`Task-scroll evidence: ${output}`)
- // The runner loader avoids writing config bundles to shared node_modules.
- globalThis.__dirname = app
- server = await createServer({
- root: app,
- configFile: path.join(app, 'vite.config.ts'),
- configLoader: 'runner',
- cacheDir: path.join(scratch, 'node_modules/.vite'),
- server: { host: '127.0.0.1', port: 18120, strictPort: true },
- optimizeDeps: { entries: ['scripts/fixtures/tasks-scroll.html'] }
- })
- await server.listen()
- url = 'http://127.0.0.1:18120/scripts/fixtures/tasks-scroll.html'
- browser = await chromium.launch({ headless: true, args: ['--no-sandbox'] })
-})
-after(async () => {
- await browser?.close()
- await server?.close()
- if (output !== scratch) await rm(scratch, { recursive: true, force: true })
-})
-
-for (const count of [14, 20]) {
- test(`${count} tasks: wheel reveals the final row above the composer`, async () => {
- const page = await browser.newPage({ viewport: { width: 1200, height: 800 }, reducedMotion: 'reduce' })
- const errors = []
- page.on('pageerror', error => errors.push(error.message))
- try {
- await page.goto(`${url}?tasks=${count}`, { timeout: 120_000 })
- const stack = page.locator('[data-slot="composer-status-stack"]')
- const last = page.getByText(`Phase ${count}:`, { exact: false })
- await last.waitFor()
- await page.evaluate(() => document.fonts.ready)
- const measure = () => stack.evaluate(el => {
- const rect = el.getBoundingClientRect()
- return { height: el.clientHeight, scrollHeight: el.scrollHeight, top: el.scrollTop,
- bounds: { top: rect.top, bottom: rect.bottom }, cardHeight: el.firstElementChild.getBoundingClientRect().height }
- })
- const before = await measure()
- await stack.hover()
- await page.mouse.wheel(0, 10000)
- // Wheel is asynchronous; wait for animation frames to deliver it, without
- // scrollIntoView/locator.click silently repairing the broken layout.
- await page.waitForTimeout(400)
- const after = await measure()
- const tail = await last.evaluate(el => {
- const r = el.getBoundingClientRect()
- return { top: r.top, bottom: r.bottom,
- hit: el.contains(document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2)) }
- })
- const composer = await page.locator('[data-slot="fixture-composer"]').boundingBox()
- const receipt = { count, before, after, tail, composer, errors }
- console.log(JSON.stringify(receipt))
- await writeFile(path.join(output, `tasks-${count}.json`), JSON.stringify(receipt, null, 2))
- await page.screenshot({ path: path.join(output, `tasks-${count}.png`) })
- assert.deepEqual(errors, [])
- assert.ok(after.scrollHeight > after.height && after.top > before.top, 'Long task list must scroll')
- assert.ok(tail.top >= after.bounds.top && tail.bottom <= after.bounds.bottom, 'Final row must be fully inside viewport')
- assert.ok(tail.bottom <= composer.y && tail.hit, 'Final row must not be occluded by composer or card')
- // Collapse/expand must recover the same bounded, scrollable list.
- await page.mouse.wheel(0, -10000)
- await page.waitForTimeout(400)
- const header = stack.getByRole('button').first()
- await header.click()
- assert.ok((await measure()).height < before.height, 'Collapsed list must release its height')
- await header.click()
- await stack.hover()
- await page.mouse.wheel(0, 10000)
- await page.waitForTimeout(400)
- assert.ok((await measure()).top > 0, 'Re-expanded list must remain scrollable')
- } finally {
- await page.close()
- }
- })
-}
diff --git a/apps/desktop/scripts/write-build-stamp.test.mjs b/apps/desktop/scripts/write-build-stamp.test.mjs
index 53c88e23704..7fbc9f60e33 100644
--- a/apps/desktop/scripts/write-build-stamp.test.mjs
+++ b/apps/desktop/scripts/write-build-stamp.test.mjs
@@ -19,11 +19,6 @@ test('fromCI reads GITHUB_SHA / GITHUB_REF_NAME', () => {
assert.equal(fromCI({}), null)
})
-test('fromLocalGit returns null when git rev-parse fails', () => {
- const stamp = fromLocalGit('/tmp/not-a-repo', () => null)
- assert.equal(stamp, null)
-})
-
test('fromLocalGit reads HEAD + branch + dirty status', () => {
const calls = []
const execFn = (cmd) => {
diff --git a/apps/desktop/src/app/capabilities/index.test.tsx b/apps/desktop/src/app/capabilities/index.test.tsx
index e397d1e849f..20a16c623a4 100644
--- a/apps/desktop/src/app/capabilities/index.test.tsx
+++ b/apps/desktop/src/app/capabilities/index.test.tsx
@@ -141,29 +141,6 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
expect(setToolsetEnabled.mock.calls[0].slice(0, 2)).toEqual(['web', false])
})
- it('renders toolset titles without leading emoji', async () => {
- getToolsets.mockResolvedValue([toolset({ name: 'cronjob', label: '⏰ Cron Jobs', description: 'cron tools' })])
-
- await renderSkills()
-
- // The label renders in both the row and the auto-selected detail header, so
- // assert via the switch's (emoji-stripped) accessible name and the absence
- // of the emoji rather than a single-match text lookup.
- await screen.findByRole('switch', { name: 'Turn Cron Jobs toolset off' })
- expect(screen.queryByText(/⏰/)).toBeNull()
- })
-
- it('renders the provider config panel inline for the selected toolset', async () => {
- // The master-detail UI dropped the resting "Configured" pill and the
- // "Configure" expander: the detail column auto-selects the first toolset
- // and renders its config panel directly, which fetches on mount.
- await renderSkills()
-
- await screen.findByRole('switch', { name: 'Turn Web Search toolset off' })
- await waitFor(() => expect(getToolsetConfig).toHaveBeenCalled())
- expect(getToolsetConfig.mock.calls[0][0]).toBe('web')
- })
-
it('scopes Tools config to the profile chosen in the selector', async () => {
// Two profiles → the "Configuring:" selector renders. Picking a non-active
// profile must re-fetch toolsets scoped to THAT profile.
@@ -305,7 +282,7 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
// Refused with an informational toast, no install action spawned.
await waitFor(() =>
expect(vi.mocked(notify)).toHaveBeenCalledWith(
- expect.objectContaining({ title: '"web-research" is already installed' })
+ expect.objectContaining({ title: expect.stringContaining('web-research') })
)
)
})
@@ -361,8 +338,7 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
await renderSkills()
- expect(await screen.findByText(/auxiliary model configuration/)).toBeTruthy()
- const link = screen.getByRole('button', { name: /Choose vision model in Settings/ })
+ const link = await screen.findByRole('button', { name: /Choose vision model in Settings/ })
await act(async () => {
fireEvent.click(link)
@@ -503,7 +479,6 @@ describe('CapabilitiesView toolset management', { timeout: 60_000 }, () => {
// Catalog section header + the one genuinely-available row. Rows already
// installed (lock flag OR name collision with the installed list) are gone.
- expect(await screen.findByText('Available to install')).toBeTruthy()
expect(await screen.findByText('gif-search')).toBeTruthy()
expect(screen.queryByText('ascii-art')).toBeNull()
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
index 445659dbf56..8c1180d5919 100644
--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx
@@ -69,8 +69,8 @@ describe('PluginsTab', () => {
render(<PluginsTab profile="workbot" />)
- expect(screen.getByTestId('server-pill-ready-server').className).toContain('bg-emerald-500/10')
- expect(screen.getByTestId('server-pill-setup-server').className).toContain('bg-destructive/10')
+ expect(screen.getByTestId('server-pill-ready-server')).toBeTruthy()
+ expect(screen.getByTestId('server-pill-setup-server')).toBeTruthy()
expect(screen.getByText('Example App is not installed. Install Example App, then try again.')).toBeTruthy()
expect(screen.getByRole('switch', { name: 'Agent: demo-plugin' }).getAttribute('aria-checked')).toBe('true')
})
@@ -426,7 +426,7 @@ describe('PluginsTab catalog UX', () => {
screen.getByRole('button', { name: 'Uninstall: demo-weather' }).click()
// The click only asks; nothing is deleted until the destructive confirm is answered.
- await waitFor(() => expect($confirmRequest.get()?.title).toBe('Uninstall demo-weather?'))
+ await waitFor(() => expect($confirmRequest.get()?.title).toContain('demo-weather'))
expect(requestGateway).not.toHaveBeenCalledWith('plugins.manage', expect.objectContaining({ action: 'remove' }))
settleConfirm(true)
@@ -450,7 +450,7 @@ describe('PluginsTab catalog UX', () => {
screen.getByRole('button', { name: 'Uninstall: Clock' }).click()
- await waitFor(() => expect($confirmRequest.get()?.title).toBe('Uninstall Clock?'))
+ await waitFor(() => expect($confirmRequest.get()?.title).toContain('Clock'))
expect(uninstallDiskPlugin).not.toHaveBeenCalled()
settleConfirm(true)
diff --git a/apps/desktop/src/app/chat/chat-swap-overlay.test.tsx b/apps/desktop/src/app/chat/chat-swap-overlay.test.tsx
index 958dedba3d6..6f4b750641c 100644
--- a/apps/desktop/src/app/chat/chat-swap-overlay.test.tsx
+++ b/apps/desktop/src/app/chat/chat-swap-overlay.test.tsx
@@ -22,23 +22,6 @@ describe('ChatSwapOverlay', () => {
vi.useRealTimers()
})
- it('animates the glyph without any timer', () => {
- const { container } = render(<ChatSwapOverlay profile="turqoise" />)
-
- expect(container.querySelector('.glyph-spinner__strip')).toBeTruthy()
- expect(vi.getTimerCount()).toBe(0)
-
- vi.advanceTimersByTime(5_000)
-
- expect(vi.getTimerCount()).toBe(0)
- })
-
- it('names the waking profile', () => {
- render(<ChatSwapOverlay profile="turqoise" />)
-
- expect(screen.getByText(/turqoise/)).toBeTruthy()
- })
-
it('keeps the last profile name through the fade-out, with the glyph frozen', () => {
const { container, rerender } = render(<ChatSwapOverlay profile="turqoise" />)
diff --git a/apps/desktop/src/app/chat/close-tab.test.ts b/apps/desktop/src/app/chat/close-tab.test.ts
index 219f20df6d4..e8b102396be 100644
--- a/apps/desktop/src/app/chat/close-tab.test.ts
+++ b/apps/desktop/src/app/chat/close-tab.test.ts
@@ -109,13 +109,6 @@ describe('closeWorkspaceTab', () => {
expect(requestFreshSession).toHaveBeenCalledTimes(1)
})
- it('empties main even with no session loader wired', () => {
- loadedMainOnly()
-
- expect(closeWorkspaceTab()).toBe(true)
- expect(requestFreshSession).toHaveBeenCalledTimes(1)
- })
-
it('is a no-op on a blank draft — that IS the post-close state', () => {
expect(closeWorkspaceTab(vi.fn())).toBe(false)
expect(requestFreshSession).not.toHaveBeenCalled()
diff --git a/apps/desktop/src/app/chat/composer/attachments.test.tsx b/apps/desktop/src/app/chat/composer/attachments.test.tsx
index 8a756b56ff8..c69549892f3 100644
--- a/apps/desktop/src/app/chat/composer/attachments.test.tsx
+++ b/apps/desktop/src/app/chat/composer/attachments.test.tsx
@@ -34,21 +34,6 @@ describe('AttachmentList', () => {
vi.restoreAllMocks()
})
- it('renders valid attachments', async () => {
- const attachments = [makeAttachment('a', 'doc.pdf'), makeAttachment('b', 'img.png')]
- await renderWithI18n(<AttachmentList attachments={attachments} />)
- expect(screen.getByText('doc.pdf')).toBeDefined()
- expect(screen.getByText('img.png')).toBeDefined()
- })
-
- it('renders empty list without error', async () => {
- const { container } = await renderWithI18n(<AttachmentList attachments={[]} />)
-
- const attachmentList = container.querySelector('[data-slot="composer-attachments"]')
-
- expect(attachmentList).toBeDefined()
- })
-
it('does not crash when attachments array contains undefined entries', async () => {
// Repro: session switch can leave stale/undefined entries in the
// attachments array, causing a TypeError at attachment.refText.
@@ -65,14 +50,6 @@ describe('AttachmentList', () => {
expect(screen.getByText('also-good.png')).toBeDefined()
})
- it('does not crash when attachments array contains null entries', async () => {
- const attachments = [null as unknown as ComposerAttachment, makeAttachment('a', 'valid.txt')]
-
- await expect(renderWithI18n(<AttachmentList attachments={attachments} />)).resolves.toBeTruthy()
-
- expect(screen.getByText('valid.txt')).toBeDefined()
- })
-
it('renders the thumbnail in the pill but opens the full-resolution image in the lightbox', async () => {
$previewTabs.set([])
diff --git a/apps/desktop/src/app/chat/composer/composer-text-guard.test.tsx b/apps/desktop/src/app/chat/composer/composer-text-guard.test.tsx
deleted file mode 100644
index 6c598c5a8fa..00000000000
--- a/apps/desktop/src/app/chat/composer/composer-text-guard.test.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-// @vitest-environment jsdom
-import { act, cleanup, render } from '@testing-library/react'
-import { useCallback, useRef } from 'react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-afterEach(cleanup)
-
-// Regression repro for #49903: on desktop v0.17.0 the composer threw an
-// uncaught `Error: Composer is not available` at startup and the input went
-// unresponsive. The throw comes from @assistant-ui/core's composer-runtime —
-// every *mutator* (setText/send/…) does `if (!core) throw new Error("Composer
-// is not available")` when the thread's composer core isn't bound yet. Unlike
-// the read path (`s.composer.text`, which is null-safe: `runtime?.text ?? ""`),
-// the mutators have no graceful fallback. ChatBar's mount-time effects (draft
-// restore, clearDraft, external inserts) push text via `aui.composer().setText`
-// before the core binds, and the popout refactor (#49488) widened that window,
-// so the throw surfaced as an uncaught error that wedged the input.
-//
-// The fix wraps every `aui.composer().setText` call in a `setComposerText`
-// helper that swallows the unbound-core throw — the contentEditable DOM +
-// draftRef already hold the text and the draft⇄editor sync re-applies it once
-// the core attaches, so nothing is lost. This Harness mirrors that helper
-// faithfully (same try/catch shape) over a fake `aui` whose composer can be
-// toggled bound/unbound, the way the assistant-ui runtime behaves across mount.
-
-interface FakeComposer {
- setText: (value: string) => void
-}
-
-// Mirror of index.tsx's `useAui()` composer surface: composer() returns a
-// runtime whose setText throws exactly like @assistant-ui/core when unbound.
-function makeFakeAui(bound: { current: boolean }, applied: string[]) {
- const composer: FakeComposer = {
- setText(value: string) {
- if (!bound.current) {
- throw new Error('Composer is not available')
- }
-
- applied.push(value)
- }
- }
-
- return { composer: () => composer }
-}
-
-function Harness({
- bound,
- applied,
- onError
-}: {
- applied: string[]
- bound: { current: boolean }
- onError: (err: unknown) => void
-}) {
- const aui = useRef(makeFakeAui(bound, applied)).current
-
- // Verbatim mirror of the production `setComposerText` helper in index.tsx.
- const setComposerText = useCallback(
- (value: string) => {
- try {
- aui.composer().setText(value)
- } catch {
- // Composer core not bound yet — swallow so the input stays usable.
- }
- },
- [aui]
- )
-
- // A draft-restore-on-mount that fires while the core may still be unbound,
- // exactly like loadIntoComposer/clearDraft do on startup.
- try {
- setComposerText('restored draft')
- } catch (err) {
- onError(err)
- }
-
- return null
-}
-
-describe('setComposerText guard (#49903)', () => {
- it('swallows the unbound-core throw at startup instead of crashing the renderer', () => {
- const applied: string[] = []
- const bound = { current: false }
- const onError = vi.fn()
-
- expect(() => render(<Harness applied={applied} bound={bound} onError={onError} />)).not.toThrow()
-
- // The guard absorbed the throw — nothing escaped to the renderer, and no
- // assistant-ui write landed (core was unbound).
- expect(onError).not.toHaveBeenCalled()
- expect(applied).toEqual([])
- })
-
- it('writes through to the composer once the core is bound', () => {
- const applied: string[] = []
- const bound = { current: true }
- const onError = vi.fn()
-
- act(() => {
- render(<Harness applied={applied} bound={bound} onError={onError} />)
- })
-
- expect(onError).not.toHaveBeenCalled()
- expect(applied).toEqual(['restored draft'])
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/composer-utils.test.ts b/apps/desktop/src/app/chat/composer/composer-utils.test.ts
index b14dd9615c6..d55d88c04f0 100644
--- a/apps/desktop/src/app/chat/composer/composer-utils.test.ts
+++ b/apps/desktop/src/app/chat/composer/composer-utils.test.ts
@@ -7,7 +7,6 @@ import {
isPendingDraftPersistCurrent,
liveComposerDraft,
type PendingDraftPersist,
- pickPlaceholder,
shouldDisableComposerInput,
slashArgStage,
slashChipKindForItem,
@@ -140,13 +139,6 @@ describe('implicitSlashAcceptIndex', () => {
})
})
-describe('pickPlaceholder', () => {
- it('returns a member of the pool', () => {
- const pool = ['a', 'b', 'c'] as const
- expect(pool).toContain(pickPlaceholder(pool))
- })
-})
-
describe('isPendingDraftPersistCurrent (#54527 integrity guard)', () => {
it('accepts a write when the pending entry still matches what was captured', () => {
const entry: PendingDraftPersist = { scope: 'session-a', text: 'hello' }
diff --git a/apps/desktop/src/app/chat/composer/controls.test.tsx b/apps/desktop/src/app/chat/composer/controls.test.tsx
index c0d82a718f5..ac96d645c42 100644
--- a/apps/desktop/src/app/chat/composer/controls.test.tsx
+++ b/apps/desktop/src/app/chat/composer/controls.test.tsx
@@ -140,25 +140,7 @@ describe('narrow tiles', () => {
})
})
-// The controls row groups contributed actions with the send cluster in one
-// right-aligned sub-group — the row owns the ml-auto margin. If the cluster kept
-// its own auto margin, it would pin itself right and orphan a contributed
-// action at the row start when the row stacks (#116332).
-describe('contributed-actions grouping', () => {
- it('leaves right-alignment to the controls row instead of pushing itself with ml-auto', () => {
- const { container } = renderControls()
-
- expect(container.firstElementChild?.classList.contains('ml-auto')).toBe(false)
- })
-})
-
describe('ComposerControls shortcut tooltips', () => {
- it('shows Enter for Send', async () => {
- renderControls()
-
- await expectShortcutTooltip('Send', '↵')
- })
-
it('keeps Send (not Steer) while a turn is running if there is a payload', async () => {
renderControls({ busy: true, busyAction: 'steer' })
diff --git a/apps/desktop/src/app/chat/composer/fallback.test.tsx b/apps/desktop/src/app/chat/composer/fallback.test.tsx
deleted file mode 100644
index 0643b53769a..00000000000
--- a/apps/desktop/src/app/chat/composer/fallback.test.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { render } from '@testing-library/react'
-import { describe, expect, it } from 'vitest'
-
-import { composerInputBacking } from '@/components/chat/composer-dock'
-
-import { ChatBarFallback } from './index'
-
-describe('ChatBarFallback', () => {
- it('paints the shared composerInputBacking layer', () => {
- const { container } = render(<ChatBarFallback />)
- const paint = container.querySelector<HTMLElement>('[aria-hidden="true"]')
-
- expect(paint?.className).toBe(composerInputBacking)
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-metrics.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-metrics.test.tsx
index cf082d02026..da9661c0fc0 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-metrics.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-metrics.test.tsx
@@ -107,16 +107,4 @@ describe('useComposerMetrics — published clearance survives an effect replay',
expect(surface.style.getPropertyValue(COMPOSER_HEIGHT_VAR)).toBe('200px')
expect(surface.style.getPropertyValue(COMPOSER_SURFACE_HEIGHT_VAR)).toBe('120px')
})
-
- it('skips the write when the bucketed height is unchanged within one mount', () => {
- const { container } = render(<Harness dockHeight={200} surfaceHeight={120} />)
-
- deliverResize()
-
- const setProperty = vi.spyOn(surfaceOf(container).style, 'setProperty')
-
- deliverResize()
-
- expect(setProperty).not.toHaveBeenCalled()
- })
})
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
index 74be58ba866..fb31b3f7d79 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-submit.test.tsx
@@ -442,18 +442,6 @@ describe('useComposerSubmit busy-turn routing', () => {
expect(queueCurrentDraft).not.toHaveBeenCalled()
expect(onCancel).not.toHaveBeenCalled()
})
-
- it('threads the loaded composer scope through onSubmit for the #59305 submit-time guard', async () => {
- const { hook, onSubmit } = renderSubmitHook({ text: 'hello' })
-
- act(() => {
- hook.result.current.submitDraft()
- })
-
- await waitFor(() =>
- expect(onSubmit).toHaveBeenCalledWith('hello', expect.objectContaining({ composerScope: 'stored-session' }))
- )
- })
})
describe('useComposerSubmit with a clarify parked on the session', () => {
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-undo.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-undo.test.tsx
index c687d310e45..e1c9170dd14 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-undo.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-undo.test.tsx
@@ -1,6 +1,6 @@
import { render } from '@testing-library/react'
import { createRef, type RefObject } from 'react'
-import { describe, expect, it, vi } from 'vitest'
+import { describe, expect, it } from 'vitest'
import { placeCaretAtEnd } from '../test-utils'
@@ -169,18 +169,4 @@ describe('useComposerUndo', () => {
view.unmount()
editor.remove()
})
-
- it('is inert when the editor ref is empty', () => {
- const ref = createRef<HTMLDivElement>() as RefObject<HTMLDivElement | null>
- const sync = vi.fn(() => '')
-
- const { api, view } = mountUndo(ref, sync)
-
- api.current!.recordUndoPoint()
-
- expect(api.current!.undo()).toBe(false)
- expect(sync).not.toHaveBeenCalled()
-
- view.unmount()
- })
})
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-voice-stream-subscription.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-composer-voice-stream-subscription.test.tsx
deleted file mode 100644
index 3179c22ec4d..00000000000
--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-voice-stream-subscription.test.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import { act, renderHook } from '@testing-library/react'
-import { beforeEach, expect, test, vi } from 'vitest'
-
-const mocks = await vi.hoisted(async () => {
- const { atom } = await import('nanostores')
- const messages = atom<unknown[]>([])
-
- const useVoiceConversation = vi.fn(() => ({
- end: vi.fn(async () => undefined),
- level: 0,
- muted: false,
- start: vi.fn(async () => undefined),
- status: 'idle' as const,
- stopTurn: vi.fn(),
- toggleMute: vi.fn()
- }))
-
- return { messages, useVoiceConversation }
-})
-
-vi.mock('@/i18n', () => ({
- useI18n: () => ({
- t: {
- assistant: { thread: { readAloudFailed: 'read aloud failed' } },
- notifications: { voice: { sayStopToEnd: (phrase: string) => phrase } },
- settings: { config: { autosaveFailed: 'autosave failed' } }
- }
- })
-}))
-vi.mock('../scope', () => ({
- useComposerScope: () => ({ $messages: mocks.messages }),
- useComposerSurfaceId: () => null
-}))
-vi.mock('./use-voice-conversation', () => ({ useVoiceConversation: mocks.useVoiceConversation }))
-vi.mock('./use-voice-recorder', () => ({
- useVoiceRecorder: () => ({ dictate: vi.fn(), voiceActivityState: null, voiceStatus: 'idle' })
-}))
-vi.mock('./use-auto-speak-replies', () => ({ useAutoSpeakReplies: vi.fn() }))
-vi.mock('@/lib/haptics', () => ({ triggerHaptic: vi.fn() }))
-vi.mock('@/lib/wake-indicator', () => ({
- clearWakeIndicator: vi.fn(),
- syncWakeIndicatorWithVoice: vi.fn(() => false)
-}))
-vi.mock('@/store/ambient', () => ({ ownsAmbientCue: vi.fn(async () => true) }))
-vi.mock('@/store/notifications', () => ({ notify: vi.fn(), notifyError: vi.fn() }))
-vi.mock('@/store/wake-word', () => ({
- resumeWakeAfterVoice: vi.fn(async () => undefined),
- stopClientCapture: vi.fn(async () => undefined)
-}))
-
-import { useComposerVoice } from './use-composer-voice'
-
-beforeEach(() => {
- mocks.messages.set([])
- mocks.useVoiceConversation.mockClear()
-})
-
-test('re-renders once when an in-progress assistant reply first becomes speakable', () => {
- renderHook(() =>
- useComposerVoice({
- busy: true,
- clearDraft: vi.fn(),
- disabled: false,
- focusInput: vi.fn(),
- insertText: vi.fn(),
- maxRecordingSeconds: 60,
- onSubmit: vi.fn(async () => true),
- onTranscribeAudio: vi.fn(async () => ''),
- sessionId: 'voice-session',
- target: 'main'
- })
- )
-
- const callsBeforeDelta = mocks.useVoiceConversation.mock.calls.length
-
- act(() => {
- mocks.messages.set([
- {
- id: 'assistant-stream',
- pending: true,
- role: 'assistant',
- parts: [{ type: 'text', text: 'Natural selection is' }]
- }
- ])
- })
-
- const callsAfterFirstDelta = mocks.useVoiceConversation.mock.calls.length
- expect(callsAfterFirstDelta).toBeGreaterThan(callsBeforeDelta)
-
- act(() => {
- mocks.messages.set([
- {
- id: 'assistant-stream',
- pending: true,
- role: 'assistant',
- parts: [{ type: 'text', text: 'Natural selection is the differential survival.' }]
- }
- ])
- })
-
- expect(mocks.useVoiceConversation).toHaveBeenCalledTimes(callsAfterFirstDelta)
-})
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
index 518090d96cc..4cc1ec9f81d 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
@@ -95,16 +95,6 @@ describe('useSlashCompletions', () => {
expect(request).toHaveBeenCalledTimes(2)
})
- it('offers skill commands on a bare slash, not just built-ins', async () => {
- const request = vi.fn().mockResolvedValue(CATALOG)
- const api = harness({ request } as unknown as HermesGateway)
-
- const items = await completions(api, '')
- const work = items.find(item => (item.metadata as { command?: string })?.command === '/work')
-
- expect((work?.metadata as { group?: string })?.group).toBe('Skills')
- })
-
// A `/` typed mid-message is a reference dropped into prose, so the trigger
// filters the list to skills (use-composer-trigger). A bare mid-message `/`
// resolves to the same empty query as an opening `/`, so that filter runs
diff --git a/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx b/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx
deleted file mode 100644
index 79febaa0de8..00000000000
--- a/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx
+++ /dev/null
@@ -1,197 +0,0 @@
-import { act, cleanup, fireEvent, render } from '@testing-library/react'
-import { useRef, useState } from 'react'
-import { afterEach, describe, expect, it } from 'vitest'
-
-// No global setupFiles registers auto-cleanup, so unmount between tests —
-// otherwise a second render() leaks the first editor and getByTestId('editor')
-// matches multiple nodes.
-afterEach(cleanup)
-
-// Faithful mirror of index.tsx's composer text wiring for IME input, driven
-// through REAL DOM composition + input events on a contentEditable.
-//
-// Regression repro for #39614: typing committed multi-character IME text (e.g.
-// Chinese "你好") used to leave the send button hidden. The input events fired
-// during composition carry uncommitted preedit text and are intentionally
-// skipped; Chromium then does NOT reliably emit a trailing input event after
-// compositionend on Windows IMEs, so the finalized text never reached composer
-// state and `hasPayload` stayed false until an unrelated edit forced a sync.
-// The fix flushes the live DOM text in onCompositionEnd.
-function Harness({ onPayload }: { onPayload: (hasPayload: boolean) => void }) {
- const editorRef = useRef<HTMLDivElement>(null)
- const composingRef = useRef(false)
- const draftRef = useRef('')
- const [draft, setDraft] = useState('')
-
- const flushEditorToDraft = (editor: HTMLDivElement) => {
- const next = editor.textContent ?? ''
-
- if (next !== draftRef.current) {
- draftRef.current = next
- setDraft(next)
- }
- }
-
- onPayload(draft.trim().length > 0)
-
- return (
- <div
- contentEditable
- data-testid="editor"
- onCompositionEnd={event => {
- composingRef.current = false
- flushEditorToDraft(event.currentTarget)
- }}
- onCompositionStart={() => {
- composingRef.current = true
- }}
- onInput={event => {
- if (composingRef.current) {
- return
- }
-
- flushEditorToDraft(event.currentTarget)
- }}
- ref={editorRef}
- suppressContentEditableWarning
- />
- )
-}
-
-describe('composer IME composition — send button visibility (#39614)', () => {
- it('shows the send button after committing CJK text without a trailing edit', async () => {
- let hasPayload = false
- const { getByTestId } = render(<Harness onPayload={p => (hasPayload = p)} />)
- const editor = getByTestId('editor')
-
- // Compose "你好" the way a Windows Chinese IME does: compositionstart, then
- // input events carrying uncommitted preedit text, then compositionend with
- // the committed text already in the DOM — and crucially NO input event
- // afterwards.
- await act(async () => {
- fireEvent.compositionStart(editor)
- editor.textContent = '你'
- fireEvent.input(editor)
- editor.textContent = '你好'
- fireEvent.input(editor)
- fireEvent.compositionEnd(editor)
- })
-
- // Before the fix this was false (button hidden) until a further edit.
- expect(hasPayload).toBe(true)
- expect(editor.textContent).toBe('你好')
- })
-
- it('also covers Japanese/Korean and any IME-composed script', async () => {
- let hasPayload = false
- const { getByTestId } = render(<Harness onPayload={p => (hasPayload = p)} />)
- const editor = getByTestId('editor')
-
- for (const committed of ['こんにちは', '안녕하세요']) {
- await act(async () => {
- fireEvent.compositionStart(editor)
- editor.textContent = committed
- fireEvent.input(editor)
- fireEvent.compositionEnd(editor)
- })
-
- expect(hasPayload).toBe(true)
-
- // Clear for the next script.
- await act(async () => {
- editor.textContent = ''
- fireEvent.input(editor)
- })
- expect(hasPayload).toBe(false)
- }
- })
-
- it('blocks Enter with keyCode 229 even after compositionend (macOS Chinese IME)', async () => {
- let submitCount = 0
- let hasPayload = false
-
- function KeyDownHarness({ onPayload }: { onPayload: (hasPayload: boolean) => void }) {
- const editorRef = useRef<HTMLDivElement>(null)
- const composingRef = useRef(false)
- const draftRef = useRef('')
- const [draft, setDraft] = useState('')
-
- const flushEditorToDraft = (editor: HTMLDivElement) => {
- const next = editor.textContent ?? ''
-
- if (next !== draftRef.current) {
- draftRef.current = next
- setDraft(next)
- }
- }
-
- onPayload(draft.trim().length > 0)
-
- const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
- if (composingRef.current || event.nativeEvent.isComposing) {
- return
- }
-
- if (event.key === 'Enter' && event.keyCode === 229) {
- return
- }
-
- if (event.key === 'Enter' && !event.shiftKey) {
- event.preventDefault()
- submitCount++
- }
- }
-
- return (
- <div
- contentEditable
- data-testid="editor"
- onCompositionEnd={event => {
- composingRef.current = false
- flushEditorToDraft(event.currentTarget)
- }}
- onCompositionStart={() => {
- composingRef.current = true
- }}
- onInput={event => {
- if (composingRef.current) {
- return
- }
-
- flushEditorToDraft(event.currentTarget)
- }}
- onKeyDown={handleKeyDown}
- ref={editorRef}
- suppressContentEditableWarning
- />
- )
- }
-
- const { getByTestId } = render(<KeyDownHarness onPayload={p => (hasPayload = p)} />)
- const editor = getByTestId('editor')
-
- // Simulate macOS Chinese IME: compositionend fires, then Enter with keyCode 229.
- await act(async () => {
- fireEvent.compositionStart(editor)
- editor.textContent = '测试'
- fireEvent.input(editor)
- fireEvent.compositionEnd(editor)
- })
-
- expect(hasPayload).toBe(true)
-
- // This Enter must NOT trigger submit.
- await act(async () => {
- fireEvent.keyDown(editor, { key: 'Enter', keyCode: 229 })
- })
-
- expect(submitCount).toBe(0)
-
- // A normal Enter afterwards should still submit.
- await act(async () => {
- fireEvent.keyDown(editor, { key: 'Enter', keyCode: 13 })
- })
-
- expect(submitCount).toBe(1)
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/inline-reference-cascade.test.ts b/apps/desktop/src/app/chat/composer/inline-reference-cascade.test.ts
deleted file mode 100644
index 939824f7913..00000000000
--- a/apps/desktop/src/app/chat/composer/inline-reference-cascade.test.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-// @vitest-environment node
-import { dirname } from 'node:path'
-import { fileURLToPath } from 'node:url'
-
-import { compile } from '@tailwindcss/node'
-import { describe, expect, it } from 'vitest'
-
-const SRC = dirname(fileURLToPath(import.meta.url))
-
-/**
- * Every inline reference is `class="ref"` plus an optional `data-ref="<kind>"`,
- * and styles.css owns the colour (see the INLINE REFERENCES block). The kind
- * rules (`[data-ref='agent']`, `[data-ref='skill']`, …) and the `.ref` fallback
- * share specificity (0,1,0), so the cascade is decided by source order alone:
- * a fallback declaring `--ref-color` AFTER the kind rules silently repaints
- * every kinded reference — a Bot Mode @mention, a `/skill`, an `@file:` — in
- * the raw primary (#114612). This resolves the cascade for a real element the
- * way the browser does, so the invariant is about the rendered colour, not
- * about where a line happens to sit in the file.
- */
-interface Rule {
- body: string
- selectors: string[]
-}
-
-/** Unlayered top-level `selector { … }` rules, in source order. */
-async function topLevelRules(): Promise<Rule[]> {
- const { build } = await compile('@import "../../../styles.css";\n', { base: SRC, onDependency() {} })
- const css = build([]).replace(/\/\*[\s\S]*?\*\//g, '')
- const rules: Rule[] = []
- let depth = 0
- let start = 0
-
- for (let i = 0; i < css.length; i += 1) {
- if (css[i] === '{') {
- if (depth === 0) {
- start = i
- }
-
- depth += 1
- } else if (css[i] === '}') {
- depth -= 1
-
- if (depth === 0) {
- const prelude = css.slice(css.lastIndexOf('}', start) + 1, start).trim()
-
- if (!prelude.startsWith('@')) {
- rules.push({ body: css.slice(start + 1, i), selectors: prelude.split(',') })
- }
- }
- }
- }
-
- return rules
-}
-
-/** Specificity of one compound selector against `<x class="ref" data-ref={kind}>`, or null when it does not match. */
-function matches(selector: string, kind: string | null): number | null {
- const compound = selector.trim()
- const parts = compound.match(/\.ref|\[data-ref(?:=['"]?([\w-]+)['"]?)?\]/g)
-
- if (!parts || parts.join('') !== compound) {
- return null // combinators and other classes are outside the reference contract
- }
-
- for (const part of parts) {
- if (part === '.ref') {
- continue
- }
-
- const wanted = /=['"]?([\w-]+)/.exec(part)?.[1]
-
- if (kind === null || (wanted !== undefined && wanted !== kind)) {
- return null
- }
- }
-
- return parts.length // one class or attribute each
-}
-
-/** The `--ref-color` the browser resolves for `<span class="ref" data-ref={kind}>`. */
-function resolvedRefColor(rules: Rule[], kind: string | null): string | undefined {
- let winner: { specificity: number; value: string } | undefined
-
- for (const rule of rules) {
- const specificity = Math.max(-1, ...rule.selectors.map(s => matches(s, kind) ?? -1))
- // Tailwind emits a pre-`color-mix()` fallback first and the real value
- // inside a nested `@supports`; the browser this ships in takes the latter.
- const value = [...rule.body.matchAll(/--ref-color:\s*([^;]+);/g)].at(-1)?.[1].trim()
-
- // Equal specificity: the later rule wins.
- if (specificity >= 0 && value && (!winner || specificity >= winner.specificity)) {
- winner = { specificity, value }
- }
- }
-
- return winner?.value
-}
-
-describe('inline reference colour cascade', () => {
- it('lets every kind rule outrank the bare .ref fallback', async () => {
- const rules = await topLevelRules()
-
- // A kinded reference resolves to ITS hue, never to the raw primary.
- expect(resolvedRefColor(rules, 'agent')).toMatch(/^color-mix\(in srgb, var\(--ui-accent\)/)
- expect(resolvedRefColor(rules, 'human')).toMatch(/^color-mix\(in srgb, var\(--ui-warm\)/)
- expect(resolvedRefColor(rules, 'broadcast')).toMatch(/^color-mix\(in srgb, var\(--foreground\)/)
- expect(resolvedRefColor(rules, 'skill')).toMatch(/^color-mix\(in srgb, var\(--ui-warm\)/)
- expect(resolvedRefColor(rules, 'file')).toBe('var(--ui-text-secondary)')
- })
-
- it('keeps the primary link colour for an unkinded reference', async () => {
- const rules = await topLevelRules()
-
- expect(resolvedRefColor(rules, null)).toBe('var(--dt-primary)')
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/inline-references.test.ts b/apps/desktop/src/app/chat/composer/inline-references.test.ts
index 952f6bd85ad..6651ad0498f 100644
--- a/apps/desktop/src/app/chat/composer/inline-references.test.ts
+++ b/apps/desktop/src/app/chat/composer/inline-references.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { refAttrs, refAttrsHtml } from '@/components/assistant-ui/directive-text'
-import { REFERENCE_STYLES, referenceKind, referenceStyle } from '@/components/assistant-ui/reference-kinds'
+import { REFERENCE_STYLES, referenceKind } from '@/components/assistant-ui/reference-kinds'
/**
* There is ONE inline-reference system: `class="ref"` + `data-ref="<kind>"`.
@@ -28,16 +28,6 @@ describe('the inline reference contract', () => {
expect(referenceKind('wat')).toBe('other')
})
- it('ships no colour from TypeScript — the theme owns every accent', () => {
- // The whole point of keying on `data-ref`: a skin restyles all references
- // at once, and no hex or color-mix() is hardcoded in a component.
- for (const [kind, style] of Object.entries(REFERENCE_STYLES)) {
- expect(style, `${kind} must not carry a colour`).not.toHaveProperty('color')
- }
-
- expect(JSON.stringify(refAttrs('url'))).not.toMatch(/color|#[0-9a-f]{3}/i)
- })
-
it('gives every kind a glyph and a label', () => {
for (const [kind, style] of Object.entries(REFERENCE_STYLES)) {
expect(style.codicon, `${kind} codicon`).toBeTruthy()
@@ -49,24 +39,4 @@ describe('the inline reference contract', () => {
}
}
})
-
- it('keeps commands and skills visually distinct', () => {
- // Different data-ref values, so the stylesheet can accent them apart.
- expect(refAttrs('skill')['data-ref']).not.toBe(refAttrs('command')['data-ref'])
- expect(referenceStyle('skill').codicon).not.toBe(referenceStyle('command').codicon)
- })
-})
-
-describe('references are text, not badges', () => {
- it('carries no layout, padding, or background of its own', () => {
- // Everything visual lives in the stylesheet. If a component starts adding
- // its own chrome here, that's the drift this system exists to prevent.
- const { className } = refAttrs('file')
-
- expect(className).toBe('ref')
-
- for (const chrome of ['bg-', 'rounded', 'px-', 'py-', 'border', 'inline-flex', 'text-[']) {
- expect(className).not.toContain(chrome)
- }
- })
})
diff --git a/apps/desktop/src/app/chat/composer/native-text-replacements.test.tsx b/apps/desktop/src/app/chat/composer/native-text-replacements.test.tsx
deleted file mode 100644
index 1bb795c4ad2..00000000000
--- a/apps/desktop/src/app/chat/composer/native-text-replacements.test.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-// @vitest-environment jsdom
-import { AssistantRuntimeProvider, type ThreadMessageLike, useExternalStoreRuntime } from '@assistant-ui/react'
-import { cleanup, render } from '@testing-library/react'
-import { MemoryRouter } from 'react-router'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-import { I18nProvider } from '@/i18n'
-import { mainComposerScope } from '@/store/composer'
-
-import { RICH_INPUT_SLOT } from './rich-editor'
-import type { ChatBarState } from './types'
-
-import { ChatBar } from './index'
-
-const state: ChatBarState = {
- model: { canSwitch: false, model: '', provider: '' },
- tools: { enabled: false, label: '' },
- voice: { enabled: false, active: false }
-}
-
-function Harness() {
- const runtime = useExternalStoreRuntime({
- convertMessage: (message: ThreadMessageLike) => message,
- isRunning: false,
- messages: [] as ThreadMessageLike[],
- onNew: async () => {}
- })
-
- return (
- <AssistantRuntimeProvider runtime={runtime}>
- <MemoryRouter>
- <I18nProvider configClient={null} initialLocale="en">
- <ChatBar
- busy={false}
- disabled={false}
- gateway={null}
- onCancel={() => {}}
- onSubmit={async () => true}
- state={state}
- />
- </I18nProvider>
- </MemoryRouter>
- </AssistantRuntimeProvider>
- )
-}
-
-afterEach(() => {
- cleanup()
- mainComposerScope.clear()
- vi.restoreAllMocks()
-})
-
-describe('native composer text replacements', () => {
- it.each([
- ['MacIntel', 'on'],
- ['Win32', 'off'],
- ['Linux x86_64', 'off']
- ])('admits macOS substitutions without enabling spellcheck on %s', (platform, autocorrect) => {
- vi.spyOn(navigator, 'platform', 'get').mockReturnValue(platform)
- const { container } = render(<Harness />)
- const editor = container.querySelector(`[data-slot="${RICH_INPUT_SLOT}"]`)!
-
- expect(editor.getAttribute('autocorrect')).toBe(autocorrect)
- expect(editor.getAttribute('spellcheck')).toBe('false')
- expect(editor.getAttribute('autocapitalize')).toBe('off')
- expect(container.querySelector('textarea[aria-hidden]')?.getAttribute('autocorrect')).toBe('off')
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/paste-url-is-text.test.tsx b/apps/desktop/src/app/chat/composer/paste-url-is-text.test.tsx
index 20146063f14..dcfa62a9776 100644
--- a/apps/desktop/src/app/chat/composer/paste-url-is-text.test.tsx
+++ b/apps/desktop/src/app/chat/composer/paste-url-is-text.test.tsx
@@ -123,22 +123,4 @@ describe('a pasted URL survives the paste', () => {
expect(onAttachPrCommentUrl).not.toHaveBeenCalled()
expect(event.defaultPrevented).toBe(true)
})
-
- it('treats it exactly like a plain URL paste — same insertion, no attachment', () => {
- const onAttachPrCommentUrl = vi.fn(() => true)
- const plain = render(<Harness onAttachPrCommentUrl={onAttachPrCommentUrl} />)
- const deep = render(<Harness onAttachPrCommentUrl={onAttachPrCommentUrl} />)
-
- const plainEditor = plain.container.querySelector<HTMLElement>(`[data-slot="${RICH_INPUT_SLOT}"]`)!
- const deepEditor = deep.container.querySelector<HTMLElement>(`[data-slot="${RICH_INPUT_SLOT}"]`)!
-
- pasteInto(plainEditor, 'https://github.com/o/r/pull/1')
- pasteInto(deepEditor, PR_COMMENT_URL)
-
- // Same shape of result for both URLs: the text is present, nothing is attached.
- expect(composerPlainText(plainEditor)).toContain('https://github.com/o/r/pull/1')
- expect(composerPlainText(deepEditor)).toContain(PR_COMMENT_URL)
- expect(mainComposerScope.$attachments.get()).toEqual([])
- expect(onAttachPrCommentUrl).not.toHaveBeenCalled()
- })
})
diff --git a/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx b/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
index 1498f46f410..c08af916493 100644
--- a/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
+++ b/apps/desktop/src/app/chat/composer/reasoning-pill.test.tsx
@@ -41,8 +41,7 @@ afterEach(() => {
describe('ReasoningPill', () => {
it('shows a clamped pick as what the route sends, never as a distinct level (#61634)', () => {
- // The gateway says this route clamps `ultra` to `max`: compact "Ultra→Max",
- // tooltip in the CLI's `/reasoning` wording.
+ // The gateway says this route clamps `ultra` to `max`: compact "Ultra→Max".
const { unmount } = render(
<SessionViewProvider value={tileView('ultra', 'max')}>
<ReasoningPill disabled={false} model={modelState()} />
@@ -52,7 +51,6 @@ describe('ReasoningPill', () => {
const pill = screen.getByTestId('reasoning-pill')
expect(pill.textContent).toBe('Ultra→Max')
- expect(pill.getAttribute('aria-label')).toBe('Effort: Ultra (sends Max on this route)')
unmount()
// A verbatim wire level (or one the gateway has not stamped yet) makes no claim.
@@ -63,7 +61,6 @@ describe('ReasoningPill', () => {
)
expect(screen.getByTestId('reasoning-pill').textContent).toBe('High')
- expect(screen.getByTestId('reasoning-pill').getAttribute('aria-label')).toBe('Effort: High')
})
it("shows THIS surface's live effort, falling back to the profile default when the session has none", () => {
diff --git a/apps/desktop/src/app/chat/composer/slash-nav-dom-repro.test.tsx b/apps/desktop/src/app/chat/composer/slash-nav-dom-repro.test.tsx
deleted file mode 100644
index d2f7f8fef90..00000000000
--- a/apps/desktop/src/app/chat/composer/slash-nav-dom-repro.test.tsx
+++ /dev/null
@@ -1,186 +0,0 @@
-import type { Unstable_TriggerAdapter, Unstable_TriggerItem } from '@assistant-ui/core'
-import { act, fireEvent, render } from '@testing-library/react'
-import { useCallback, useEffect, useRef, useState } from 'react'
-import { describe, expect, it, vi } from 'vitest'
-
-import { useLiveCompletionAdapter } from './hooks/use-live-completion-adapter'
-import { detectTrigger, type TriggerState } from './text-utils'
-
-// Faithful mirror of index.tsx's trigger wiring, driven through REAL DOM
-// keydown+keyup events on a contentEditable. Exercises the parts a direct
-// reducer-call repro misses: the keyup -> refreshTrigger path, the
-// keydown-set "consumed" ref that guards it, and per-press keydown+keyup
-// ordering (critical for Escape, whose keydown nulls `trigger` before keyup).
-function Harness({
- onState
-}: {
- onState: (s: { active: number; items: readonly Unstable_TriggerItem[]; open: boolean }) => void
-}) {
- const editorRef = useRef<HTMLDivElement>(null)
- const triggerKeyConsumedRef = useRef(false)
- const [trigger, setTrigger] = useState<TriggerState | null>(null)
- const [triggerActive, setTriggerActive] = useState(0)
- const [triggerItems, setTriggerItems] = useState<readonly Unstable_TriggerItem[]>([])
-
- const { adapter } = useLiveCompletionAdapter({
- enabled: true,
- debounceMs: 0,
- fetcher: async (query: string) => ({
- query,
- items: Array.from({ length: 5 }, (_, i) => ({ text: `/cmd${i}`, display: `/cmd${i}`, meta: '' }))
- }),
- toItem: (entry, index) => ({ id: `${entry.text}|${index}`, type: 'slash', label: entry.text.slice(1) })
- })
-
- const triggerAdapter: Unstable_TriggerAdapter | null = trigger?.kind === '/' ? adapter : null
-
- const refreshTrigger = useCallback(() => {
- const editor = editorRef.current
-
- if (!editor) {
- return
- }
-
- const raw = editor.textContent ?? ''
-
- if (!raw.includes('@') && !raw.includes('/')) {
- if (trigger) {
- setTrigger(null)
- setTriggerActive(0)
- }
-
- return
- }
-
- const detected = detectTrigger(raw)
- setTrigger(detected)
-
- if (detected?.kind !== trigger?.kind || detected?.query !== trigger?.query) {
- setTriggerActive(0)
- }
- }, [trigger])
-
- useEffect(() => {
- if (!trigger || !triggerAdapter?.search) {
- setTriggerItems([])
-
- return
- }
-
- setTriggerItems(triggerAdapter.search(trigger.query))
- }, [trigger, triggerAdapter])
-
- useEffect(() => {
- setTriggerActive(idx => Math.min(idx, Math.max(0, triggerItems.length - 1)))
- }, [triggerItems.length])
-
- onState({ active: triggerActive, items: triggerItems, open: trigger !== null })
-
- const closeTrigger = () => {
- setTrigger(null)
- setTriggerItems([])
- setTriggerActive(0)
- }
-
- // Exact copies of index.tsx handlers, including the keydown-set "consumed"
- // ref that the keyup consults.
- const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
- if (trigger && triggerItems.length > 0) {
- if (event.key === 'ArrowDown') {
- event.preventDefault()
- triggerKeyConsumedRef.current = true
- setTriggerActive(idx => (idx + 1) % triggerItems.length)
-
- return
- }
-
- if (event.key === 'ArrowUp') {
- event.preventDefault()
- triggerKeyConsumedRef.current = true
- setTriggerActive(idx => (idx - 1 + triggerItems.length) % triggerItems.length)
-
- return
- }
-
- if (event.key === 'Escape') {
- event.preventDefault()
- triggerKeyConsumedRef.current = true
- closeTrigger()
-
- return
- }
- }
- }
-
- const handleKeyUp = () => {
- if (triggerKeyConsumedRef.current) {
- triggerKeyConsumedRef.current = false
-
- return
- }
-
- // index.tsx defers via setTimeout(refreshTrigger, 0); call synchronously
- // here so the test deterministically observes the keyup-driven refresh.
- refreshTrigger()
- }
-
- return (
- <div
- contentEditable
- data-testid="editor"
- onInput={() => refreshTrigger()}
- onKeyDown={handleKeyDown}
- onKeyUp={handleKeyUp}
- ref={editorRef}
- suppressContentEditableWarning
- />
- )
-}
-
-async function flush() {
- await act(async () => {
- await new Promise(r => setTimeout(r, 20))
- })
-}
-
-describe('slash menu navigation — real DOM keydown+keyup', () => {
- it('cycles through ALL items and Esc closes (and stays closed)', async () => {
- vi.useRealTimers()
- let latest = { active: 0, items: [] as readonly Unstable_TriggerItem[], open: false }
- const { getByTestId } = render(<Harness onState={s => (latest = s)} />)
- const editor = getByTestId('editor')
-
- // Simulate typing '/'.
- await act(async () => {
- editor.textContent = '/'
- fireEvent.input(editor)
- })
- await flush()
-
- expect(latest.open).toBe(true)
- expect(latest.items.length).toBe(5)
-
- // ArrowDown 6x with REAL keydown+keyup pairs. Bug = stuck [0,1,0,1,...].
- const seen: number[] = [latest.active]
-
- for (let i = 0; i < 6; i++) {
- await act(async () => {
- fireEvent.keyDown(editor, { key: 'ArrowDown' })
- fireEvent.keyUp(editor, { key: 'ArrowDown' })
- await Promise.resolve()
- })
- seen.push(latest.active)
- }
-
- expect(seen).toEqual([0, 1, 2, 3, 4, 0, 1])
-
- // Escape: keydown closes; keyup must NOT reopen (the '/' is still in text).
- await act(async () => {
- fireEvent.keyDown(editor, { key: 'Escape' })
- fireEvent.keyUp(editor, { key: 'Escape' })
- await Promise.resolve()
- })
- await flush()
- expect(latest.open).toBe(false)
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/status-stack/coding-row.test.tsx b/apps/desktop/src/app/chat/composer/status-stack/coding-row.test.tsx
index 8ba10644572..95065b2fe51 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/coding-row.test.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/coding-row.test.tsx
@@ -46,31 +46,6 @@ describe('CodingStatusRow', () => {
expect(onOpen).toHaveBeenCalledTimes(2)
})
- it('wraps the click targets without adding a layout box', () => {
- const { container } = render(<CodingStatusRow onOpen={() => undefined} repoPath="/repo" />)
-
- // `display: contents` is what keeps the branch label and the counts direct
- // flex children of the row — the hit areas cost nothing visually.
- expect(screen.getByText('bb/hitbox').parentElement?.classList.contains('contents')).toBe(true)
- expect(screen.getByText('12').closest('button')?.classList.contains('contents')).toBe(true)
- // The glyph button fills the row's existing 3.5 leading slot exactly.
- expect(container.querySelector('button[class~="size-3.5"]')).not.toBeNull()
- })
-
- it('parks the copy glyph against the end of the path, not the end of the row', () => {
- render(<CodingStatusRow onOpen={() => undefined} repoPath="/Users/someone/www/repo" />)
-
- const path = screen.getByText('~/www/repo')
-
- // The path sizes to its content and the glyph is its immediate sibling, so
- // the pair reads as one unit. `flex-1` belongs to the wrapper (which holds
- // the row's slack open) — on the label it stretched the text and pushed the
- // glyph out to the kebab.
- expect(path.classList.contains('flex-1')).toBe(false)
- expect(path.parentElement?.classList.contains('flex-1')).toBe(true)
- expect(path.nextElementSibling?.tagName).toBe('BUTTON')
- })
-
it('copies the absolute cwd inline — checkmark feedback, no toast', async () => {
const writeText = vi.fn().mockResolvedValue(undefined)
Object.defineProperty(navigator, 'clipboard', { configurable: true, value: { writeText } })
diff --git a/apps/desktop/src/app/chat/composer/status-stack/collapsed-indicator.test.tsx b/apps/desktop/src/app/chat/composer/status-stack/collapsed-indicator.test.tsx
index 6698d16e64a..0006c4ab25b 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/collapsed-indicator.test.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/collapsed-indicator.test.tsx
@@ -22,22 +22,6 @@ describe('ComposerStatusStack collapsed todo indicator', () => {
$todosBySession.set({})
})
- it('shows a running indicator while the todo group is expanded', () => {
- $todosBySession.set({
- 'session-1': [{ content: 'Wire the status stack', id: '1', status: 'in_progress' }]
- })
-
- render(
- <MemoryRouter>
- <ComposerStatusStack queue={null} sessionId="session-1" />
- </MemoryRouter>
- )
-
- expect(screen.getByText('Wire the status stack')).toBeTruthy()
- expect(screen.getAllByRole('status').length).toBeGreaterThan(0)
- expect(screen.getByText('Tasks 0/1')).toBeTruthy()
- })
-
it('shows a running indicator next to the collapsed todo label', () => {
$todosBySession.set({
'session-1': [{ content: 'Wire the status stack', id: '1', status: 'in_progress' }]
diff --git a/apps/desktop/src/app/chat/composer/status-stack/goal-indicator.test.tsx b/apps/desktop/src/app/chat/composer/status-stack/goal-indicator.test.tsx
index 9862f15a9bc..05451bf41b0 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/goal-indicator.test.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/goal-indicator.test.tsx
@@ -45,12 +45,6 @@ describe('ComposerStatusStack goal indicator', () => {
$goalsBySession.set({})
})
- it('renders nothing when the session has no goal', () => {
- const view = renderStack()
-
- expect(view.container.firstChild).toBeNull()
- })
-
it('shows an active goal with its title', () => {
$goalsBySession.set({ [SID]: goal('active') })
@@ -73,15 +67,6 @@ describe('ComposerStatusStack goal indicator', () => {
expect(screen.getByText('ship the feature')).toBeTruthy()
})
- it('shows the continuation detail line for an active goal', () => {
- $goalsBySession.set({ [SID]: goal('active', 'ship it', 'Continuing toward goal (3/20)') })
-
- renderStack()
-
- fireEvent.click(screen.getByRole('button', { name: /Goal active/ }))
- expect(screen.getByText('Continuing toward goal (3/20)')).toBeTruthy()
- })
-
it('scopes the indicator to the goal-owning session', () => {
$goalsBySession.set({ 'other-session': goal('active') })
diff --git a/apps/desktop/src/app/chat/composer/status-stack/index.test.tsx b/apps/desktop/src/app/chat/composer/status-stack/index.test.tsx
deleted file mode 100644
index 19849105039..00000000000
--- a/apps/desktop/src/app/chat/composer/status-stack/index.test.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { cleanup, render, screen } from '@testing-library/react'
-import { MemoryRouter } from 'react-router'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-
-import { I18nProvider } from '@/i18n'
-import { resetThreadScroll, setThreadAtBottom } from '@/store/thread-scroll'
-
-import { ComposerStatusStack } from './index'
-
-class TestResizeObserver {
- disconnect() {}
- observe() {}
- unobserve() {}
-}
-
-vi.stubGlobal('ResizeObserver', TestResizeObserver)
-
-describe('ComposerStatusStack scroll treatment', () => {
- beforeEach(() => {
- setThreadAtBottom(false, 'sess-a')
- })
-
- afterEach(() => {
- cleanup()
- resetThreadScroll('sess-a')
- })
-
- it('dims only the status content while keeping the dock card opaque', () => {
- const view = render(
- <MemoryRouter>
- <I18nProvider configClient={null} initialLocale="en">
- <ComposerStatusStack queue={<div>Queued task</div>} sessionId="sess-a" />
- <ComposerStatusStack queue={<div>Sibling task</div>} sessionId="sess-b" />
- </I18nProvider>
- </MemoryRouter>
- )
-
- const card = view.container.querySelector<HTMLElement>('[class*="bg-(--composer-fill)"]')
- const dimmedContent = screen.getByText('Queued task').closest<HTMLElement>('.opacity-30')
-
- expect(card).not.toBeNull()
- expect(card?.classList.contains('opacity-30')).toBe(false)
- expect(dimmedContent).not.toBeNull()
- expect(dimmedContent).not.toBe(card)
- expect(card?.contains(dimmedContent)).toBe(true)
- expect(screen.getByText('Sibling task').closest('.opacity-30')).toBeNull()
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/status-stack/preview-row.test.tsx b/apps/desktop/src/app/chat/composer/status-stack/preview-row.test.tsx
index 8caa0ed66a5..ff7384de8fd 100644
--- a/apps/desktop/src/app/chat/composer/status-stack/preview-row.test.tsx
+++ b/apps/desktop/src/app/chat/composer/status-stack/preview-row.test.tsx
@@ -19,29 +19,6 @@ describe('PreviewStatusRow', () => {
vi.restoreAllMocks()
})
- it('keeps the full path and hint in one portaled bubble beside the label', async () => {
- const view = render(
- <PreviewStatusRow
- item={{ cwd: 'C:\\repo', id: 'preview.html', label: 'preview.html', target: 'preview.html' }}
- onDismiss={() => undefined}
- />
- )
-
- fireEvent.pointerMove(screen.getByText('preview.html'), { pointerType: 'mouse' })
- await screen.findByRole('tooltip')
-
- const content = view.baseElement.querySelector<HTMLElement>('[data-slot="tooltip-content"]')
- const label = content?.querySelector('[data-slot="tooltip-label"]')
-
- expect(content).not.toBeNull()
- expect(view.container.contains(content)).toBe(false)
- expect(content?.classList.contains('tooltip-bubble')).toBe(true)
- expect(content?.getAttribute('data-side')).toBe('right')
- expect(label?.textContent).toContain('preview.html')
- expect(label?.querySelector('br')).not.toBeNull()
- expect(content?.querySelector('[data-slot="tooltip-arrow"]')).not.toBeNull()
- })
-
it('opens remote non-HTML file artifacts in the in-app preview instead of the local browser bridge', async () => {
const remotePath = '/home/agent/report.pdf'
const openPreviewInBrowser = vi.fn(async () => undefined)
diff --git a/apps/desktop/src/app/chat/composer/trigger-popover-parity.test.tsx b/apps/desktop/src/app/chat/composer/trigger-popover-parity.test.tsx
deleted file mode 100644
index e3f2ab08eba..00000000000
--- a/apps/desktop/src/app/chat/composer/trigger-popover-parity.test.tsx
+++ /dev/null
@@ -1,151 +0,0 @@
-import { render, screen } from '@testing-library/react'
-import { describe, expect, it, vi } from 'vitest'
-
-import { ComposerTriggerPopover } from './trigger-popover'
-
-vi.mock('@/i18n', () => ({
- useI18n: () => ({
- t: {
- composer: {
- lookupLoading: 'Loading…',
- lookupNoMatches: 'No matches',
- lookupTry: 'Try',
- lookupOr: 'or'
- }
- }
- })
-}))
-
-function atItem(type: string, display: string, rawText: string, meta = '') {
- return {
- id: `${rawText}|0`,
- type,
- label: display,
- metadata: { icon: type, display, meta, rawText, insertId: display }
- }
-}
-
-function slashItem(command: string, group: string, meta = '') {
- return {
- id: `${command}|0`,
- type: 'slash',
- label: command.slice(1),
- metadata: { command, display: command, meta, group, action: '', rawText: command }
- }
-}
-
-const noop = () => {}
-
-/** The rendered shape of one row: does it have an icon, and how is it laid out?
- * Icons are codicons — an `<i class="codicon codicon-<name>">`, not an SVG. */
-function rowShape(root: HTMLElement) {
- const row = root.querySelector('button') as HTMLElement
- const icon = row.querySelector('i.codicon')
-
- return {
- hasIcon: Boolean(icon),
- iconName: icon?.className.match(/codicon-([\w-]+)/)?.[1],
- classes: row.className
- }
-}
-
-describe('@ and / are one menu', () => {
- it('a slash row has an icon, just like an @ row', () => {
- const at = render(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[atItem('folder', 'apps/desktop/', '@folder:apps/desktop/', 'dir')]}
- kind="@"
- loading={false}
- onHover={noop}
- onPick={noop}
- />
- )
-
- const atShape = rowShape(at.container)
- at.unmount()
-
- const slash = render(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[slashItem('/work', 'Skills', 'Start in a worktree')]}
- kind="/"
- loading={false}
- onHover={noop}
- onPick={noop}
- />
- )
-
- const slashShape = rowShape(slash.container)
-
- // The whole point: `/` used to render a stacked, icon-less row.
- expect(slashShape.hasIcon).toBe(true)
- expect(atShape.hasIcon).toBe(true)
- expect(slashShape.classes).toBe(atShape.classes)
-
- // And the glyph reflects the kind, not one generic bullet.
- expect(slashShape.iconName).toBe('zap')
- expect(atShape.iconName).toBe('folder')
- })
-
- it('renders the name and description for both kinds', () => {
- const { rerender } = render(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[slashItem('/work', 'Skills', 'Start in a worktree')]}
- kind="/"
- loading={false}
- onHover={noop}
- onPick={noop}
- />
- )
-
- expect(screen.getByText('/work')).toBeTruthy()
- expect(screen.getByText('Start in a worktree')).toBeTruthy()
-
- rerender(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[atItem('file', 'src/main.tsx', '@file:src/main.tsx', 'src')]}
- kind="@"
- loading={false}
- onHover={noop}
- onPick={noop}
- />
- )
-
- expect(screen.getByText('src/main.tsx')).toBeTruthy()
- expect(screen.getByText('src')).toBeTruthy()
- })
-
- it('an emoji row stays icon-less — the emoji IS the icon', () => {
- const { container } = render(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[{ id: ':joy:|0', type: 'emoji', label: '😂 :joy:', metadata: { display: '😂 :joy:' } }]}
- kind=":"
- loading={false}
- onHover={noop}
- onPick={noop}
- />
- )
-
- expect(rowShape(container).hasIcon).toBe(false)
- })
-
- it('labels the active browse scope from the shared vocabulary', () => {
- render(
- <ComposerTriggerPopover
- activeIndex={0}
- items={[atItem('folder', 'apps/', '@folder:apps/', 'dir')]}
- kind="@"
- loading={false}
- onHover={noop}
- onPick={noop}
- scope="folder"
- />
- )
-
- expect(screen.getByText('Folders')).toBeTruthy()
- })
-})
diff --git a/apps/desktop/src/app/chat/composer/trigger-popover.test.tsx b/apps/desktop/src/app/chat/composer/trigger-popover.test.tsx
index 52a0df6ee9f..ada7631644d 100644
--- a/apps/desktop/src/app/chat/composer/trigger-popover.test.tsx
+++ b/apps/desktop/src/app/chat/composer/trigger-popover.test.tsx
@@ -5,26 +5,6 @@ import { I18nProvider } from '@/i18n'
import { ComposerTriggerPopover } from './trigger-popover'
-function renderPopover(kind: '@' | '/', loading = false) {
- const onHover = vi.fn()
- const onPick = vi.fn()
-
- const rendered = render(
- <I18nProvider configClient={null} initialLocale="zh">
- <ComposerTriggerPopover
- activeIndex={0}
- items={[]}
- kind={kind}
- loading={loading}
- onHover={onHover}
- onPick={onPick}
- />
- </I18nProvider>
- )
-
- return { ...rendered, onHover, onPick }
-}
-
function slashItem(command: string) {
return {
id: command,
@@ -62,33 +42,6 @@ afterEach(() => {
cleanup()
})
-describe('ComposerTriggerPopover i18n', () => {
- it('renders localized empty lookup copy for @ references', () => {
- const { container } = renderPopover('@')
-
- expect(screen.getByText('没有匹配项。')).toBeTruthy()
- expect(container.textContent).toContain('试试')
- expect(container.textContent).toContain('@file:')
- expect(container.textContent).toContain('或')
- expect(container.textContent).toContain('@folder:')
- })
-
- it('renders localized loading copy for slash commands', () => {
- renderPopover('/', true)
-
- // While loading the popover shows only the spinner + loading copy — the
- // `/help` empty-state hint is reserved for the resolved (not-loading) state.
- expect(screen.getByText('查找中…')).toBeTruthy()
- })
-
- it('renders the slash empty-state hint when not loading', () => {
- const { container } = renderPopover('/')
-
- expect(screen.getByText('没有匹配项。')).toBeTruthy()
- expect(container.textContent).toContain('/help')
- })
-})
-
describe('ComposerTriggerPopover keyboard scrolling', () => {
const items = [slashItem('/first'), slashItem('/second'), slashItem('/third')]
diff --git a/apps/desktop/src/app/chat/new-session-drag.test.ts b/apps/desktop/src/app/chat/new-session-drag.test.ts
index 2f47c53b1d2..7f87a8e1292 100644
--- a/apps/desktop/src/app/chat/new-session-drag.test.ts
+++ b/apps/desktop/src/app/chat/new-session-drag.test.ts
@@ -60,7 +60,6 @@ vi.mock('@/components/pane-shell/tree/model', async importOriginal => {
})
vi.mock('@/i18n', () => ({
- // Key-aware so each resolver's ghost label is pinned to its own string.
translateNow: (key: string) => (key === 'sidebar.projects.newButton' ? 'New project' : 'New session')
}))
@@ -107,11 +106,6 @@ describe('startNewSessionDrag', () => {
expect(setTreeDragging).toHaveBeenCalledWith(NEW_SESSION_DRAG)
})
- it('drops a ghost labelled like the New session row', () => {
- startNewSessionDrag(vi.fn(), fakePointerEvent())
- expect(captured.spec?.ghost).toEqual({ label: 'New session' })
- })
-
it('stacks a fresh tab on a center drop (never links — nothing to link yet)', () => {
const onCreate = vi.fn()
subZonePosition.mockReturnValue('center')
@@ -179,28 +173,6 @@ describe('startNewSessionDrag', () => {
expect(onCreate).not.toHaveBeenCalled()
})
- it('restores the source row opacity on end', () => {
- const event = fakePointerEvent()
-
- const source = event.currentTarget as unknown as {
- style: { opacity: string; setProperty: ReturnType<typeof vi.fn> }
- }
-
- startNewSessionDrag(vi.fn(), event)
- const spec = captured.spec!
-
- spec.onEngage(0, 0)
- expect(source.style.setProperty).toHaveBeenCalledWith('opacity', '0.45')
-
- spec.onEnd()
- expect(source.style.opacity).toBe('')
- })
-
- it('labels the ghost with the project name for a project-row drag', () => {
- startNewSessionDrag(vi.fn(), fakePointerEvent(), { cwd: '/repo', label: 'New session in Hermes Browser' })
- expect(captured.spec?.ghost).toEqual({ label: 'New session in Hermes Browser' })
- })
-
it('pins the created session to the project cwd on a center drop', () => {
const onCreate = vi.fn()
subZonePosition.mockReturnValue('center')
@@ -386,20 +358,6 @@ describe('startNewProjectDrag', () => {
expect(onArm).not.toHaveBeenCalled()
})
- it('clears the arm when released over a deny zone', () => {
- const onArm = vi.fn()
- const spec = engageProject(onArm)
-
- const hint = spec.resolveMove(5000, 5000, false)
-
- expect(hint).toBeNull()
-
- spec.onCommit(hint)
- spec.onEnd()
-
- expect(onArm).toHaveBeenLastCalledWith(null)
- })
-
it('does not clear a committed arm on drag end', () => {
const onArm = vi.fn()
subZonePosition.mockReturnValue('right')
@@ -412,9 +370,4 @@ describe('startNewProjectDrag', () => {
expect(onArm).toHaveBeenCalledOnce()
expect(onArm).not.toHaveBeenCalledWith(null)
})
-
- it('drops a ghost labelled like the New project control', () => {
- engageProject()
- expect(captured.spec?.ghost).toEqual({ label: 'New project' })
- })
})
diff --git a/apps/desktop/src/app/chat/profile-tag.test.tsx b/apps/desktop/src/app/chat/profile-tag.test.tsx
deleted file mode 100644
index a69b3283060..00000000000
--- a/apps/desktop/src/app/chat/profile-tag.test.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { cleanup, render, screen } from '@testing-library/react'
-import { atom } from 'nanostores'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-// Keep store/profile's side-effecting imports inert (gateway socket layer +
-// REST client) — same seam as store/profile.test.ts.
-vi.mock('@/store/gateway', () => ({
- $gateway: atom<unknown>(null),
- ensureGatewayForProfile: vi.fn(async () => undefined)
-}))
-vi.mock('@/hermes', () => ({
- getProfiles: vi.fn(async () => ({ profiles: [] })),
- setApiRequestProfile: vi.fn()
-}))
-vi.mock('@/lib/query-client', () => ({ queryClient: { invalidateQueries: vi.fn() } }))
-vi.mock('@/store/starmap', () => ({ resetStarmapGraph: vi.fn() }))
-
-const { ProfileTag } = await import('./profile-tag')
-const { setProfileColor } = await import('@/store/profile')
-
-afterEach(cleanup)
-
-describe('ProfileTag', () => {
- it('shows the profile initial with an accessible owner label', () => {
- render(<ProfileTag profile="xavier" />)
-
- const tag = screen.getByRole('img', { name: 'Profile: xavier' })
- expect(tag.textContent).toBe('x')
- })
-
- it('normalizes an empty profile to default, which shows the home glyph', () => {
- render(<ProfileTag profile="" />)
-
- const tag = screen.getByRole('img', { name: 'Profile: default' })
- // The default profile has no initial and no identity color — it is the
- // home icon, same as the profiles panel and the rail.
- expect(tag.textContent).toBe('')
- expect(tag.querySelector('.codicon-home')).not.toBeNull()
- expect(tag.style.color).toBe('')
- })
-
- it('uses the profile identity color (user override wins)', () => {
- setProfileColor('xavier', 'hsl(120 68% 58%)')
-
- render(<ProfileTag profile="xavier" />)
-
- const tag = screen.getByRole('img', { name: 'Profile: xavier' })
- // jsdom normalizes hsl() to rgb(); assert the override landed, not the format.
- expect(tag.style.color).toBe('rgb(75, 221, 75)')
- })
-})
diff --git a/apps/desktop/src/app/chat/right-rail/preview-act.test.ts b/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
index 81caf4405f9..bd82e2ac179 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
+++ b/apps/desktop/src/app/chat/right-rail/preview-act.test.ts
@@ -47,24 +47,6 @@ describe('actOnActivePreview (drive_preview tool)', () => {
expect(result.error).toContain('open_preview')
})
- it('injects the engine and returns the page’s answer', async () => {
- let injected = ''
-
- withRunner(async code => {
- injected = code
-
- return JSON.stringify({ acted: 'clicked button "Save"', success: true })
- })
-
- const result = await actOnActivePreview({ kind: 'click', ref: '@e1' })
-
- expect(result).toMatchObject({ acted: 'clicked button "Save"', success: true })
- // Self-contained payload: the engine source and the action travel together,
- // and the holder keeps refs alive across calls on the same page.
- expect(injected).toContain('__hermesActHolder')
- expect(injected).toContain('"ref":"@e1"')
- })
-
it('re-inventories after a mutating action so the next ref is current', async () => {
const actions: string[] = []
@@ -89,19 +71,6 @@ describe('actOnActivePreview (drive_preview tool)', () => {
expect(result.url).toBe('https://example.com/app')
})
- it('does not pay the settle delay for a plain inventory', async () => {
- let injected = ''
- withRunner(async code => {
- injected = code
-
- return JSON.stringify({ elements: [], success: true })
- })
-
- await actOnActivePreview({ kind: 'elements' })
-
- expect(injected).toContain('0 <= 0')
- })
-
it('awaits page-owned thenables for inventories and settled actions before crossing Electron IPC', async () => {
// Zone.js replaces Promise with a non-native thenable. Electron awaits
// native V8 promises only; otherwise IPC delivers the object's state,
diff --git a/apps/desktop/src/app/chat/right-rail/preview-annotate-card.test.tsx b/apps/desktop/src/app/chat/right-rail/preview-annotate-card.test.tsx
index 37093a04630..1dd5052cffd 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-annotate-card.test.tsx
+++ b/apps/desktop/src/app/chat/right-rail/preview-annotate-card.test.tsx
@@ -1,11 +1,8 @@
-import { cleanup, fireEvent, render } from '@testing-library/react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
+import { describe, expect, it } from 'vitest'
import { ANNOTATE_CARD_WIDTH } from '@/lib/preview-annotate'
-import { placeAnnotateCard, PreviewAnnotateCard } from './preview-annotate-card'
-
-afterEach(cleanup)
+import { placeAnnotateCard } from './preview-annotate-card'
describe('placeAnnotateCard', () => {
it('sits to the right of the pin instead of past a full-width selection', () => {
@@ -32,35 +29,3 @@ describe('placeAnnotateCard', () => {
expect(placed.top).toBeGreaterThanOrEqual(12)
})
})
-
-describe('PreviewAnnotateCard', () => {
- it('shows a dark comment pill with a send control and no microphone', () => {
- const onSave = vi.fn()
- const onCancel = vi.fn()
- const onChange = vi.fn()
-
- const rendered = render(
- <PreviewAnnotateCard
- left={24}
- note=""
- number={3}
- onCancel={onCancel}
- onChange={onChange}
- onSave={onSave}
- placeholder="Add a comment..."
- saveLabel="Save"
- title="Comment 3"
- top={40}
- />
- )
-
- const card = rendered.container.querySelector('[data-annotate-card="true"]') as HTMLElement
- expect(card.style.background.replace(/\s/g, '').toLowerCase()).toMatch(/#2a2a2a|rgb\(42,42,42\)/)
- expect(rendered.getByPlaceholderText('Add a comment...')).toBeTruthy()
- expect(rendered.container.querySelector('.codicon-mic')).toBeNull()
- expect(rendered.container.querySelector('.codicon-unmute')).toBeNull()
-
- fireEvent.click(rendered.getByRole('button', { name: 'Save' }))
- expect(onSave).toHaveBeenCalledOnce()
- })
-})
diff --git a/apps/desktop/src/app/chat/right-rail/preview-annotate-host.test.ts b/apps/desktop/src/app/chat/right-rail/preview-annotate-host.test.ts
index 7ab5d185a2c..11044b8f5ce 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-annotate-host.test.ts
+++ b/apps/desktop/src/app/chat/right-rail/preview-annotate-host.test.ts
@@ -5,7 +5,6 @@ import { ANNOTATE_CROP_PAD } from '@/lib/preview-annotate'
import {
bindPreviewExecuteJavaScript,
captureAnnotateCrop,
- installAnnotateOverlay,
overlayInstallScript
} from './preview-annotate-host'
@@ -19,18 +18,6 @@ describe('preview annotate host', () => {
expect(() => overlayInstallScript(source)).not.toThrow()
})
- it('injects the guest overlay source', async () => {
- const executeJavaScript = vi.fn(async (code: string) => {
- expect(code).toContain('hermes-annotate')
- expect(code).toContain('#2F80ED')
- expect(code).toContain('api.install()')
- expect(code).toContain('window.__hermesAnnotate')
- })
-
- await installAnnotateOverlay({ executeJavaScript })
- expect(executeJavaScript).toHaveBeenCalledOnce()
- })
-
it('calls executeJavaScript as a method so Electron can read this.getWebContentsId', async () => {
const webview = {
executeJavaScript(this: { getWebContentsId: () => number }, code: string) {
diff --git a/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx
index 4b7f47eb8df..9fc6356423a 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx
+++ b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx
@@ -79,41 +79,6 @@ describe('normalizePreviewAddress', () => {
})
describe('PreviewBrowserBar', () => {
- it('renders the navigation controls and the page toggles', () => {
- const rendered = render(<PreviewBrowserBar {...baseProps} />)
-
- expect(rendered.getByRole('button', { name: 'Back' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Forward' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Reload page' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Copy URL' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Pop out' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Show preview console' })).toBeTruthy()
- expect(rendered.getByRole('button', { name: 'Open preview DevTools' })).toBeTruthy()
- expect(address(rendered)).toBeTruthy()
- })
-
- it('renders the Annotate control and a blue Commenting status while the mode is on', () => {
- const onToggleAnnotate = vi.fn()
- const rendered = render(<PreviewBrowserBar {...baseProps} annotateMode onToggleAnnotate={onToggleAnnotate} />)
-
- const toggle = rendered.getByRole('button', { name: 'Stop annotating' })
- expect(toggle.getAttribute('aria-pressed')).toBe('true')
- fireEvent.click(toggle)
- expect(onToggleAnnotate).toHaveBeenCalledOnce()
- expect(rendered.getByText('Commenting').getAttribute('data-annotate-status')).toBe('commenting')
- })
-
- it('flushes stacked comments from the bar without implying a send on save', () => {
- const onFlushComments = vi.fn()
-
- const rendered = render(
- <PreviewBrowserBar {...baseProps} commentCount={2} onFlushComments={onFlushComments} onToggleAnnotate={vi.fn()} />
- )
-
- fireEvent.click(rendered.getByRole('button', { name: 'Add 2 comments' }))
- expect(onFlushComments).toHaveBeenCalledOnce()
- })
-
it('disables back and forward when there is no history', () => {
const rendered = render(<PreviewBrowserBar {...baseProps} />)
@@ -121,13 +86,6 @@ describe('PreviewBrowserBar', () => {
expect((rendered.getByRole('button', { name: 'Forward' }) as HTMLButtonElement).disabled).toBe(true)
})
- it('enables back and forward when there is history', () => {
- const rendered = render(<PreviewBrowserBar {...baseProps} canGoBack canGoForward />)
-
- expect((rendered.getByRole('button', { name: 'Back' }) as HTMLButtonElement).disabled).toBe(false)
- expect((rendered.getByRole('button', { name: 'Forward' }) as HTMLButtonElement).disabled).toBe(false)
- })
-
it.each([
['Back', 'onBack'],
['Forward', 'onForward'],
@@ -282,40 +240,6 @@ describe('PreviewBrowserBar', () => {
expect(address(rendered).value).toBe('https://example.com')
})
- // Progress belongs beside the address it describes; the reload glyph sits in
- // a row of four and reads as chrome rather than as this page's state.
- it('shows progress inside the address field only while loading', () => {
- const { container, rerender } = render(<PreviewBrowserBar {...baseProps} loading />)
- const field = screen.getByRole('textbox', { name: 'Address' }).parentElement
-
- expect(field?.querySelector('.codicon-loading')).toBeTruthy()
-
- rerender(<PreviewBrowserBar {...baseProps} />)
-
- expect(container.querySelector('.codicon-loading')).toBeNull()
- })
-
- it('spins the reload glyph only while loading', () => {
- const { container, rerender } = render(<PreviewBrowserBar {...baseProps} loading />)
-
- expect(container.querySelector('.codicon-refresh')?.className).toContain('codicon-modifier-spin')
-
- rerender(<PreviewBrowserBar {...baseProps} />)
-
- expect(container.querySelector('.codicon-refresh')?.className).not.toContain('codicon-modifier-spin')
- })
-
- it('copies the live address from the copy-URL button', async () => {
- const writeClipboard = vi.fn().mockResolvedValue(undefined)
-
- installBridge(writeClipboard)
- render(<PreviewBrowserBar {...baseProps} />)
-
- fireEvent.click(screen.getByRole('button', { name: 'Copy URL' }))
-
- await waitFor(() => expect(writeClipboard).toHaveBeenCalledWith('https://example.com'))
- })
-
it('copies the new address after the page navigates', async () => {
const writeClipboard = vi.fn().mockResolvedValue(undefined)
@@ -328,18 +252,6 @@ describe('PreviewBrowserBar', () => {
await waitFor(() => expect(writeClipboard).toHaveBeenCalledWith('https://example.com/next'))
})
- it('renders the copy control inside the address field wrapper, not as a bar glyph', () => {
- render(<PreviewBrowserBar {...baseProps} />)
-
- const copyButton = screen.getByRole('button', { name: 'Copy URL' })
- const address = screen.getByRole('textbox', { name: 'Address' })
-
- // Same positioned wrapper as the field = visually inside it, like the
- // code-block copy icon (inline appearance, overlay on the field's edge).
- expect(copyButton.parentElement?.contains(address)).toBe(true)
- expect(copyButton.className).toContain('absolute')
- })
-
it('shows Open in browser when only the external handler is provided', () => {
const onOpenExternal = vi.fn()
diff --git a/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx b/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx
index 117a7f1fbb2..b3d23686cc2 100644
--- a/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx
@@ -7,15 +7,12 @@ import { group, split } from '@/components/pane-shell/tree/model'
import { $layoutTree, noteActiveTreeGroup } from '@/components/pane-shell/tree/store'
import { SidebarProvider } from '@/components/ui/sidebar'
import { registry } from '@/contrib/registry'
-import { $pinnedSessionIds, $sidebarCardRows } from '@/store/layout'
import { $selectedStoredSessionId, $sessions } from '@/store/session'
import { $removedSessionIds } from '@/store/session-removal'
import { makeSessionInfo } from '@/test/session-info'
import { type AppView, ROUTES_AREA, SIDEBAR_NAV_AREA } from '../../routes'
-import { SIDEBAR_ROW_CARD_MIN_H } from './row-geometry'
-
import { ChatSidebar } from './index'
const noop = () => {}
@@ -165,46 +162,3 @@ describe('ChatSidebar navigation activity', () => {
expectOnlySelectedSession(null)
})
})
-
-// Inbox style is a render variant, not a grouping — it rides whichever view is
-// active. The pinned section sits in the same flat column as recents, so both
-// must render the same row geometry: a section boundary is not a geometry
-// boundary (#116325).
-describe('ChatSidebar inbox style geometry', () => {
- let disposeContributions: () => void
-
- beforeEach(() => {
- disposeContributions = registry.registerMany([])
- $selectedStoredSessionId.set('tile-one')
- $sessions.set(sessionRows)
- $removedSessionIds.set(new Set())
- $pinnedSessionIds.set(['tile-two'])
- })
-
- afterEach(() => {
- cleanup()
- disposeContributions()
- $selectedStoredSessionId.set(null)
- $sessions.set([])
- $removedSessionIds.set(new Set())
- $pinnedSessionIds.set([])
- $sidebarCardRows.set(false)
- })
-
- const row = (title: string) => screen.getByText(title).closest('.group.row-hover') as HTMLElement
-
- it('renders the pinned row with the recents card geometry when Inbox style is on', () => {
- $sidebarCardRows.set(true)
- renderSidebar('/', 'chat')
-
- expect(row('Tile two').className).toContain(SIDEBAR_ROW_CARD_MIN_H)
- expect(row('Tile one').className).toContain(SIDEBAR_ROW_CARD_MIN_H)
- })
-
- it('leaves both sections inline when Inbox style is off', () => {
- renderSidebar('/', 'chat')
-
- expect(row('Tile two').className).not.toContain(SIDEBAR_ROW_CARD_MIN_H)
- expect(row('Tile one').className).not.toContain(SIDEBAR_ROW_CARD_MIN_H)
- })
-})
diff --git a/apps/desktop/src/app/chat/sidebar/chrome-section-add-button.test.tsx b/apps/desktop/src/app/chat/sidebar/chrome-section-add-button.test.tsx
index 17ccca4d7f9..9dbb9260f63 100644
--- a/apps/desktop/src/app/chat/sidebar/chrome-section-add-button.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/chrome-section-add-button.test.tsx
@@ -70,37 +70,6 @@ describe('SidebarSectionAddButton', () => {
expect(onPlainClick).not.toHaveBeenCalled()
})
- it('drags the project variant when the + creates a project (project-overview mode)', () => {
- const onArm = vi.fn()
- const onPlainClick = vi.fn()
- const onNewSessionSplit = vi.fn()
-
- render(
- <SidebarSectionAddButton
- ariaLabel="New project"
- onNewProjectDrag={{ onArm }}
- onNewSessionSplit={onNewSessionSplit}
- onPlainClick={onPlainClick}
- />
- )
-
- fireEvent.pointerDown(screen.getByRole('button', { name: 'New project' }), { button: 0 })
-
- expect(startNewProjectDrag).toHaveBeenCalledOnce()
- // The arm callback is what the resolver calls with the dropped placement.
- expect(startNewProjectDrag.mock.calls[0]?.[0]).toBe(onArm)
- // The plain click rides along as the drag's tap action (same dialog).
- expect((startNewProjectDrag.mock.calls[0]?.[2] as { onTap?: () => void } | undefined)?.onTap).toBe(onPlainClick)
- expect(startNewSessionDrag).not.toHaveBeenCalled()
-
- // A committed drop forwards through the arm, not the session path.
- const onArmFromResolver = startNewProjectDrag.mock.calls[0]?.[0] as (placement: unknown) => void
-
- onArmFromResolver({ anchor: 'workspace', dir: 'center' })
- expect(onArm).toHaveBeenCalledWith({ anchor: 'workspace', dir: 'center' })
- expect(onNewSessionSplit).not.toHaveBeenCalled()
- })
-
it('stays click-only without either drag handler', () => {
const onPlainClick = vi.fn()
diff --git a/apps/desktop/src/app/chat/sidebar/chrome.test.tsx b/apps/desktop/src/app/chat/sidebar/chrome.test.tsx
deleted file mode 100644
index 500211c27f6..00000000000
--- a/apps/desktop/src/app/chat/sidebar/chrome.test.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-import { SidebarDateDivider } from './chrome'
-
-afterEach(cleanup)
-
-describe('SidebarDateDivider', () => {
- it('collapses the group when the caption is clicked', () => {
- const onToggle = vi.fn()
-
- render(
- <SidebarDateDivider label="Yesterday" toggle={{ ariaLabel: 'Hide Yesterday sessions', onToggle, open: true }} />
- )
-
- fireEvent.click(screen.getByRole('button', { name: 'Hide Yesterday sessions' }))
- expect(onToggle).toHaveBeenCalledOnce()
- expect(screen.getByRole('button', { name: 'Hide Yesterday sessions' }).getAttribute('aria-expanded')).toBe('true')
- })
-
- it('stays a static caption when it is not collapsible', () => {
- render(<SidebarDateDivider label="Yesterday" />)
-
- expect(screen.queryByRole('button')).toBeNull()
- expect(screen.getByText('Yesterday')).toBeTruthy()
- })
-})
diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx
index 58fb71b0f6a..fff77bccbfe 100644
--- a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx
@@ -100,9 +100,6 @@ describe('ConnectionSwitcher', () => {
const trigger = screen.getByRole('button', { name: 'Registered gateways: This device' })
expect(trigger.textContent).toContain('This device')
- expect(trigger.getAttribute('data-variant')).toBe('ghost')
- expect(trigger.querySelector('[data-connection-kind="local"] svg')).toBeTruthy()
- expect(trigger.querySelector('.codicon-home')).toBeNull()
fireEvent.pointerDown(trigger, { button: 0, pointerType: 'mouse' })
fireEvent.click(screen.getByRole('menuitemradio', { name: 'Homelab' }))
@@ -114,45 +111,12 @@ describe('ConnectionSwitcher', () => {
expect(selectConnection).toHaveBeenCalledTimes(1)
})
- it('fits the shared statusbar slot without changing its gateway identity', () => {
- $connectionsRegistry.set(registry([connection('local', 'This device', 'local'), connection('homelab', 'Homelab')]))
- render(<ConnectionSwitcher compact onConnect={onConnect} />)
-
- const group = screen.getByRole('group', { name: 'Registered gateways' })
- const trigger = screen.getByRole('button', { name: 'Registered gateways: This device' })
-
- expect(group.className).toContain('h-full')
- expect(group.className).toContain('min-w-20')
- expect(group.className).toContain('max-w-40')
- expect(group.className).toContain('shrink')
- expect(group.className).toContain('overflow-hidden')
- expect(trigger.className).toContain('text-[0.6875rem]')
- expect(trigger.className).toContain('min-w-0')
- expect(trigger.className).toContain('overflow-hidden')
- expect(trigger.textContent).toContain('This device')
- })
-
it('keeps source controls stable while a remote is opening', () => {
$connectionsRegistry.set(registry([connection('local', 'This device', 'local'), connection('homelab', 'Homelab')]))
$pendingConnectionId.set('homelab')
render(<ConnectionSwitcher onConnect={onConnect} />)
expect(screen.getByRole('group', { name: 'Registered gateways' }).getAttribute('aria-busy')).toBe('true')
- expect(
- screen.getByRole('button', { name: 'Registered gateways: This device' }).querySelector('.animate-spin')
- ).toBeTruthy()
- })
-
- it.each([2, 20])('uses the same stable source selector for %i registered backends', count => {
- $connectionsRegistry.set(
- registry([
- connection('local', 'This device', 'local'),
- ...Array.from({ length: count - 1 }, (_, index) => connection(`remote-${index}`, `Remote ${index}`))
- ])
- )
- render(<ConnectionSwitcher onConnect={onConnect} />)
-
- expect(screen.getByRole('button', { name: 'Registered gateways: This device' })).toBeTruthy()
})
it('keeps small gateway lists simple and naturally sorted', () => {
@@ -258,20 +222,6 @@ describe('ConnectionSwitcher', () => {
expect(screen.getByText('No gateways match your search.')).toBeTruthy()
expect(screen.getByRole('menuitem', { name: 'Manage gateways…' })).toBeTruthy()
- expect(globalThis.document.querySelector('[data-slot="dropdown-menu-radio-group"]')?.className).toContain('h-48')
- })
-
- it('announces a pending switch in the compact source menu', () => {
- $connectionsRegistry.set(
- registry([
- connection('local', 'This device', 'local'),
- ...Array.from({ length: 6 }, (_, index) => connection(`remote-${index}`, `Remote ${index}`))
- ])
- )
- $pendingConnectionId.set('remote-3')
- render(<ConnectionSwitcher onConnect={onConnect} />)
-
- expect(screen.getByRole('group', { name: 'Registered gateways' }).getAttribute('aria-busy')).toBe('true')
})
// The window lifecycle owns IPC; this consumer paints its published cache.
diff --git a/apps/desktop/src/app/chat/sidebar/fleet-rail.test.ts b/apps/desktop/src/app/chat/sidebar/fleet-rail.test.ts
index 07532604c5c..f6b9a11ea91 100644
--- a/apps/desktop/src/app/chat/sidebar/fleet-rail.test.ts
+++ b/apps/desktop/src/app/chat/sidebar/fleet-rail.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import type { DesktopAgentRoster, DesktopRegistryConnection } from '@/global'
-import { buildRestGroups, countRestAgents, fleetRouteKey } from './fleet-rail'
+import { buildRestGroups, countRestAgents } from './fleet-rail'
const connections: DesktopRegistryConnection[] = [
{ id: 'pandora', kind: 'remote', label: 'Pandora', url: 'https://pandora.example' },
@@ -122,6 +122,5 @@ describe('buildRestGroups', () => {
// local: default + omer; vps: default
expect(countRestAgents(groups)).toBe(3)
- expect(fleetRouteKey('local', 'omer')).toBe('local::omer')
})
})
diff --git a/apps/desktop/src/app/chat/sidebar/load-more-row.test.tsx b/apps/desktop/src/app/chat/sidebar/load-more-row.test.tsx
index 02978ee2adf..08cddde0ca5 100644
--- a/apps/desktop/src/app/chat/sidebar/load-more-row.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/load-more-row.test.tsx
@@ -23,27 +23,6 @@ vi.mock('@/i18n', () => ({
// open, we assert the structural fix directly: the button is now wrapped in
// a Tip (data-slot="tooltip-trigger"), which is what #<issue> was missing.
describe('SidebarLoadMoreRow', () => {
- it('wraps the button in a Tip with the loading label as the trigger', () => {
- render(<SidebarLoadMoreRow loading onClick={vi.fn()} step={0} />)
-
- const button = screen.getByRole('button', { name: 'Loading…' })
- expect(button.closest('[data-slot="tooltip-trigger"]')).toBeTruthy()
- })
-
- it('wraps the button in a Tip with the count label when a step is given', () => {
- render(<SidebarLoadMoreRow onClick={vi.fn()} step={5} />)
-
- const button = screen.getByRole('button', { name: 'Load 5 more' })
- expect(button.closest('[data-slot="tooltip-trigger"]')).toBeTruthy()
- })
-
- it('wraps the button in a Tip with the generic label when step is 0', () => {
- render(<SidebarLoadMoreRow onClick={vi.fn()} step={0} />)
-
- const button = screen.getByRole('button', { name: 'Load more' })
- expect(button.closest('[data-slot="tooltip-trigger"]')).toBeTruthy()
- })
-
it('still fires onClick (Tip does not intercept the trigger interaction)', () => {
const onClick = vi.fn()
render(<SidebarLoadMoreRow onClick={onClick} step={0} />)
diff --git a/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx b/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx
index 288b3bea92c..e9c1b0b3d7a 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx
@@ -125,36 +125,4 @@ describe('ProfileRail multi-gateway entry point', () => {
expect(screen.queryByRole('button', { name: 'Manage gateways…' })).toBeNull()
expect(screen.getByRole('button', { name: 'Manage profiles…' })).toBeTruthy()
})
-
- it('keeps thirteen profiles direct and condenses the fourteenth', () => {
- profiles.set([
- { is_default: true, name: 'default' },
- ...Array.from({ length: 12 }, (_, index) => ({ is_default: false, name: `Profile ${index + 1}` }))
- ])
- const { unmount } = render(<ProfileRail />)
-
- expect(screen.queryByRole('button', { name: 'Profiles' })).toBeNull()
- expect(screen.getByRole('button', { name: 'Profile 12' })).toBeTruthy()
- unmount()
-
- profiles.set([
- { is_default: true, name: 'default' },
- ...Array.from({ length: 13 }, (_, index) => ({ is_default: false, name: `Profile ${index + 1}` }))
- ])
- render(<ProfileRail />)
-
- expect(screen.getByRole('button', { name: 'Profiles' })).toBeTruthy()
- })
-
- it('stays shrinkable with many profiles and multiple gateways', () => {
- hasMultipleConnections.set(true)
- profiles.set([
- { is_default: true, name: 'default' },
- ...Array.from({ length: 13 }, (_, index) => ({ is_default: false, name: `Profile ${index + 1}` }))
- ])
- render(<ProfileRail />)
-
- expect(screen.getByRole('group', { name: 'Profiles' }).className).toContain('min-w-0')
- expect(screen.getByRole('button', { name: 'Profiles' })).toBeTruthy()
- })
})
diff --git a/apps/desktop/src/app/chat/sidebar/project-dialog.test.tsx b/apps/desktop/src/app/chat/sidebar/project-dialog.test.tsx
index 322cfabc311..6a382e98921 100644
--- a/apps/desktop/src/app/chat/sidebar/project-dialog.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/project-dialog.test.tsx
@@ -81,8 +81,6 @@ vi.mock('@/lib/project-idea-templates', () => ({
randomIdeaTemplates: () => [{ emoji: '🚀', idea: 'A rocket tracker', label: 'Rocket tracker' }]
}))
-const tipTrigger = (el: HTMLElement) => el.closest('[data-slot="tooltip-trigger"]')
-
// Fill the create form and click Create once the form is actually submittable
// (creation requires a name + at least one folder, so the button stays
// disabled until both are in). Awaiting the enable also keeps an async submit
@@ -129,22 +127,6 @@ describe('ProjectDialog', () => {
})
})
- it('wraps the "shuffle idea" button in a Tip', () => {
- render(<ProjectDialog />)
-
- const button = screen.getByRole('button', { name: 'Shuffle ideas' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-
- it('wraps the "remove folder" button in a Tip once a folder is added', async () => {
- render(<ProjectDialog />)
-
- fireEvent.click(screen.getByRole('button', { name: 'Add folder' }))
-
- const button = await screen.findByRole('button', { name: 'Remove folder' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-
it('forwards an armed drag placement to createProject on submit', async () => {
const { clearNewProjectDropPlacement, createProject } = vi.mocked(await import('@/store/projects'))
const placement = { anchor: 'workspace', dir: 'center' }
diff --git a/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx b/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
index b4724b910f1..ff60c943643 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/overview-row.test.tsx
@@ -60,8 +60,6 @@ vi.mock('./project-menu', () => ({
const project = { id: 'p1', label: 'Test D' } as unknown as SidebarProjectTree
-const tipTrigger = (el: HTMLElement) => el.closest('[data-slot="tooltip-trigger"]')
-
const session = (id: string, updated: number): SessionInfo => ({ id, updated_at: updated }) as unknown as SessionInfo
describe('ProjectOverviewRow', () => {
@@ -71,27 +69,6 @@ describe('ProjectOverviewRow', () => {
projectsStore.projectProfile.mockReset().mockReturnValue('default')
})
- it('wraps the "new session" add button in a Tip with the project-scoped label', () => {
- render(<ProjectOverviewRow onNewSession={vi.fn()} project={project} />)
-
- const button = screen.getByRole('button', { name: 'New session in Test D' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-
- it('wraps the disclosure toggle in a Tip when there are preview sessions', () => {
- render(
- <ProjectOverviewRow
- previewSessions={[{ id: 's1' } as unknown as SessionInfo]}
- project={project}
- renderRows={() => null}
- />
- )
-
- // Collapsed by default, so the disclosure offers to show the sessions.
- const button = screen.getByRole('button', { name: 'Show Test D sessions' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-
it('does not render the disclosure toggle when there is nothing to preview', () => {
render(<ProjectOverviewRow project={project} />)
@@ -170,32 +147,4 @@ describe('ProjectOverviewRow', () => {
expect(onNewSession).toHaveBeenCalledWith(null)
})
-
- it('tags the row with data-sessions-project so a skin can target one project', () => {
- const { container } = render(<ProjectOverviewRow project={project} />)
-
- expect(container.querySelector('[data-sessions-project="p1"]')).toBeTruthy()
- })
-
- it('explicit projects keep the folder-library glyph and a plain accessible name', () => {
- const explicit = { id: 'p1', label: 'Explicit' } as unknown as SidebarProjectTree
-
- const { container } = render(<ProjectOverviewRow project={explicit} />)
-
- expect(container.querySelector('.codicon-folder-library')).toBeTruthy()
- expect(container.querySelector('.codicon-repo')).toBeNull()
- expect(screen.getByRole('button', { name: 'Enter Explicit' })).toBeTruthy()
- })
-
- it('auto-discovered repos get the repo glyph, an "Auto-discovered" tooltip, and an accessible name that says so', () => {
- const auto = { id: '/Users/dev/my-repo', label: 'my-repo', isAuto: true } as unknown as SidebarProjectTree
-
- const { container } = render(<ProjectOverviewRow project={auto} />)
-
- expect(container.querySelector('.codicon-repo')).toBeTruthy()
- expect(container.querySelector('.codicon-folder-library')).toBeNull()
-
- const link = screen.getByRole('button', { name: 'Enter my-repo (Auto-discovered)' })
- expect(tipTrigger(link)).toBeTruthy()
- })
})
diff --git a/apps/desktop/src/app/chat/sidebar/projects/project-menu.test.tsx b/apps/desktop/src/app/chat/sidebar/projects/project-menu.test.tsx
index e0df9f2a5c0..cbca71ca74d 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/project-menu.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/project-menu.test.tsx
@@ -8,8 +8,7 @@ afterEach(cleanup)
// jsdom doesn't implement ResizeObserver; Radix's PopoverContent/Arrow use it
// (via @radix-ui/react-use-size) to measure the arrow once the popover is
-// actually mounted. The kebab-only test above never opens a Popover, so it
-// doesn't need this — only the appearance-popover test below does.
+// actually mounted.
beforeAll(() => {
vi.stubGlobal(
'ResizeObserver',
@@ -76,8 +75,6 @@ const project = {
path: '/repo'
} as unknown as SidebarProjectTree
-const tipTrigger = (el: HTMLElement) => el.closest('[data-slot="tooltip-trigger"]')
-
const openTriggerMenu = (trigger: HTMLElement) => {
// Radix's dropdown trigger opens on pointerdown (a synthetic 'click' fireEvent
// alone won't do it), so fire the full mouse sequence a real click produces —
@@ -88,13 +85,6 @@ const openTriggerMenu = (trigger: HTMLElement) => {
}
describe('ProjectMenu', () => {
- it('does not wrap the kebab trigger in a Tip', () => {
- render(<ProjectMenu isActive={false} project={project} />)
-
- const button = screen.getByRole('button', { name: 'Actions' })
- expect(tipTrigger(button)).toBeNull()
- })
-
// When anchorRef is absent, PopoverAnchor wraps the dropdown trigger so the
// appearance popover positions against the kebab. asChild must still reach
// the real button (no non-forwarding wrappers inside the chain — #67500).
diff --git a/apps/desktop/src/app/chat/sidebar/projects/workspace-header.test.tsx b/apps/desktop/src/app/chat/sidebar/projects/workspace-header.test.tsx
index adb462e586d..04acd1a4beb 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/workspace-header.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/workspace-header.test.tsx
@@ -1,7 +1,7 @@
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { StartWorkButton, WorkspaceAddButton, WorkspaceMenu, WorkspaceShowMoreButton } from './workspace-header'
+import { WorkspaceAddButton } from './workspace-header'
afterEach(cleanup)
@@ -27,23 +27,11 @@ vi.mock('@/store/projects', () => ({
revealPath: vi.fn()
}))
-// StartWorkButton no longer renders a dialog. It publishes an intent to the one
-// WorktreeDialog that is mounted in the sidebar. Stub the store action, so this
-// test keeps the button separate from the git probes of the resolver.
vi.mock('@/store/coding-status', () => ({
openWorktreeDialog: vi.fn()
}))
-const tipTrigger = (button: HTMLElement) => button.closest('[data-slot="tooltip-trigger"]')
-
describe('WorkspaceAddButton', () => {
- it('wraps the "+" button in a Tip', () => {
- render(<WorkspaceAddButton label="New session in Test D" onClick={vi.fn()} />)
-
- const button = screen.getByRole('button', { name: 'New session in Test D' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-
it('still fires onClick', () => {
const onClick = vi.fn()
render(<WorkspaceAddButton label="New session in Test D" onClick={onClick} />)
@@ -52,30 +40,3 @@ describe('WorkspaceAddButton', () => {
expect(onClick).toHaveBeenCalledOnce()
})
})
-
-describe('WorkspaceShowMoreButton', () => {
- it('wraps the ellipsis button in a Tip with the composed label', () => {
- render(<WorkspaceShowMoreButton count={5} label="Test D" onClick={vi.fn()} />)
-
- const button = screen.getByRole('button', { name: 'Show 5 more in Test D' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-})
-
-describe('WorkspaceMenu', () => {
- it('does not wrap the kebab trigger in a Tip', () => {
- render(<WorkspaceMenu onRemove={vi.fn()} path="/repo/lane" />)
-
- const button = screen.getByRole('button', { name: 'Actions' })
- expect(tipTrigger(button)).toBeNull()
- })
-})
-
-describe('StartWorkButton', () => {
- it('wraps the git-branch trigger in a Tip', () => {
- render(<StartWorkButton repoPath="/repo" />)
-
- const button = screen.getByRole('button', { name: 'New worktree' })
- expect(tipTrigger(button)).toBeTruthy()
- })
-})
diff --git a/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx b/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx
index 0a0fc897ace..e83a2ba707f 100644
--- a/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-actions-menu.test.tsx
@@ -123,13 +123,11 @@ function renderMenu() {
}
describe('SessionActionsMenu', () => {
- it('opens the dropdown on click without a tooltip on the kebab', async () => {
+ it('opens the dropdown on click', async () => {
renderMenu()
const trigger = screen.getByRole('button', { name: 'Session actions' })
- expect(trigger.closest('[data-slot="tooltip-trigger"]')).toBeNull()
-
// Radix's dropdown trigger opens on pointerdown (not on the synthetic
// 'click' fireEvent alone would dispatch), so fire the full mouse
// sequence a real click produces.
diff --git a/apps/desktop/src/app/chat/sidebar/session-row-details.test.ts b/apps/desktop/src/app/chat/sidebar/session-row-details.test.ts
index cc61643eb21..81032dd27c9 100644
--- a/apps/desktop/src/app/chat/sidebar/session-row-details.test.ts
+++ b/apps/desktop/src/app/chat/sidebar/session-row-details.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'
import type { SessionInfo } from '@/types/hermes'
-import { sessionRowDetails, sessionRowEstimate, type SessionRowFormatters } from './session-row-details'
+import { sessionRowDetails, type SessionRowFormatters } from './session-row-details'
const en: SessionRowFormatters = {
messageCount: count => `${count} ${count === 1 ? 'message' : 'messages'}`,
@@ -27,19 +27,6 @@ const session = (overrides: Partial<SessionInfo> = {}): SessionInfo => ({
})
describe('session row details', () => {
- it('provides density-aware virtual row estimates', () => {
- expect(sessionRowEstimate('compact')).toBe(28)
- expect(sessionRowEstimate('comfortable')).toBe(45)
- expect(sessionRowEstimate('detailed')).toBe(63)
- })
-
- it('keeps the detailed estimate even when preview is omitted as a title duplicate', () => {
- const details = sessionRowDetails(session({ title: null }), en)
-
- expect(details.preview).toBeNull()
- expect(sessionRowEstimate('detailed')).toBe(63)
- })
-
it('formats deterministic metadata without ambiguous call wording', () => {
expect(sessionRowDetails(session({ git_branch: 'feature/menu' }), en)).toEqual({
metadata: 'feature/menu · gemini-3.1-pro · 26 messages · 8 tool calls',
@@ -88,18 +75,4 @@ describe('session row details', () => {
preview: null
})
})
-
- it('localizes count labels via the formatter interface', () => {
- const ja: SessionRowFormatters = {
- messageCount: count => `${count} 件のメッセージ`,
- toolCallCount: count => `${count} 件のツール呼び出し`
- }
-
- expect(
- sessionRowDetails(session({ git_branch: null, message_count: 3, model: null, tool_call_count: 5 }), ja)
- ).toEqual({
- metadata: '3 件のメッセージ · 5 件のツール呼び出し',
- preview: 'Explore Gmail-like density tiers for session rows.'
- })
- })
})
diff --git a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx b/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
index 7b719efc220..29770f6f6c0 100644
--- a/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-row.test.tsx
@@ -63,9 +63,7 @@ vi.mock('@/app/chat/session-drag', () => ({ startSessionDrag: vi.fn() }))
// regression in its ref/prop forwarding fails here again.
// Only `sessionTitle` is overridden (makeSession fakes a bare `title` the real
// one wouldn't read); the rest of the module is genuine so the arc test can
-// build session state with the same factory the app uses. It is a spy because
-// the row calls it exactly once per render, which is how the isolation test
-// below counts repaints.
+// build session state with the same factory the app uses.
const sessionTitle = vi.fn((s: SessionInfo) => (s as unknown as { title: string }).title)
vi.mock('@/lib/chat-runtime', async importOriginal => {
@@ -125,7 +123,7 @@ vi.mock('@/store/windows', async importOriginal => {
// SessionActionsMenu open behavior is covered in session-actions-menu.test.tsx
// against the real component. Stub it here so this file stays focused on the
-// row chrome (handoff avatar tip, etc.).
+// row chrome.
vi.mock('./session-actions-menu', () => ({
SessionActionsMenu: ({ children }: { children: React.ReactNode }) => <>{children}</>,
SessionContextMenu: ({ children }: { children: React.ReactNode }) => <>{children}</>
@@ -147,16 +145,6 @@ function makeSession(overrides: Partial<SessionInfo> & { title: string }): Sessi
} as unknown as SessionInfo
}
-const tipTrigger = (el: HTMLElement) => el.closest('[data-slot="tooltip-trigger"]')
-
-// The status dot always paints an aria-hidden placeholder so every row's title
-// keeps the same left edge, so "the row's aria-hidden span" no longer names the
-// avatar on its own. `inline-grid` is PlatformAvatar's own layout class in both
-// of its branches — brand glyph and first-letter fallback — and the row passes
-// it no display class that tailwind-merge could drop it for.
-const handoffAvatar = (container: HTMLElement) =>
- container.querySelector<HTMLElement>('span[aria-hidden="true"].inline-grid')
-
const noop = vi.fn()
const renderRow = (session: SessionInfo, extra?: { card?: boolean }) =>
@@ -199,38 +187,6 @@ describe('SidebarSessionRow running arc', () => {
expect(arc(container)).toBeTruthy()
})
-
- // The row owns its status subscription so a turn starting repaints that row
- // and nothing else — not its siblings, and not the list around them. Rows
- // render once per fiber, so counting `sessionTitle` counts repaints.
- it('repaints only the session whose turn started', () => {
- render(
- <>
- {[makeSession({ id: 's1', title: 'One' }), makeSession({ id: 's2', title: 'Two' })].map(session => (
- <SidebarSessionRow
- isPinned={false}
- isSelected={false}
- key={session.id}
- onArchive={noop}
- onDelete={noop}
- onPin={noop}
- onResume={noop}
- onToggleUnread={noop}
- session={session}
- unread={false}
- />
- ))}
- </>
- )
- sessionTitle.mockClear()
-
- act(() => {
- publishSessionState('rt1', { ...createClientSessionState('s1'), busy: true })
- })
-
- expect(sessionTitle).toHaveBeenCalledTimes(1)
- expect(sessionTitle).toHaveBeenCalledWith(expect.objectContaining({ id: 's1' }))
- })
})
describe('SidebarSessionRow', () => {
@@ -238,25 +194,6 @@ describe('SidebarSessionRow', () => {
vi.useRealTimers()
})
- it('keeps an aria-label on the kebab without wrapping it in a Tip', () => {
- render(
- <SidebarSessionRow
- isPinned={false}
- isSelected={false}
- onArchive={noop}
- onDelete={noop}
- onPin={noop}
- onResume={noop}
- onToggleUnread={noop}
- session={makeSession({ title: 'Hermes doctor health check results' })}
- unread={false}
- />
- )
-
- const kebab = screen.getByRole('button', { name: 'Session actions' })
- expect(tipTrigger(kebab)).toBeNull()
- })
-
// Full-title tooltip on hover (#83000-class ask): the label is a tooltip
// trigger, but the tip only opens when the title is actually truncated.
describe('full-title overflow tooltip', () => {
@@ -274,12 +211,6 @@ describe('SidebarSessionRow', () => {
Object.defineProperty(el, 'clientWidth', { configurable: true, value: clientWidth })
}
- it('wraps the title in a tooltip trigger', () => {
- renderRow(makeSession({ title }))
-
- expect(label()).toBeTruthy()
- })
-
it('opens with the full title after a settled hover when the title overflows', () => {
vi.useFakeTimers()
renderRow(makeSession({ title }))
@@ -327,120 +258,6 @@ describe('SidebarSessionRow', () => {
expect(screen.queryByRole('tooltip')).toBeNull()
})
})
-
- it('exposes the exact session time through a focusable Tip trigger', () => {
- // Pin the clock before deriving the timestamp. The assertion below is
- // about the *composition* of the label (relative age + absolute time),
- // but "5 minutes ago" only falls on today when the run does not straddle
- // local midnight. Between 00:00 and 00:05 the row correctly renders
- // "Yesterday at 11:5x PM" and this test failed for a day boundary it was
- // never written to exercise. Only `Date` is faked, so the component's
- // own timers (the running arc, the tooltip open delay) keep running for
- // real.
- vi.useFakeTimers({ toFake: ['Date'] })
- vi.setSystemTime(new Date(2026, 2, 5, 12, 0, 0))
-
- const startedAt = Math.floor(Date.now() / 1000) - 5 * 60
-
- render(
- <SidebarSessionRow
- isPinned={false}
- isSelected={false}
- onArchive={noop}
- onDelete={noop}
- onPin={noop}
- onResume={noop}
- onToggleUnread={noop}
- session={makeSession({ started_at: startedAt, title: 'Timestamped session' })}
- unread={false}
- />
- )
-
- const age = screen.getByText('5m')
- expect(age.tagName).toBe('TIME')
- expect(age.getAttribute('datetime')).toBe(new Date(startedAt * 1000).toISOString())
- expect(age.getAttribute('aria-label')).toMatch(/^5m, Today at /)
- expect(age.getAttribute('tabindex')).toBe('0')
- expect(age.getAttribute('title')).toBeNull()
- expect(tipTrigger(age)).toBeTruthy()
- })
-
- it('does not render a handoff avatar for a locally-started session', () => {
- const { container } = render(
- <SidebarSessionRow
- isPinned={false}
- isSelected={false}
- onArchive={noop}
- onDelete={noop}
- onPin={noop}
- onResume={noop}
- onToggleUnread={noop}
- session={makeSession({ title: 'Local session' })}
- unread={false}
- />
- )
-
- expect(handoffAvatar(container)).toBeNull()
- })
-
- it('wraps the handoff platform avatar in a Tip for a session started on another platform', () => {
- const { container } = render(
- <SidebarSessionRow
- isPinned={false}
- isSelected={false}
- onArchive={noop}
- onDelete={noop}
- onPin={noop}
- onResume={noop}
- onToggleUnread={noop}
- session={makeSession({
- handoff_platform: 'telegram',
- handoff_state: 'active',
- title: 'Continued from Telegram'
- })}
- unread={false}
- />
- )
-
- // PlatformAvatar is the REAL component here (see the note above the vi.mock
- // block, #67500 third pass) — it renders the Telegram brand SVG rather
- // than the platform name as text, so query the avatar span itself rather
- // than text content, and confirm its tooltip trigger actually attaches to
- // it — proving the real forwardRef/...rest path works, not a mock that
- // fakes it.
- const avatar = handoffAvatar(container)
- expect(avatar).toBeTruthy()
- expect(tipTrigger(avatar as HTMLElement)).toBeTruthy()
- })
-})
-
-describe('Inbox-style session card', () => {
- it('gives truncated card lines room for glyph ink instead of clipping them', () => {
- renderRow(
- makeSession({
- cwd: '/Users/tomek/pursuit-support-agent',
- message_count: 133,
- model: 'gpt-4.1',
- title: 'Ruff lint and pytest verification'
- }),
- { card: true }
- )
-
- const workspace = screen.getByText('pursuit-support-agent')
- const title = screen.getByText('Ruff lint and pytest verification').parentElement
- const footer = screen.getByText('GPT-4.1').parentElement
-
- expect(title).toBeTruthy()
- expect(footer).toBeTruthy()
-
- for (const el of [workspace, title!, footer!]) {
- expect(el.className).not.toMatch(/\bleading-none\b/)
- expect(el.className).toMatch(/leading-\[1\.35\]/)
- }
-
- expect(workspace.className).toMatch(/\btruncate\b/)
- expect(screen.getByText('133 messages')).toBeTruthy()
- })
})
// Regression for #83617: the row shell once spread the FULL dnd-kit handle, so
diff --git a/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx b/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx
deleted file mode 100644
index ee0a3cf90e8..00000000000
--- a/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx
+++ /dev/null
@@ -1,184 +0,0 @@
-import { cleanup, render } from '@testing-library/react'
-import type * as React from 'react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-import type { SessionInfo } from '@/hermes'
-
-import { SidebarSessionsSection, VIRTUALIZE_THRESHOLD } from './sessions-section'
-import type { VirtualSessionListProps } from './virtual-session-list'
-
-afterEach(cleanup)
-
-vi.mock('@/i18n', () => ({
- useI18n: () => ({
- t: {
- sidebar: {
- dateDivider: {
- earlierThisMonth: 'Earlier this month',
- lastMonth: 'Last month',
- lastWeek: 'Last week',
- older: 'Older',
- today: 'Today',
- yesterday: 'Yesterday'
- }
- }
- }
- })
-}))
-
-const mockVirtualListPropsHistory: VirtualSessionListProps[] = []
-
-vi.mock('./virtual-session-list', () => ({
- VirtualSessionList: (props: VirtualSessionListProps) => {
- mockVirtualListPropsHistory.push(props)
-
- return <div data-testid="virtual-session-list">Virtual List ({props.rows.length} rows)</div>
- }
-}))
-
-vi.mock('./session-row', () => ({
- SidebarSessionRow: ({ session }: { session: SessionInfo }) => (
- <div data-testid={`session-row-${session.id}`}>{session.id}</div>
- )
-}))
-
-function makeSession(id: string, startedAt = 1000): SessionInfo {
- return {
- handoff_platform: null,
- handoff_state: null,
- id,
- last_active: startedAt,
- profile: 'default',
- started_at: startedAt
- } as unknown as SessionInfo
-}
-
-function generateSessions(count: number): SessionInfo[] {
- return Array.from({ length: count }, (_, i) => makeSession(`session-${i + 1}`, 10000 - i * 100))
-}
-
-const noop = () => {}
-
-describe('SidebarSessionsSection memoization & virtualizer stability', () => {
- it('memoizes flatRows and passes the exact same rows array reference across parent re-renders', () => {
- mockVirtualListPropsHistory.length = 0
-
- const sessions = generateSessions(VIRTUALIZE_THRESHOLD + 5)
-
- const { rerender } = render(
- <SidebarSessionsSection
- activeSessionId={null}
- emptyState={<div>Empty</div>}
- label="Sessions"
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onToggle={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- open={true}
- pinned={false}
- sessions={sessions}
- />
- )
-
- expect(mockVirtualListPropsHistory.length).toBe(1)
- const initialRowsRef = mockVirtualListPropsHistory[0].rows
- expect(initialRowsRef.length).toBeGreaterThan(VIRTUALIZE_THRESHOLD)
-
- // Re-render parent with the exact same sessions array and props
- rerender(
- <SidebarSessionsSection
- activeSessionId={null}
- emptyState={<div>Empty</div>}
- label="Sessions"
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onToggle={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- open={true}
- pinned={false}
- sessions={sessions}
- />
- )
-
- expect(mockVirtualListPropsHistory.length).toBe(2)
- const nextRowsRef = mockVirtualListPropsHistory[1].rows
-
- // Confirm that the flatRows array reference remains strictly identical across renders (useMemo proof)
- expect(nextRowsRef).toBe(initialRowsRef)
- })
-
- it('re-computes flatRows reference when grouping or sessions change', () => {
- mockVirtualListPropsHistory.length = 0
-
- const initialSessions = generateSessions(VIRTUALIZE_THRESHOLD + 2)
-
- const { rerender } = render(
- <SidebarSessionsSection
- activeSessionId={null}
- emptyState={<div>Empty</div>}
- grouping="none"
- label="Sessions"
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onToggle={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- open={true}
- pinned={false}
- sessions={initialSessions}
- />
- )
-
- const firstRowsRef = mockVirtualListPropsHistory[0].rows
-
- // Switch on date dividers
- rerender(
- <SidebarSessionsSection
- activeSessionId={null}
- emptyState={<div>Empty</div>}
- grouping="date"
- label="Sessions"
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onToggle={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- open={true}
- pinned={false}
- sessions={initialSessions}
- />
- )
-
- const secondRowsRef = mockVirtualListPropsHistory[1].rows
- expect(secondRowsRef).not.toBe(firstRowsRef)
-
- // Change sessions array identity
- const updatedSessions = generateSessions(VIRTUALIZE_THRESHOLD + 4)
- rerender(
- <SidebarSessionsSection
- activeSessionId={null}
- emptyState={<div>Empty</div>}
- grouping="date"
- label="Sessions"
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onToggle={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- open={true}
- pinned={false}
- sessions={updatedSessions}
- />
- )
-
- const thirdRowsRef = mockVirtualListPropsHistory[2].rows
- expect(thirdRowsRef).not.toBe(secondRowsRef)
- })
-})
diff --git a/apps/desktop/src/app/chat/sidebar/use-profile-rail-refresh-on-active.test.ts b/apps/desktop/src/app/chat/sidebar/use-profile-rail-refresh-on-active.test.ts
index 9f15a2ab9ce..c6b428bde72 100644
--- a/apps/desktop/src/app/chat/sidebar/use-profile-rail-refresh-on-active.test.ts
+++ b/apps/desktop/src/app/chat/sidebar/use-profile-rail-refresh-on-active.test.ts
@@ -72,20 +72,4 @@ describe('useProfileRailRefreshOnActive', () => {
expect(refreshActiveProfile).not.toHaveBeenCalled()
})
-
- it('does not accumulate listeners across repeated mount/unmount cycles', async () => {
- // A leaked listener from a prior mount would double- (or N-times-)
- // refresh on a single focus event after remounting.
- const first = renderHook(() => useProfileRailRefreshOnActive())
- first.unmount()
-
- renderHook(() => useProfileRailRefreshOnActive())
- refreshActiveProfile.mockClear()
-
- await act(async () => {
- window.dispatchEvent(new Event('focus'))
- })
-
- expect(refreshActiveProfile).toHaveBeenCalledTimes(1)
- })
})
diff --git a/apps/desktop/src/app/chat/sidebar/virtual-session-list.test.tsx b/apps/desktop/src/app/chat/sidebar/virtual-session-list.test.tsx
deleted file mode 100644
index fde32086a43..00000000000
--- a/apps/desktop/src/app/chat/sidebar/virtual-session-list.test.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { cleanup, render } from '@testing-library/react'
-import type * as React from 'react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-import type { SidebarListRow } from '@/lib/session-date-groups'
-
-import { VirtualSessionList } from './virtual-session-list'
-
-const virtualizer = {
- getTotalSize: () => 68,
- getVirtualItems: () => [
- { end: 26, index: 0, start: 0 },
- { end: 68, index: 1, start: 26 }
- ],
- measure: vi.fn(),
- measureElement: vi.fn()
-}
-
-vi.mock('@dnd-kit/sortable', () => ({ useSortable: vi.fn() }))
-vi.mock('@dnd-kit/utilities', () => ({ CSS: { Transform: { toString: vi.fn() } } }))
-vi.mock('@tanstack/react-virtual', () => ({ useVirtualizer: () => virtualizer }))
-
-vi.mock('@/i18n', () => ({
- useI18n: () => ({
- t: {
- sidebar: {
- dateDivider: {
- earlierThisMonth: 'Earlier this month',
- lastMonth: 'Last month',
- lastWeek: 'Last week',
- older: 'Older',
- today: 'Today',
- yesterday: 'Yesterday'
- }
- }
- }
- })
-}))
-
-vi.mock('./chrome', () => ({
- SidebarDateDivider: ({ label, ...props }: { label: string } & React.ComponentProps<'div'>) => (
- <div data-testid={`divider-${label}`} {...props} />
- )
-}))
-
-vi.mock('./session-row', () => ({ SidebarSessionRow: () => null }))
-
-afterEach(cleanup)
-
-const rows: SidebarListRow[] = [
- { key: 'today', kind: 'divider', label: 'Today' },
- { key: 'older', kind: 'divider', label: 'Older' }
-]
-
-const noop = () => {}
-
-describe('VirtualSessionList', () => {
- it('positions measured rows independently within a total-size spacer', () => {
- const { getByTestId } = render(
- <VirtualSessionList
- activeSessionId={null}
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- pinned={false}
- rows={rows}
- sortable={false}
- />
- )
-
- const firstItem = getByTestId('divider-Today').parentElement
- const secondItem = getByTestId('divider-Older').parentElement
- const spacer = firstItem?.parentElement
-
- expect(firstItem?.dataset.index).toBe('0')
- expect(firstItem?.style.position).toBe('absolute')
- expect(firstItem?.style.transform).toBe('translateY(0px)')
- expect(secondItem?.dataset.index).toBe('1')
- expect(secondItem?.style.transform).toBe('translateY(26px)')
- expect(spacer?.className).toBe('relative')
- expect(spacer?.style.height).toBe('68px')
- expect(spacer?.style.paddingTop).toBe('')
- expect(spacer?.style.paddingBottom).toBe('')
- })
-
- it('lets wheel overscroll chain to the outer sidebar scroller (#84964)', () => {
- const { getByTestId } = render(
- <VirtualSessionList
- activeSessionId={null}
- onArchiveSession={noop}
- onDeleteSession={noop}
- onResumeSession={noop}
- onTogglePin={noop}
- onToggleUnread={noop}
- pinned={false}
- rows={rows}
- sortable={false}
- />
- )
-
- const scroller = getByTestId('divider-Today').parentElement?.parentElement?.parentElement
-
- // The inner virtualized scroller must NOT contain overscroll: it is nested
- // inside the sidebar's own scroll container, and containing it swallowed
- // wheel events at the inner scroll boundary — the mid-list wheel dead-zone
- // at 25+ sessions. Chaining stays inside the sidebar because the OUTER
- // scroller keeps overscroll-contain.
- expect(scroller?.className).toContain('overflow-y-auto')
- expect(scroller?.className).not.toContain('overscroll-contain')
- })
-})
diff --git a/apps/desktop/src/app/command-palette/highlight-watcher.test.tsx b/apps/desktop/src/app/command-palette/highlight-watcher.test.tsx
index 2e92a24678b..096510c1a0a 100644
--- a/apps/desktop/src/app/command-palette/highlight-watcher.test.tsx
+++ b/apps/desktop/src/app/command-palette/highlight-watcher.test.tsx
@@ -16,8 +16,8 @@ import { HighlightWatcher } from './highlight-watcher'
stubResizeObserver()
stubMenuDomApis()
-const palette = (onValue: (value: string) => void, onRootValueChange?: (value: string) => void) => (
- <Command onValueChange={onRootValueChange}>
+const palette = (onValue: (value: string) => void) => (
+ <Command>
<HighlightWatcher onValue={onValue} />
<Command.List>
<Command.Item value="alpha">Alpha</Command.Item>
@@ -35,17 +35,4 @@ describe('HighlightWatcher', () => {
// cmdk auto-highlights the first item on mount.
expect(onValue).toHaveBeenCalledWith('alpha')
})
-
- it('covers the gap: the root onValueChange stays silent in uncontrolled mode', () => {
- const onValue = vi.fn()
- const onRootValueChange = vi.fn()
-
- render(palette(onValue, onRootValueChange))
-
- // The store-based watcher fires. The prop the first implementation used
- // does not. If cmdk starts to fire it in uncontrolled mode, the watcher
- // becomes removable — this assertion is the signal.
- expect(onValue).toHaveBeenCalledWith('alpha')
- expect(onRootValueChange).not.toHaveBeenCalled()
- })
})
diff --git a/apps/desktop/src/app/context-menu/app-context-menu.test.tsx b/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
index 293bdda821f..9e5ec3cf116 100644
--- a/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
+++ b/apps/desktop/src/app/context-menu/app-context-menu.test.tsx
@@ -6,7 +6,6 @@ import { registerTerminalContextMenu } from '@/app/right-sidebar/terminal/termin
import { DirectiveContent } from '@/components/assistant-ui/directive-text'
import { ContextMenu, ContextMenuTrigger, HERMES_CONTEXT_MENU_TRIGGER_ATTR } from '@/components/ui/context-menu'
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
-import { formatCombo } from '@/lib/keybinds/combo'
import { $previewTabs, closeRightRail } from '@/store/preview'
import { $connection } from '@/store/session'
@@ -206,26 +205,6 @@ describe('AppContextMenu', () => {
expect(screen.getByText('the')).toBeTruthy()
})
- it('shows edit verbs without icons and with faded accelerators', async () => {
- installBridge()
- mountMenu()
- const host = attach('<textarea></textarea>')
-
- fireEvent.contextMenu(host.querySelector('textarea')!)
-
- // formatCombo picks ⌘/Ctrl from the host running the test, exactly like
- // the menu itself — so the assertion is platform-honest, not hardcoded.
- const pasteItem = (await screen.findByText('Paste')).closest('[data-slot="dropdown-menu-item"]')!
-
- expect(pasteItem.querySelector('[data-slot="dropdown-menu-shortcut"]')?.textContent).toBe(formatCombo('mod+v'))
- expect(pasteItem.querySelector('.codicon')).toBeNull()
-
- const selectAllItem = screen.getByText('Select all').closest('[data-slot="dropdown-menu-item"]')!
-
- expect(selectAllItem.querySelector('[data-slot="dropdown-menu-shortcut"]')?.textContent).toBe(formatCombo('mod+a'))
- expect(selectAllItem.querySelector('.codicon')).toBeNull()
- })
-
it('runs edit verbs after the menu closed, with focus back on the editable', async () => {
const contextMenuEdit = vi.fn().mockResolvedValue(undefined)
@@ -343,22 +322,6 @@ describe('AppContextMenu', () => {
expect(document.activeElement).toBe(textarea)
})
- it('splits select all into its own section under the edit verbs', async () => {
- installBridge()
- mountMenu()
- const host = attach('<textarea>text</textarea>')
-
- fireEvent.contextMenu(host.querySelector('textarea')!)
-
- const selectAllItem = (await screen.findByText('Select all')).closest('[data-slot="dropdown-menu-item"]')!
- const pasteItem = screen.getByText('Paste').closest('[data-slot="dropdown-menu-item"]')!
-
- // Sections render as sibling `.contents` wrappers with the separator
- // inside the later one — different wrappers = different sections.
- expect(pasteItem.parentElement).not.toBe(selectAllItem.parentElement)
- expect(selectAllItem.parentElement?.querySelector('[data-slot="dropdown-menu-separator"]')).not.toBeNull()
- })
-
it('grays out cut, copy, and select all in an empty field', async () => {
installBridge()
mountMenu()
@@ -511,23 +474,6 @@ describe('AppContextMenu guest (in-app browser)', () => {
expect(await screen.findByText('Select all')).toBeTruthy()
expect(screen.getByText('Inspect element')).toBeTruthy()
- // The page verbs live on the browser bar only now.
- expect(screen.queryByText('Copy page URL')).toBeNull()
- expect(screen.queryByText('Open in browser')).toBeNull()
- expect(screen.queryByText('Show preview console')).toBeNull()
- })
-
- it('draws a line between select all and inspect element', async () => {
- installBridge()
- mountMenu()
-
- openGuestContextMenu(10, 10, guestParams(), guestHandle())
-
- const selectAllItem = (await screen.findByText('Select all')).closest('[data-slot="dropdown-menu-item"]')!
- const inspectItem = screen.getByText('Inspect element').closest('[data-slot="dropdown-menu-item"]')!
-
- expect(selectAllItem.parentElement).not.toBe(inspectItem.parentElement)
- expect(inspectItem.parentElement?.querySelector('[data-slot="dropdown-menu-separator"]')).not.toBeNull()
})
it('runs inspect element against the handle', async () => {
@@ -549,22 +495,7 @@ describe('AppContextMenu guest (in-app browser)', () => {
expect(await screen.findByText('Open in in-app browser')).toBeTruthy()
expect(screen.getByText('Copy URL')).toBeTruthy()
- // Inspect element rides every guest menu; the bar-only verbs do not.
expect(screen.getByText('Inspect element')).toBeTruthy()
- expect(screen.queryByText('Copy page URL')).toBeNull()
- })
-
- it('keeps inspect element in guest editable menus', async () => {
- installBridge()
- mountMenu()
-
- openGuestContextMenu(10, 10, guestParams({ isEditable: true }), guestHandle())
-
- expect(await screen.findByText('Paste')).toBeTruthy()
- expect(screen.getByText('Inspect element')).toBeTruthy()
- expect(screen.queryByText('Copy page URL')).toBeNull()
- expect(screen.queryByText('Open in browser')).toBeNull()
- expect(screen.queryByText('Show preview console')).toBeNull()
})
it('grays out guest edit verbs from Chromium editFlags', async () => {
@@ -592,19 +523,6 @@ describe('AppContextMenu guest (in-app browser)', () => {
expect(item('Paste').getAttribute('data-disabled')).toBeNull()
})
- it('splits guest select all into its own section', async () => {
- installBridge()
- mountMenu()
-
- openGuestContextMenu(10, 10, guestParams({ isEditable: true }), guestHandle())
-
- const selectAllItem = (await screen.findByText('Select all')).closest('[data-slot="dropdown-menu-item"]')!
- const pasteItem = screen.getByText('Paste').closest('[data-slot="dropdown-menu-item"]')!
-
- expect(pasteItem.parentElement).not.toBe(selectAllItem.parentElement)
- expect(selectAllItem.parentElement?.querySelector('[data-slot="dropdown-menu-separator"]')).not.toBeNull()
- })
-
it('dispatches guest edit verbs a frame after the menu closes', async () => {
installBridge()
mountMenu()
diff --git a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts
index 6ae91e66b32..cf34fb12191 100644
--- a/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts
+++ b/apps/desktop/src/app/contrib/hooks/use-background-sync.test.ts
@@ -28,16 +28,13 @@ import {
import {
type ActiveTranscriptRefreshDeps,
hydrateStoredSessionTranscript,
- isTypingBurstActive,
- noteRendererKeyboardActivity,
profileScopeForTranscriptSession,
reconcileActiveTranscript,
reconcileTileTranscripts as reconcileTileTranscriptsForTest,
rehydrateLiveSessionStatuses,
resetTypingActivityTracking,
resolveActiveTranscriptSession,
- useBackgroundSync,
- windowIsActivelyViewed
+ useBackgroundSync
} from './use-background-sync'
vi.mock('@/hermes', async importOriginal => ({
@@ -898,14 +895,6 @@ describe('reconcileActiveTranscript', () => {
})
})
-describe('windowIsActivelyViewed', () => {
- it('requires both DOM visibility and keyboard focus', () => {
- expect(windowIsActivelyViewed({ focused: true, visibilityState: 'visible' })).toBe(true)
- expect(windowIsActivelyViewed({ focused: false, visibilityState: 'visible' })).toBe(false)
- expect(windowIsActivelyViewed({ focused: true, visibilityState: 'hidden' })).toBe(false)
- })
-})
-
describe('rehydrateLiveSessionStatuses', () => {
it('restores running sessions after reconnect without opening them', () => {
const now = 1_800_000_000_000
@@ -1124,22 +1113,6 @@ describe('typing-aware sessions.changed deferral', () => {
})
})
-describe('isTypingBurstActive', () => {
- it('marks a burst warm for the quiet threshold and cold at it', () => {
- resetTypingActivityTracking()
-
- // No keyboard history → nothing to defer for.
- expect(isTypingBurstActive(1_000_000)).toBe(false)
-
- noteRendererKeyboardActivity(1_000_000)
- expect(isTypingBurstActive(1_000_000)).toBe(true)
- expect(isTypingBurstActive(1_000_000 + 1_499)).toBe(true)
-
- // Exactly one quiet threshold after the last key the keyboard is cold.
- expect(isTypingBurstActive(1_000_000 + 1_500)).toBe(false)
- })
-})
-
describe('an empty persisted page over a populated runtime', () => {
// A backend respawn (or a state.db read racing the change event) answers a
// refresh with zero rows. That page is not proof the transcript is empty;
diff --git a/apps/desktop/src/app/contrib/session-rpc-dispatcher.test.ts b/apps/desktop/src/app/contrib/session-rpc-dispatcher.test.ts
index 16ce7d5abf9..0160455e6df 100644
--- a/apps/desktop/src/app/contrib/session-rpc-dispatcher.test.ts
+++ b/apps/desktop/src/app/contrib/session-rpc-dispatcher.test.ts
@@ -38,7 +38,6 @@ vi.mock('@/store/session', async importActual => ({
const { createSessionRpcDispatcher } = await import('./session-rpc-dispatcher')
const { $connectionsRegistry } = await import('@/store/connection-registry-state')
const { $profiles } = await import('@/store/profile')
-const { $removedSessionIds, $sessionMutationsInFlight } = await import('@/store/session-removal')
const { _resetSessionOwnerHintsForTests, setCronSessions, setMessagingSessions, setSessionOwnerHint, setSessions } =
await import('@/store/session')
@@ -76,8 +75,6 @@ afterEach(() => {
setMessagingSessions([])
$sessionTiles.set([])
$profiles.set([])
- $removedSessionIds.set(new Set())
- $sessionMutationsInFlight.set(new Set())
_resetSessionOwnerHintsForTests({ storage: true })
sessionMocks.requestSessionResume.mockReset()
vi.clearAllMocks()
@@ -305,23 +302,6 @@ describe('createSessionRpcDispatcher: stale runtime recovery', () => {
expect(sessionMocks.requestSessionResume).not.toHaveBeenCalled()
})
- it.each([
- ['tombstoned', $removedSessionIds],
- ['being deleted', $sessionMutationsInFlight]
- ])('still reports the 4001 for a selected session that is %s', async (_state, sessions) => {
- // The rebind decision moved to requestSessionResume (store/session-removal),
- // which drops resume requests for a removal-pending id — this seam only has
- // to keep surfacing the error to its caller.
- setSessions([makeSessionInfo({ connection_id: 'local', id: 'stored-omar', profile: 'omar' })])
- sessions.set(new Set(['stored-omar']))
- gatewayMocks.requestGatewayForAgent.mockRejectedValueOnce(
- Object.assign(new Error('session not found'), { code: 4001 })
- )
- const { request } = dispatcher(undefined, 'stored-omar')
-
- await expect(request('process.list', { session_id: 'rt-omar' })).rejects.toThrow('session not found')
- })
-
it('does not interpret an unrelated coded RPC failure as a stale runtime', async () => {
setSessions([makeSessionInfo({ connection_id: 'local', id: 'stored-omar', profile: 'omar' })])
gatewayMocks.requestGatewayForAgent.mockRejectedValueOnce(
diff --git a/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx b/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
index e158e9d545b..98b6b444165 100644
--- a/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
+++ b/apps/desktop/src/app/contrib/sessions-pane-tab-title.test.tsx
@@ -26,8 +26,7 @@ describe('the Sessions pane tab label', () => {
</I18nProvider>
)
- expect(inLocale('ru')).toBe('Сеансы')
- expect(inLocale('en')).toBe('Sessions')
+ expect(inLocale('ru')).not.toBe(inLocale('en'))
})
it('is joined by every other string-titled chrome pane, with a string twin for the zone menu / drag ghost', () => {
@@ -44,9 +43,12 @@ describe('the Sessions pane tab label', () => {
</I18nProvider>
)
- expect(inLocale('terminal', 'ru')).toBe('Терминал')
- expect(inLocale('files', 'ru')).toBe('Файлы')
- expect(inLocale('review', 'en')).toBe('Review')
+ for (const id of ['terminal', 'files']) {
+ expect(inLocale(id, 'ru')).not.toBe(inLocale(id, 'en'))
+ }
+
+ const ruSessions = inLocale('sessions', 'ru')
+ const ruFiles = inLocale('files', 'ru')
// The non-React readers (zone menu Show/Hide rows, drag ghost chip) call
// the string twin at menu-open / drag-start, so it follows the runtime
@@ -54,8 +56,8 @@ describe('the Sessions pane tab label', () => {
setRuntimeI18nLocale('ru')
try {
- expect(chrome('sessions').tabTitleText()).toBe('Сеансы')
- expect(chrome('files').tabTitleText()).toBe('Файлы')
+ expect(chrome('sessions').tabTitleText()).toBe(ruSessions)
+ expect(chrome('files').tabTitleText()).toBe(ruFiles)
} finally {
setRuntimeI18nLocale('en')
}
diff --git a/apps/desktop/src/app/gateway/hooks/gateway-hmr-survivor.test.ts b/apps/desktop/src/app/gateway/hooks/gateway-hmr-survivor.test.ts
index 36171959a4e..5b024c4dbcf 100644
--- a/apps/desktop/src/app/gateway/hooks/gateway-hmr-survivor.test.ts
+++ b/apps/desktop/src/app/gateway/hooks/gateway-hmr-survivor.test.ts
@@ -24,16 +24,6 @@ afterEach(() => {
})
describe('gateway HMR survivor cache', () => {
- it('returns null when nothing is parked', () => {
- expect(takeGatewaySurvivor()).toBeNull()
- })
-
- it('round-trips a parked survivor', () => {
- const survivor = makeSurvivor('open')
- stashGatewaySurvivor(survivor)
- expect(takeGatewaySurvivor()).toBe(survivor)
- })
-
it('is single-shot — a second take returns null', () => {
stashGatewaySurvivor(makeSurvivor('open'))
expect(takeGatewaySurvivor()).not.toBeNull()
diff --git a/apps/desktop/vitest.config.ts b/apps/desktop/vitest.config.ts
index 4542e0b07f8..426485be308 100644
--- a/apps/desktop/vitest.config.ts
+++ b/apps/desktop/vitest.config.ts
@@ -25,9 +25,7 @@ const electronNative: TestProjectConfiguration = {
// `e2e/**/*.unit.test.ts` is the e2e HELPERS, not the specs: plain node
// modules that should be provable without booting Electron. Playwright
// ignores the same pattern so they run in exactly one runner.
- include: ['electron/**/*.test.ts', 'scripts/**.test.{ts,mjs}', 'e2e/**/*.unit.test.ts'],
- // These use node:test and have dedicated npm scripts, not Vitest suites.
- exclude: ['scripts/run-short-session-hang-repro.test.mjs', 'scripts/tasks-scroll.test.mjs']
+ include: ['electron/**/*.test.ts', 'scripts/**.test.{ts,mjs}', 'e2e/**/*.unit.test.ts']
}
}