From 844a01131986b299348644e3bef65c8710014326 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Mon, 2 Nov 2026 05:22:38 -0800 Subject: [PATCH] test: remove low-value renderer policy and inventory tests --- config/flaky-test-pattern-baseline.txt | 2 +- config/reliability-gates.jsonc | 5 +- config/scripts/ci-shard-timings.json | 3 - ...background-removal-late-settlement.test.ts | 55 ---- .../workspace-surface-projection.test.ts | 66 +---- .../WorktreeJumpPalette.linear-url.test.tsx | 13 - ...eJumpPalette.recent-tabs.behavior.test.tsx | 45 ---- .../WorktreeJumpPalette.recent-tabs.test.tsx | 120 --------- .../WorktreeJumpPalette.test.tsx | 98 -------- ...worktree-jump-palette-task-search.test.tsx | 16 -- ...e-jump-palette-browser-navigation.test.tsx | 10 - ...jump-palette-interleaved-sections.test.tsx | 237 ------------------ .../wsl-host-mark/WslHostMark.test.tsx | 45 +--- .../WslHostStoppedWorkspaceNotice.test.tsx | 61 ----- .../wsl-move/WslMoveDialog.test.tsx | 8 - ...gent-hook-completion-notifications.test.ts | 102 -------- ...tomation-agent-status-entry-change.test.ts | 20 -- .../hooks/composer-branch-selection.test.ts | 58 ----- .../attachment-drop-failure.test.tsx | 86 ------- .../composer-name-source-selection.test.ts | 27 -- .../hooks/direct-ssh-state-routing.test.ts | 34 --- .../editor-external-watch-overflow.test.ts | 15 -- 22 files changed, 5 insertions(+), 1121 deletions(-) delete mode 100644 src/renderer/src/components/wsl-host-stopped/WslHostStoppedWorkspaceNotice.test.tsx delete mode 100644 src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx delete mode 100644 src/renderer/src/hooks/direct-ssh-state-routing.test.ts diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 488cff6f7370..2fa403353a34 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -1016,7 +1016,7 @@ 4 test-no-wall-clock:src/main/wsl/wsl-runner.wsl.test.ts 1 test-no-wall-clock:src/renderer/src/app-shell/visible-review-reporting.test.ts 7 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx -15 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx +8 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx 1 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx 3 test-no-wall-clock:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx 2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index b21d14a9b733..9a205c432dfe 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -13337,7 +13337,7 @@ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport-reattach-admission.test.ts src/renderer/src/components/terminal-pane/pty-transport-detach-attach-handoff.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-error-accumulation.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx src/shared/remote-runtime/remote-runtime-socket-liveness.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-socket-generation.test.ts src/shared/remote-runtime/remote-runtime-client-error-classification.test.ts src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts src/main/runtime/rpc/methods/terminal-create-idempotency.test.ts src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/hooks/direct-ssh-state-routing.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot", + "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/ssh/ssh.test.ts src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts src/main/ipc/worktrees-lineage-hydration.test.ts src/main/runtime/public-ssh-state.test.ts src/main/ssh/connection/ssh-connection-manager.test.ts src/main/ssh/connection/ssh-connection.test.ts src/main/ssh/ssh-provider-authority.test.ts src/preload/ssh-authority-forwarding.test.ts src/renderer/src/runtime/runtime-client-events.test.ts src/renderer/src/runtime/runtime-environment-ssh-state.test.ts src/shared/ssh-retained-payload-admission.test.ts --reporter=dot", "pnpm exec electron-vite build --mode e2e", "pnpm run build:web-from-renderer", @@ -13377,7 +13377,6 @@ "src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts", "src/renderer/src/store/slices/terminals-hydration.test.ts", "src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts", - "src/renderer/src/hooks/direct-ssh-state-routing.test.ts", "src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts", "src/main/ipc/ssh/ssh.test.ts", "src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts", @@ -13653,7 +13652,7 @@ "result": "passed", "durationSeconds": 3.3, "summary": "Six direct-SSH files and 57 tests passed, including SSH tab bindings kept through connected pushes, disconnects and errors, partial-authority reconciliation, hydration, split-pane and detach contracts.", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/hooks/direct-ssh-state-routing.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot" + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot" }, { "date": "2026-08-23", diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index 71a6480c3556..f8d15f14b118 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -10311,7 +10311,6 @@ "src/renderer/src/components/worktree-jump/worktree-jump-palette-interleaved-sections.test.tsx": 4216, "src/renderer/src/components/worktree-jump/worktree-jump-palette-quick-action-availability.test.tsx": 1548, "src/renderer/src/components/wsl-host-stopped/WslHostStoppedNotice.test.tsx": 491, - "src/renderer/src/components/wsl-host-stopped/WslHostStoppedWorkspaceNotice.test.tsx": 259, "src/renderer/src/components/wsl-host-stopped/use-stopped-wsl-host.test.tsx": 139, "src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx": 524, "src/renderer/src/components/wsl-move/use-wsl-move-quit-guard.test.ts": 235, @@ -10329,7 +10328,6 @@ "src/renderer/src/hooks/automation-dispatch-unverifiable-loss.test.ts": 182, "src/renderer/src/hooks/client-workspace-view-report.test.ts": 64, "src/renderer/src/hooks/composer-branch-selection.test.ts": 73, - "src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx": 677, "src/renderer/src/hooks/composer-state/attachment-drop-lifetime.test.tsx": 921, "src/renderer/src/hooks/composer-state/composer-deferred-source-name.test.ts": 1993, "src/renderer/src/hooks/composer-state/composer-host-workspace-status.test.tsx": 2208, @@ -10346,7 +10344,6 @@ "src/renderer/src/hooks/composer-state/provider-runtime-sync.test.ts": 1988, "src/renderer/src/hooks/composer-state/quick-creation-execution.test.ts": 2283, "src/renderer/src/hooks/composer-state/server-ssh-repo-connect.test.ts": 873, - "src/renderer/src/hooks/direct-ssh-state-routing.test.ts": 181, "src/renderer/src/hooks/editor-external-watch-background-trim.test.ts": 363, "src/renderer/src/hooks/editor-external-watch-dirty-resync.test.ts": 973, "src/renderer/src/hooks/editor-external-watch-overflow.test.ts": 1023, diff --git a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-background-removal-late-settlement.test.ts b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-background-removal-late-settlement.test.ts index 188e1353562d..6b9b0786c190 100644 --- a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-background-removal-late-settlement.test.ts +++ b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-background-removal-late-settlement.test.ts @@ -209,59 +209,4 @@ describe('workspace cleanup late settlement reconciliation', () => { }) expect(toast.info).toHaveBeenCalledWith('Still removing workspaces: 1') }) - - it('retries an unblocked ancestor when immediate late-result reporting throws', async () => { - const parent = makeCandidate({ - worktreeId: 'repo-1::/repo/parent', - displayName: 'parent', - branch: 'parent', - path: '/repo/parent' - }) - const child = makeCandidate({ - worktreeId: 'repo-1::/repo/parent/child', - displayName: 'child', - branch: 'child', - path: '/repo/parent/child' - }) - let resolveChild: (result: WorkspaceCleanupRemoveResult) => void = () => {} - const removeCandidates = vi - .fn() - .mockImplementationOnce( - () => - new Promise((resolve) => { - resolveChild = resolve - }) - ) - .mockResolvedValueOnce({ - removedIds: [parent.worktreeId], - removedIdentities: [parent.worktreeId], - failures: [] - }) - vi.mocked(toast.success).mockImplementationOnce(() => { - throw new Error('toast renderer failed') - }) - - startWorkspaceCleanupBackgroundRemoval({ - candidates: [parent, child], - removeCandidates, - onProgress: vi.fn(), - onResult: vi.fn(), - onLateResult: vi.fn(), - removalTimeoutMs: 5, - removalSettlementGraceMs: 5 - }) - - await vi.advanceTimersByTimeAsync(10) - await settleBackgroundRemoval() - resolveChild({ - removedIds: [child.worktreeId], - removedIdentities: [child.worktreeId], - failures: [] - }) - await settleBackgroundRemoval() - - expect(removeCandidates).toHaveBeenNthCalledWith(2, [parent.worktreeId], { - approvedCandidates: [parent] - }) - }) }) diff --git a/src/renderer/src/components/workspace-surface-projection.test.ts b/src/renderer/src/components/workspace-surface-projection.test.ts index 66c3d6769abe..a98f47085327 100644 --- a/src/renderer/src/components/workspace-surface-projection.test.ts +++ b/src/renderer/src/components/workspace-surface-projection.test.ts @@ -1,7 +1,7 @@ /** Host-qualified catalogs can repeat bare workspace IDs, but workbench state/React keys cannot (STA-4846). Collapse duplicates before mounting or the same visible tabs mount twice. */ import { describe, expect, it, vi } from 'vitest' import { projectWorkspaceSurfaces } from './workspace-surface-projection' -import { getIndexedAllWorktrees, getIndexedWorktreeMap } from '../store/worktree-repo-index' +import { getIndexedWorktreeMap } from '../store/worktree-repo-index' import type { ExecutionHostId } from '../../../shared/execution-host' import type { FolderWorkspace } from '../../../shared/folder-workspace-types' import type { Worktree } from '../../../shared/worktree/types' @@ -77,34 +77,6 @@ describe('projectWorkspaceSurfaces', () => { expect(surfaces).toEqual([{ id: SHARED_WORKTREE_ID, path: '/work/orca-feature' }]) }) - it('never emits a duplicate id, so mount loops cannot reuse a React key', () => { - const surfaces = project({ - worktrees: [localWorktree, sshWorktree], - folderWorkspaces: [localFolder, runtimeFolder] - }) - - expect(new Set(surfaces.map((surface) => surface.id)).size).toBe(surfaces.length) - }) - - it('emits one surface per folder workspace id across hosts', () => { - const surfaces = project({ - folderWorkspaces: [localFolder, runtimeFolder] - }) - - expect(surfaces).toHaveLength(1) - expect(surfaces[0]?.id).toBe('folder:folder-shared') - }) - - it('mounts the active folder workspace at its resolved host path, not the first row', () => { - const surfaces = project({ - folderWorkspaces: [localFolder, runtimeFolder], - activeWorkspaceId: 'folder:folder-shared', - activeWorkspaceResolvedHostId: 'runtime:env-1' - }) - - expect(surfaces).toEqual([{ id: 'folder:folder-shared', path: '/remote/orca' }]) - }) - it('ignores the active workspace id entirely when no resolved host disambiguates', () => { // With no resolved folder host, active ID is inert; the foundation relies on passing null to preserve projection identity. const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) @@ -180,26 +152,6 @@ describe('projectWorkspaceSurfaces', () => { expect(hydrated).toEqual([{ id: 'folder:folder-shared', path: '/remote/orca' }]) expect(hydrated[0]?.id).toBe(hydrating[0]?.id) }) - - it('keeps the surviving host row when a runtime disconnect drops its peer', () => { - // Runtime contact loss must preserve projected workspace IDs or mount pruning would unmount them. - const surfaces = project({ worktrees: [localWorktree] }) - - expect(surfaces).toEqual([{ id: SHARED_WORKTREE_ID, path: '/work/orca-feature' }]) - }) - - it('keeps distinct workspaces on one host', () => { - const otherWorktree: Worktree = { - ...localWorktree, - id: 'repo-shared::/work/orca-other', - path: '/work/orca-other' - } - - expect(project({ worktrees: [localWorktree, otherWorktree] })).toEqual([ - { id: SHARED_WORKTREE_ID, path: '/work/orca-feature' }, - { id: 'repo-shared::/work/orca-other', path: '/work/orca-other' } - ]) - }) }) // Collapse may remove duplicates only; dropping an owned surface would destroy live terminals. @@ -267,12 +219,6 @@ describe('projectWorkspaceSurfaces never under-selects', () => { ]) }) - it('collapses two SSH hosts publishing one worktree id, with no local row present', () => { - expect(project({ worktrees: [sshWorktree, secondSshWorktree] })).toEqual([ - { id: SHARED_WORKTREE_ID, path: '/work/orca-feature' } - ]) - }) - it('keeps a git worktree and a folder workspace apart even on the same id text', () => { const surfaces = project({ worktrees: [{ ...localWorktree, id: 'folder-shared', path: '/work/collide' }], @@ -319,10 +265,6 @@ describe('projectWorkspaceSurfaces never under-selects', () => { }) ).toEqual([{ id: 'folder:folder-shared', path: '/work/orca-local' }]) }) - - it('emits nothing extra and nothing missing for an empty catalog', () => { - expect(project({})).toEqual([]) - }) }) // Both worktree hooks read the same WeakMap snapshot, preserving Object.is update behavior after the feed change. @@ -335,10 +277,4 @@ describe('worktree surface feed subscription identity', () => { getIndexedWorktreeMap(worktreesByRepo) ) }) - - it('exposes the same id set the host-qualified array does', () => { - expect(new Set(getIndexedWorktreeMap(worktreesByRepo).keys())).toEqual( - new Set(getIndexedAllWorktrees(worktreesByRepo).map((worktree) => worktree.id)) - ) - }) }) diff --git a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.linear-url.test.tsx b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.linear-url.test.tsx index 65a14ba03094..c95c6d397257 100644 --- a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.linear-url.test.tsx +++ b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.linear-url.test.tsx @@ -730,19 +730,6 @@ describe('WorktreeJumpPalette Linear URL intent', () => { }) }) - it('previews a pasted GitHub pull URL', async () => { - await renderPalette({}) - await act(async () => setCommandQuery?.('https://github.com/stablyai/orca/pull/12789')) - await flushEffects() - - const preview = testContainer.querySelector('[data-cmd-j-task-url-preview="true"]') - expect(preview?.dataset.cmdJTaskUrlProvider).toBe('github') - expect(preview?.getAttribute('aria-label')).toBe( - 'Create worktree from GitHub pull request stablyai/orca#12789' - ) - expect(preview?.textContent).toContain('#12789') - }) - it('selects an existing GitHub-linked worktree and keeps create underneath', async () => { const linked = makeWorktree('wt-linked', 'Linked GitHub workspace', { linkedIssue: 14198 }) const other = makeWorktree('wt-other', 'Unrelated workspace', { linkedIssue: 7 }) diff --git a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx index 9e104ef1d664..aa799d096729 100644 --- a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx +++ b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx @@ -388,33 +388,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { ) }) - it('ignores a digit chord beyond the rendered recent rows', async () => { - await renderPalette(makeRecentTabState()) - - await act(async () => { - emitCmdJRowIndexJump(8) - }) - await flushEffects() - - expect(activateWorkspaceTabPaletteResult).not.toHaveBeenCalled() - }) - - it('stops routing digit chords once a query is typed', async () => { - await renderPalette(makeRecentTabState()) - - await act(async () => { - setCommandQuery?.('Alpha') - }) - await flushEffects() - - await act(async () => { - emitCmdJRowIndexJump(0) - }) - await flushEffects() - - expect(activateWorkspaceTabPaletteResult).not.toHaveBeenCalled() - }) - it('keeps the agent badge on an Open Tabs row a query surfaced', async () => { await renderPalette( makeRecentTabState({ @@ -454,22 +427,4 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { expect(rows.at(-1)).toBe('__create_worktree__') expect(rows.length).toBeGreaterThan(1) }) - - it('labels a branchless main worktree row with its display name', async () => { - await renderPalette( - makeRecentTabState({ - worktreesByRepo: { - 'repo-1': [ - makeWorktree('wt-alpha', 'Alpha workspace', { - isMainWorktree: true, - branch: '' - }), - makeWorktree('wt-beta', 'Beta workspace') - ] - } - }) - ) - - expect(testContainer.textContent).toContain('Alpha workspace') - }) }) diff --git a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx index 34ed8f76d1f6..fb31dc2af894 100644 --- a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx +++ b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx @@ -248,16 +248,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { useAppStore.setState(initialAppState, true) }) - it('leads the empty-query list with the recent section', async () => { - await renderPalette(makeRecentTabState()) - - const rows = getRenderedRowIds().filter((id) => id.length > 0) - expect(rows[0].startsWith(encodePaletteIdentity(['workspace-tab']))).toBe(true) - expect(rows.some((id) => id.startsWith(encodePaletteIdentity(['worktree'])))).toBe(true) - expect(testContainer.textContent).toContain('Recent Chats & Terminals') - expect(testContainer.textContent).toContain('Recent Workspaces') - }) - it('keeps duplicate persisted tab ids as separate recent rows and digit targets', async () => { await renderPalette(makeDuplicateRecentTabState()) @@ -286,20 +276,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { // Maintain the 10-row total cap even before the order snapshot arrives. expect(getWorktreeRows().length).toBeLessThanOrEqual(4) }) - it('shows more recent chats and terminals from the empty-query view', async () => { - await renderPalette(makeManyTabState(12)) - const seeMoreButton = [...testContainer.querySelectorAll('button')].find((button) => - button.textContent?.includes('See more') - ) - expect(seeMoreButton).toBeDefined() - expect(testContainer.textContent).toContain('6 more') - await act(async () => { - seeMoreButton?.click() - }) - await flushEffects() - expect(getTabRowIds()).toHaveLength(12) - expect(testContainer.textContent).not.toContain('6 more') - }) it('reveals every recent row from a single expansion', async () => { await renderPalette(makeManyTabState(30)) expect(getTabRowIds()).toHaveLength(6) @@ -401,29 +377,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { ) }) - // Honor onValueChange after ranking; cmdk’s advanced internal cursor otherwise makes the next ArrowDown a no-op. - it('keeps arrow selection after the typed query ranking has committed', async () => { - await renderPalette(makeTypedRelevanceState()) - - await act(async () => { - setCommandQuery?.('perf') - }) - await flushEffects() - expect(getCommandValue()).toBe( - encodePaletteIdentity(['workspace-tab', '', 'wt-host', 'tab-host']) - ) - - const rows = getRenderedRowIds().filter((id) => id.length > 0) - expect(rows.length).toBeGreaterThan(1) - - await act(async () => { - setCommandSelection?.(rows[1]) - }) - await flushEffects() - - expect(getCommandValue()).toBe(rows[1]) - }) - it('keeps worktrees ahead of tabs when a worktree holds the stronger match', async () => { await renderPalette({ ...makeTypedRelevanceState(), @@ -623,66 +576,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { expect(getTabRowIds()).toEqual(['tab-alpha', 'tab-beta']) }) - it('ranks a recently visited idle tab above a three-day-old blocked tab', async () => { - await renderPalette( - makeRecentTabState({ - agentStatusByPaneKey: { - [makePaneKey('term-alpha', LEAF_ID)]: makeAgentEntry('term-alpha', 'blocked', Date.now()) - }, - unifiedTabsByWorktree: { - 'wt-alpha': [ - { - ...makeUnifiedTab('tab-alpha', 'wt-alpha', 'term-alpha', 'Alpha chat'), - lastFocusedAt: Date.now() - 3 * 86400_000 - } - ], - 'wt-beta': [ - { - ...makeUnifiedTab('tab-beta', 'wt-beta', 'term-beta', 'Beta chat'), - lastFocusedAt: Date.now() - } - ] - } - }) - ) - - expect(getTabRowIds()).toEqual(['tab-beta', 'tab-alpha']) - }) - - it('freezes the order captured on open while statuses keep changing', async () => { - await renderPalette( - makeRecentTabState({ - unifiedTabsByWorktree: { - 'wt-alpha': [ - { - ...makeUnifiedTab('tab-alpha', 'wt-alpha', 'term-alpha', 'Alpha chat'), - lastFocusedAt: Date.now() - 3 * 86400_000 - } - ], - 'wt-beta': [ - { - ...makeUnifiedTab('tab-beta', 'wt-beta', 'term-beta', 'Beta chat'), - lastFocusedAt: Date.now() - } - ] - } - }) - ) - - expect(getTabRowIds()).toEqual(['tab-beta', 'tab-alpha']) - - await act(async () => { - useAppStore.setState({ - agentStatusByPaneKey: { - [makePaneKey('term-alpha', LEAF_ID)]: makeAgentEntry('term-alpha', 'blocked', Date.now()) - } - } as Partial) - }) - await flushEffects() - - expect(getTabRowIds()).toEqual(['tab-beta', 'tab-alpha']) - }) - it('captures the unfiltered order when reopened after a search', async () => { await renderPalette(makeRecentTabState()) @@ -759,19 +652,6 @@ describe('WorktreeJumpPalette recent chats & terminals', () => { expect(getTabRowIds()).toEqual(['tab-beta']) }) - it('still lists a non-current tab whose agent is done', async () => { - await renderPalette( - makeRecentTabState({ - agentStatusByPaneKey: { - [makePaneKey('term-alpha', LEAF_ID)]: makeAgentEntry('term-alpha', 'done', Date.now()) - } - }) - ) - - // Offscreen completion still earns entry. - expect(getTabRowIds()).toContain('tab-alpha') - }) - it('keeps the current tab in recent on a pane-only unread completion marker', async () => { await renderPalette( makeRecentTabState({ diff --git a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx index 3b4c8dae276c..54c28a6aaf84 100644 --- a/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx +++ b/src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx @@ -10,7 +10,6 @@ import type { AppState } from '@/store/types' import { encodePaletteIdentity } from '../../../../shared/palette-match/palette-ranking' import type { activateAndRevealWorkspace as ActivateWorkspace } from '@/lib/worktree-activation' import type { WorkspaceTabPaletteActivationResult } from '@/lib/workspace-tab-palette-activation' -import { toast } from 'sonner' import WorktreeJumpPalette from './WorktreeJumpPalette' import { makeFolderWorkspace, @@ -201,7 +200,6 @@ describe('WorktreeJumpPalette', () => { setCommandQuery = null activateAndRevealWorkspace.mockReset().mockReturnValue({ primaryTabId: null }) activateWorkspaceTabPaletteResult.mockReset().mockReturnValue({ status: 'activated' }) - vi.mocked(toast.error).mockClear() useAppStore.setState(initialAppState, true) testContainer = document.createElement('div') document.body.appendChild(testContainer) @@ -327,18 +325,6 @@ describe('WorktreeJumpPalette', () => { expect(getWorktreeRows()).toEqual([]) }) - it('includes hosts owned only by folders in the host registry', async () => { - await renderPalette({ - repos: [], - worktreesByRepo: {}, - folderWorkspaces: [makeFolderWorkspace({ executionHostId: 'runtime:builder' })], - visibleWorkspaceHostIds: ['runtime:builder'] - }) - - expect(getWorktreeRows()).toHaveLength(1) - expect(getWorktreeRows()[0]).toContain('builder') - }) - it('refreshes the folder catalog while the palette is open', async () => { await renderPalette({ repos: [], worktreesByRepo: {}, folderWorkspaces: [] }) await act(async () => { @@ -350,18 +336,6 @@ describe('WorktreeJumpPalette', () => { expect(getWorktreeRows()).toEqual([]) }) - it('keeps the palette open when folder activation is blocked', async () => { - await renderPalette({ worktreesByRepo: {}, folderWorkspaces: [makeFolderWorkspace()] }) - activateAndRevealWorkspace.mockReturnValue(false) - const row = testContainer.querySelector( - `[data-command-item="${encodePaletteIdentity(['worktree', 'local|folder:folder-1'])}"]` - ) - - await act(async () => fireEvent.click(row!)) - expect(testContainer.querySelector('[data-command-dialog]')).not.toBeNull() - expect(useAppStore.getState().activeModal).toBe('worktree-palette') - }) - it.each([true, false])( 'routes an attached folder from a GitHub number (activation %s)', async (opens) => { @@ -416,31 +390,6 @@ describe('WorktreeJumpPalette', () => { expect(testContainer.textContent).toContain('Design workspace') }) - it('keeps a blocked folder tab jump open without a second error', async () => { - const workspaceId = 'folder:folder-1' - await renderPalette({ - worktreesByRepo: {}, - folderWorkspaces: [makeFolderWorkspace()], - tabsByWorktree: { [workspaceId]: [makeTerminalTab('term-1', workspaceId, 'Research chat')] }, - unifiedTabsByWorktree: { - [workspaceId]: [makeUnifiedTab('tab-1', workspaceId, 'term-1', 'Research chat')] - }, - groupsByWorktree: { [workspaceId]: [makeGroup(workspaceId, ['tab-1'])] } - }) - activateWorkspaceTabPaletteResult.mockReturnValue({ status: 'blocked' }) - await act(async () => setCommandQuery?.('Research')) - await flushEffects() - const row = testContainer.querySelector( - `[data-command-item^="${encodePaletteIdentity(['workspace-tab'])}"]` - ) - expect(row).not.toBeNull() - await act(async () => fireEvent.click(row!)) - - expect(activateWorkspaceTabPaletteResult).toHaveBeenCalled() - expect(testContainer.querySelector('[data-command-dialog]')).not.toBeNull() - expect(toast.error).not.toHaveBeenCalled() - }) - it('keeps every inactive main workspace visible when sleeping workspaces are hidden', async () => { const defaultBranch = makeWorktree('default-branch', 'Default branch workspace', { isMainWorktree: true, @@ -465,21 +414,6 @@ describe('WorktreeJumpPalette', () => { expect(testContainer.textContent).toContain('Folder workspace') }) - it('keeps the explicit default-branch filter authoritative', async () => { - const defaultBranch = makeWorktree('default-branch', 'Default branch workspace', { - isMainWorktree: true, - branch: 'refs/heads/main' - }) - - await renderPalette({ - worktreesByRepo: { 'repo-1': [defaultBranch] }, - showSleepingWorkspaces: false, - hideDefaultBranchWorkspace: true - }) - - expect(testContainer.textContent).not.toContain('Default branch workspace') - }) - it('keeps an active non-default workspace visible when sleeping workspaces are hidden', async () => { const defaultBranch = makeWorktree('default-branch', 'Default branch workspace', { isMainWorktree: true, @@ -519,26 +453,6 @@ describe('WorktreeJumpPalette', () => { expect(testContainer.textContent).toContain('Folder workspace') }) - it('sweeps the sleeping main workspace once the exemption is opted out', async () => { - const defaultBranch = makeWorktree('default-branch', 'Default branch workspace', { - isMainWorktree: true, - branch: 'refs/heads/main' - }) - const feature = makeWorktree('feature', 'Feature workspace', { - branch: 'refs/heads/feature' - }) - - await renderPalette({ - worktreesByRepo: { 'repo-1': [defaultBranch, feature] }, - showSleepingWorkspaces: false, - alwaysShowDefaultBranchWorkspace: false - }) - - expect(getWorktreeRows()).toEqual([]) - expect(testContainer.textContent).not.toContain('Default branch workspace') - expect(testContainer.textContent).not.toContain('Feature workspace') - }) - it('keeps the show-sleeping baseline and empty-query ordering intact', async () => { const defaultBranch = makeWorktree('default-branch', 'Default branch workspace', { isMainWorktree: true, @@ -676,18 +590,6 @@ describe('WorktreeJumpPalette', () => { }) }) - it('keeps the host in a lone row command value', async () => { - const ssh = makeWorktree('single', 'SSH workspace', { hostId: 'ssh:box' }) - - await renderPalette({ worktreesByRepo: { 'repo-1': [ssh] }, showSleepingWorkspaces: true }) - - expect( - testContainer.querySelector( - `[data-command-item="${encodePaletteIdentity(['worktree', 'ssh:box|single'])}"]` - )?.textContent - ).toContain('SSH workspace') - }) - it('routes same-target SSH rows through their paired runtime owner', async () => { const hubA = makeWorktree('shared-runtime', 'Hub A workspace', { hostId: 'ssh:same-private-target', diff --git a/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx b/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx index a7264bb171f5..5a571ec3b066 100644 --- a/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx +++ b/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-task-search.test.tsx @@ -83,22 +83,6 @@ it('publishes a fast source while a second is pending, then discards both after expect(result.current.taskItems).toEqual([]) }) -it('ignores unrelated settings and repo object identity changes', async () => { - const run = vi.fn(async () => [jiraTaskResult]) - vi.mocked(createCmdJTaskSearchRequests).mockReturnValue([ - { id: 'jira', provider: 'jira', hostLabel: 'Local', run } - ]) - const { rerender } = renderHook(useWorktreeJumpPaletteTaskSearch, { initialProps: input }) - await act(async () => vi.advanceTimersByTimeAsync(600)) - rerender({ - ...input, - settings: createGlobalSettingsFixture({ visibleTaskProviders: ['jira'] }), - repos: [] - }) - await act(async () => vi.advanceTimersByTimeAsync(500)) - expect(run).toHaveBeenCalledTimes(1) -}) - it('cancels old searches and ignores their replies after the captured palette host changes', async () => { let finishOldRequest: (results: (typeof jiraTaskResult)[]) => void = () => {} const oldRequest = new Promise<(typeof jiraTaskResult)[]>((resolve) => { diff --git a/src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx b/src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx index 20ca9811ff2b..8a7666010caa 100644 --- a/src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx +++ b/src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx @@ -95,16 +95,6 @@ function listInput(query: string, overrides: Partial = {}): ListInput } describe('Cmd+J website placement', () => { - it('offers the website once as the first selectable row without an empty actions section', () => { - const { result } = renderHook(() => useWorktreeJumpPaletteListEntries(listInput('brex.com'))) - - expect(result.current.listEntries.map((entry) => entry.id)).toEqual([ - 'quick-action:navigate-to-url', - CREATE_WORKTREE_ITEM_ID - ]) - expect(result.current.selectionItemIds[0]).toBe('quick-action:navigate-to-url') - }) - it('preserves issue/PR creation ahead of website navigation', () => { const query = 'https://github.com/acme/project/pull/42' const { result } = renderHook(() => diff --git a/src/renderer/src/components/worktree-jump/worktree-jump-palette-interleaved-sections.test.tsx b/src/renderer/src/components/worktree-jump/worktree-jump-palette-interleaved-sections.test.tsx index 9ac2e04b6f82..9fc41b186be1 100644 --- a/src/renderer/src/components/worktree-jump/worktree-jump-palette-interleaved-sections.test.tsx +++ b/src/renderer/src/components/worktree-jump/worktree-jump-palette-interleaved-sections.test.tsx @@ -11,10 +11,6 @@ import type { Worktree } from '../../../../shared/worktree/types' import { useAppStore } from '@/store/index' import type { AppState } from '@/store/types' import { encodePaletteIdentity } from '../../../../shared/palette-match/palette-ranking' -import { - layoutMultiPrimaryPaletteSections, - orderMultiPrimaryPaletteItems -} from '../cmd-j/palette-section-render-cap' import WorktreeJumpPalette from './WorktreeJumpPalette' vi.mock('react-i18next', async (importOriginal) => { @@ -128,10 +124,6 @@ let setCommandQuery: ((next: string) => void) | null = null const WORKSPACE_TAB_ITEM_PREFIX = encodePaletteIdentity(['workspace-tab']) const WORKTREE_ITEM_PREFIX = encodePaletteIdentity(['worktree']) -function workspaceTabItemId(worktreeId: string, tabId: string): string { - return encodePaletteIdentity(['workspace-tab', '', worktreeId, tabId]) -} - function isWorkspaceTabItemId(id: string): boolean { return id.startsWith(WORKSPACE_TAB_ITEM_PREFIX) } @@ -277,39 +269,6 @@ async function renderPalette(overrides: Partial): Promise { await flushEffects() } -function perfTabsPaletteProps(count: number): Partial { - const tabIds = Array.from({ length: count }, (_, index) => `${index}`) - return { - worktreesByRepo: { - 'repo-1': [ - makeWorktree('wt-tabs', 'tab-host'), - ...Array.from({ length: 5 }, (_, index) => - makeWorktree(`wt-${index}`, `improve-perf-${index}`) - ) - ] - }, - showSleepingWorkspaces: true, - ptyIdsByTabId: Object.fromEntries(tabIds.map((id) => [`term-${id}`, [`pty-${id}`]])), - tabsByWorktree: { - 'wt-tabs': tabIds.map((id) => makeTerminalTab(`term-${id}`, 'wt-tabs', `Perf chat ${id}`)) - }, - unifiedTabsByWorktree: { - 'wt-tabs': tabIds.map((id) => - makeUnifiedTab(`tab-${id}`, 'wt-tabs', `term-${id}`, `Perf chat ${id}`) - ) - }, - groupsByWorktree: { - 'wt-tabs': [ - makeGroup( - 'wt-tabs', - tabIds.map((id) => `tab-${id}`) - ) - ] - }, - activeGroupIdByWorktree: { 'wt-tabs': 'group-wt-tabs' } - } as Partial -} - function getPrimaryRowsBySectionHeader(): { header: string; rowId: string }[] { const headerLabels = new Set(['Open Tabs', 'Workspaces']) const pairs: { header: string; rowId: string }[] = [] @@ -366,202 +325,6 @@ describe('WorktreeJumpPalette interleaved primary sections', () => { } }) - it('renders selectable rows in the same order as orderMultiPrimaryPaletteItems', async () => { - await renderPalette(makeInterleavedQueryState()) - - await act(async () => { - setCommandQuery?.('perf') - }) - await flushEffects() - - const renderedIds = Array.from( - testContainer.querySelectorAll('[data-command-item]') - ) - .map((el) => el.dataset.commandItem!) - .filter((id) => isWorkspaceTabItemId(id) || isWorktreeItemId(id)) - - const tabIds = renderedIds.filter(isWorkspaceTabItemId) - const worktreeIds = renderedIds.filter(isWorktreeItemId) - - const layout = layoutMultiPrimaryPaletteSections({ - leadingItems: tabIds, - trailingItems: worktreeIds - }) - const expectedOrder = orderMultiPrimaryPaletteItems(layout) - expect(renderedIds).toEqual(expectedOrder) - }) - - it('keeps the Open Tabs header when a typed query only hits tabs', async () => { - await renderPalette({ - worktreesByRepo: { - 'repo-1': [makeWorktree('wt-tabs', 'tab-host'), makeWorktree('wt-other', 'docs-only')] - }, - showSleepingWorkspaces: true, - ptyIdsByTabId: { 'term-0': ['pty-0'] }, - tabsByWorktree: { - 'wt-tabs': [makeTerminalTab('term-0', 'wt-tabs', 'ubuntu agent session')] - }, - unifiedTabsByWorktree: { - 'wt-tabs': [makeUnifiedTab('tab-0', 'wt-tabs', 'term-0', 'ubuntu agent session')] - }, - groupsByWorktree: { 'wt-tabs': [makeGroup('wt-tabs', ['tab-0'])] }, - activeGroupIdByWorktree: { 'wt-tabs': 'group-wt-tabs' } - }) - - await act(async () => { - setCommandQuery?.('ubuntu') - }) - await flushEffects() - - const rows = getPrimaryRowsBySectionHeader() - expect(rows).toEqual([{ header: 'Open Tabs', rowId: workspaceTabItemId('wt-tabs', 'tab-0') }]) - expect(testContainer.textContent).toContain('Open Tabs') - expect(testContainer.textContent).not.toContain('Workspaces') - }) - - it('puts the tab title on the left and the worktree name in the badge rail', async () => { - const longTitle = 'macOS Orca App Permission Update Delivery' - await renderPalette({ - worktreesByRepo: { - 'repo-1': [makeWorktree('wt-tabs', 'user-support')] - }, - showSleepingWorkspaces: true, - ptyIdsByTabId: { 'term-0': ['pty-0'] }, - tabsByWorktree: { - 'wt-tabs': [makeTerminalTab('term-0', 'wt-tabs', longTitle)] - }, - unifiedTabsByWorktree: { - 'wt-tabs': [makeUnifiedTab('tab-0', 'wt-tabs', 'term-0', longTitle)] - }, - groupsByWorktree: { 'wt-tabs': [makeGroup('wt-tabs', ['tab-0'])] }, - activeGroupIdByWorktree: { 'wt-tabs': 'group-wt-tabs' } - }) - - const row = testContainer.querySelector( - `[data-command-item="${workspaceTabItemId('wt-tabs', 'tab-0')}"]` - ) - expect(row).not.toBeNull() - const title = row?.querySelector('[data-slot="palette-open-tab-title"]') - const worktree = row?.querySelector('[data-slot="palette-open-tab-worktree"]') - expect(title?.textContent).toBe(longTitle) - expect(title?.classList.contains('min-w-0')).toBe(true) - expect(title?.classList.contains('shrink-0')).toBe(false) - expect(worktree?.textContent).toBe('user-support') - const locationChip = worktree?.closest('[data-slot="palette-location-chip"]') - expect(locationChip).not.toBeNull() - expect(locationChip?.parentElement?.classList.contains('max-w-[40%]')).toBe(true) - expect(locationChip?.parentElement?.classList.contains('min-w-0')).toBe(true) - expect(worktree?.compareDocumentPosition(title ?? document.createElement('span'))).toBe( - Node.DOCUMENT_POSITION_PRECEDING - ) - }) - - it('shows the branch in the location chip when the workspace display name is empty', async () => { - await renderPalette({ - worktreesByRepo: { - 'repo-1': [makeWorktree('wt-tabs', '', { displayName: '' })] - }, - showSleepingWorkspaces: true, - ptyIdsByTabId: { 'term-0': ['pty-0'] }, - tabsByWorktree: { - 'wt-tabs': [makeTerminalTab('term-0', 'wt-tabs', 'Query the API')] - }, - unifiedTabsByWorktree: { - 'wt-tabs': [makeUnifiedTab('tab-0', 'wt-tabs', 'term-0', 'Query the API')] - }, - groupsByWorktree: { 'wt-tabs': [makeGroup('wt-tabs', ['tab-0'])] }, - activeGroupIdByWorktree: { 'wt-tabs': 'group-wt-tabs' } - }) - - const row = testContainer.querySelector( - `[data-command-item="${workspaceTabItemId('wt-tabs', 'tab-0')}"]` - ) - expect(row).not.toBeNull() - const worktree = row?.querySelector('[data-slot="palette-open-tab-worktree"]') - expect(worktree?.textContent).toBe('main') - }) - - it('reveals 20 more entries when clicking the See more button in soft preview', async () => { - await renderPalette(perfTabsPaletteProps(80)) - - await act(async () => { - setCommandQuery?.('perf') - }) - await flushEffects() - - expect(testContainer.textContent).toContain('74 more') - const seeMoreBtn = Array.from(testContainer.querySelectorAll('button')).find((btn) => - btn.textContent?.includes('See more') - ) - expect(seeMoreBtn).toBeDefined() - - await act(async () => { - seeMoreBtn?.click() - }) - await flushEffects() - - expect(testContainer.textContent).toContain('54 more') - expect(testContainer.textContent).toContain('10 more') - }) - - it('expands soft preview when clicking See more even when all rows fit within the hard cap', async () => { - await renderPalette(perfTabsPaletteProps(30)) - - await act(async () => { - setCommandQuery?.('perf') - }) - await flushEffects() - - expect(testContainer.textContent).toContain('24 more') - const seeMoreBtn = Array.from(testContainer.querySelectorAll('button')).find((btn) => - btn.textContent?.includes('See more') - ) - expect(seeMoreBtn).toBeDefined() - - await act(async () => { - seeMoreBtn?.click() - }) - await flushEffects() - - expect(testContainer.textContent).toContain('4 more') - - const seeMoreBtn2 = Array.from(testContainer.querySelectorAll('button')).find((btn) => - btn.textContent?.includes('See more') - ) - expect(seeMoreBtn2).toBeDefined() - - await act(async () => { - seeMoreBtn2?.click() - }) - await flushEffects() - - expect(testContainer.textContent).not.toContain('more') - }) - - it('resets expanded section caps when query changes', async () => { - await renderPalette(perfTabsPaletteProps(80)) - - await act(async () => { - setCommandQuery?.('perf') - }) - await flushEffects() - - const seeMoreBtn = Array.from(testContainer.querySelectorAll('button')).find((btn) => - btn.textContent?.includes('See more') - ) - await act(async () => { - seeMoreBtn?.click() - }) - await flushEffects() - expect(testContainer.textContent).toContain('54 more') - - await act(async () => { - setCommandQuery?.('per') - }) - await flushEffects() - expect(testContainer.textContent).toContain('74 more') - }) - it('allows clicking See more on empty query to expand worktree cap by 20', async () => { const worktrees = Array.from({ length: 35 }, (_, index) => makeWorktree(`wt-${index}`, `project-wt-${index}`) diff --git a/src/renderer/src/components/wsl-host-mark/WslHostMark.test.tsx b/src/renderer/src/components/wsl-host-mark/WslHostMark.test.tsx index bf6b1c62f3bb..33f9b7418f06 100644 --- a/src/renderer/src/components/wsl-host-mark/WslHostMark.test.tsx +++ b/src/renderer/src/components/wsl-host-mark/WslHostMark.test.tsx @@ -3,45 +3,10 @@ import { act, cleanup, render } from '@testing-library/react' import { afterEach, describe, expect, it, vi } from 'vitest' import { TooltipProvider } from '@/components/ui/tooltip' -import { selectWslHostDistro, WslHostMark } from './WslHostMark' +import { WslHostMark } from './WslHostMark' afterEach(cleanup) -const wslEnvironment = { - id: 'env-wsl', - orcadDeployment: { - kind: 'wsl' as const, - distro: 'orca-demo', - localPort: 42000, - remotePort: 6768 - } -} -const sshEnvironment = { - id: 'env-ssh', - orcadDeployment: { - sshTargetId: 'box', - sshTargetGeneration: 1, - localPort: 41000, - remotePort: 6768 - } -} - -describe('selectWslHostDistro', () => { - it('names the distro only for a WSL host runtime', () => { - const s = { runtimeEnvironments: [wslEnvironment, sshEnvironment] } - expect(selectWslHostDistro(s, 'runtime:env-wsl')).toBe('orca-demo') - expect(selectWslHostDistro(s, 'runtime:env-ssh')).toBeNull() - expect(selectWslHostDistro(s, 'runtime:missing')).toBeNull() - expect(selectWslHostDistro(s, 'local')).toBeNull() - expect(selectWslHostDistro(s, 'ssh:box')).toBeNull() - expect(selectWslHostDistro(s, null)).toBeNull() - }) - - it('reads no distro before the environments load', () => { - expect(selectWslHostDistro({}, 'runtime:env-wsl')).toBeNull() - }) -}) - describe('WslHostMark', () => { it('is a penguin named for screen readers, with the full host in its tooltip', async () => { const view = render( @@ -64,12 +29,4 @@ describe('WslHostMark', () => { ) ) }) - - it('leaves the tooltip to the row when asked', () => { - const view = render() - const mark = view.getByRole('img', { name: 'Runs on WSL: orca-demo (Linux)' }) - // The row owns focus and the tooltip, so the mark adds no tab stop. - expect(mark.hasAttribute('tabindex')).toBe(false) - expect(view.container.querySelector('[data-slot="tooltip-trigger"]')).toBeNull() - }) }) diff --git a/src/renderer/src/components/wsl-host-stopped/WslHostStoppedWorkspaceNotice.test.tsx b/src/renderer/src/components/wsl-host-stopped/WslHostStoppedWorkspaceNotice.test.tsx deleted file mode 100644 index aeafce8b6ecd..000000000000 --- a/src/renderer/src/components/wsl-host-stopped/WslHostStoppedWorkspaceNotice.test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { renderToStaticMarkup } from 'react-dom/server' -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { WslHostStoppedWorkspaceNotice } from './WslHostStoppedWorkspaceNotice' - -type MockState = { - wslHostStatuses: Record - unifiedTabsByWorktree: Record - tabsByWorktree: Record - browserTabsByWorktree: Record - openFiles: { worktreeId: string }[] -} - -let mockState: MockState - -vi.mock('@/store', () => ({ - useAppStore: (selector: (state: MockState) => unknown) => selector(mockState) -})) -vi.mock('../terminal-pane/remote-server-outage', () => ({ - selectWorkspaceRuntimeEnvironmentId: (_state: unknown, worktreeId: string | null) => - worktreeId === 'wt-wsl' ? 'wsl:ubuntu' : null -})) -vi.mock('../terminal-pane/use-wsl-host-unavailable-reason', () => ({ - selectWslHostEnvironmentUnavailableReason: () => null -})) - -describe('WslHostStoppedWorkspaceNotice', () => { - beforeEach(() => { - mockState = { - wslHostStatuses: { - 'wsl:ubuntu': { state: 'distro-stopped', distro: 'Ubuntu' } - }, - unifiedTabsByWorktree: {}, - tabsByWorktree: {}, - browserTabsByWorktree: {}, - openFiles: [] - } - }) - - it('offers Start in a workspace with no tabs whose host is stopped', () => { - const markup = renderToStaticMarkup() - expect(markup).toContain('Ubuntu is stopped') - expect(markup).toContain('Start') - }) - - it('stays out of a workspace that has a tab, since that surface shows its own Start', () => { - mockState.unifiedTabsByWorktree = { 'wt-wsl': [{ id: 'tab-1' }] } - expect(renderToStaticMarkup()).toBe('') - mockState.unifiedTabsByWorktree = {} - mockState.openFiles = [{ worktreeId: 'wt-wsl' }] - expect(renderToStaticMarkup()).toBe('') - }) - - it('stays out of a running host, a local workspace and no workspace', () => { - expect(renderToStaticMarkup()).toBe('') - expect(renderToStaticMarkup()).toBe('') - mockState.wslHostStatuses = { - 'wsl:ubuntu': { state: 'ready', distro: 'Ubuntu' } - } - expect(renderToStaticMarkup()).toBe('') - }) -}) diff --git a/src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx b/src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx index fbbfbbb5f263..1fff34b560ef 100644 --- a/src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx +++ b/src/renderer/src/components/wsl-move/WslMoveDialog.test.tsx @@ -56,14 +56,6 @@ function result(value: WslMoveResult, reload: 'idle' | 'checkpoint-refused' = 'i } describe('preview', () => { - it('says why to move, that projects keep working as before, and the way back', () => { - const why = preview().match(/data-testid="wsl-move-why">([^<]*) { expect(preview({ preview: null })).toContain('Checking the selected projects') expect(preview({ preview: null })).toMatch(/disabled=""[^>]*>Move 1 project/) diff --git a/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts b/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts index c1fe2f416f1a..a2d6d123ba2d 100644 --- a/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts +++ b/src/renderer/src/hooks/agent-hook-completion-notifications.test.ts @@ -230,84 +230,6 @@ describe('agent hook completion notifications', () => { expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) }) - it('uses tab-level PTY liveness when an inactive pane leaf binding is temporarily missing', async () => { - mockStoreState.terminalLayoutsByTabId = { - 'tab-1': { - root: { type: 'leaf', leafId: '11111111-1111-4111-8111-111111111111' }, - activeLeafId: '11111111-1111-4111-8111-111111111111', - expandedLeafId: null, - ptyIdsByLeafId: {} - } - } - const { observeAgentHookCompletionForNotification } = - await import('./agent-hook-completion-notifications') - - observeAgentHookCompletionForNotification({ - paneKey, - worktreeId: 'wt-1', - payload: hookStatus('working') - }) - observeAgentHookCompletionForNotification({ - paneKey, - worktreeId: 'wt-1', - payload: hookStatus('done') - }) - vi.advanceTimersByTime(HOOK_DONE_QUIET_MS) - - expect(dispatchTerminalNotification).toHaveBeenCalledWith( - 'wt-1', - expect.objectContaining({ - source: 'agent-task-complete', - paneKey, - agentStatusSnapshot: expect.objectContaining({ - state: 'done', - agentType: 'codex', - prompt: 'implement notifications', - lastAssistantMessage: 'Done.' - }) - }) - ) - }) - - it('uses tab-level PTY liveness when an inactive layout is empty', async () => { - mockStoreState.terminalLayoutsByTabId = { - 'tab-1': { - root: null, - activeLeafId: null, - expandedLeafId: null, - ptyIdsByLeafId: {} - } - } - const { observeAgentHookCompletionForNotification } = - await import('./agent-hook-completion-notifications') - - observeAgentHookCompletionForNotification({ - paneKey, - worktreeId: 'wt-1', - payload: hookStatus('working') - }) - observeAgentHookCompletionForNotification({ - paneKey, - worktreeId: 'wt-1', - payload: hookStatus('done') - }) - vi.advanceTimersByTime(HOOK_DONE_QUIET_MS) - - expect(dispatchTerminalNotification).toHaveBeenCalledWith( - 'wt-1', - expect.objectContaining({ - source: 'agent-task-complete', - paneKey, - agentStatusSnapshot: expect.objectContaining({ - state: 'done', - agentType: 'codex', - prompt: 'implement notifications', - lastAssistantMessage: 'Done.' - }) - }) - ) - }) - it('uses accepted hook status for an inactive tab before PTY liveness catches up', async () => { mockStoreState.ptyIdsByTabId = { 'tab-1': [] @@ -385,30 +307,6 @@ describe('agent hook completion notifications', () => { expect(dispatchTerminalNotification).toHaveBeenCalledTimes(1) }) - it('prunes retained coordinators when pane liveness is removed from the store', async () => { - const { - _getAgentHookCompletionNotificationCoordinatorCountForTest, - observeAgentHookCompletionForNotification, - syncAgentHookCompletionNotificationSettings - } = await import('./agent-hook-completion-notifications') - - observeAgentHookCompletionForNotification({ - paneKey, - worktreeId: 'wt-1', - payload: hookStatus('working') - }) - - expect(_getAgentHookCompletionNotificationCoordinatorCountForTest()).toBe(1) - - mockStoreState.ptyIdsByTabId = { - 'tab-1': [] - } - mockStoreState.tabsByWorktree = {} - syncAgentHookCompletionNotificationSettings() - - expect(_getAgentHookCompletionNotificationCoordinatorCountForTest()).toBe(0) - }) - it('does not start a coordinator for an intentionally suppressed pty', async () => { mockStoreState.ptyIdsByTabId = { 'tab-1': [] diff --git a/src/renderer/src/hooks/automation-agent-status-entry-change.test.ts b/src/renderer/src/hooks/automation-agent-status-entry-change.test.ts index 7079f81af8d4..565fb593ea28 100644 --- a/src/renderer/src/hooks/automation-agent-status-entry-change.test.ts +++ b/src/renderer/src/hooks/automation-agent-status-entry-change.test.ts @@ -43,24 +43,4 @@ describe('selectAutomationAgentStatusEntryChange', () => { ).toBe(UNCHANGED_AUTOMATION_AGENT_STATUS_ENTRY) expect(enumerations).toBe(0) }) - - it('reports removal and ignores inherited or non-enumerable entries', () => { - const targetPaneKey = 'target-tab:leaf' - const previousEntry = makeEntry(targetPaneKey) - const inheritedEntries = Object.create({ [targetPaneKey]: previousEntry }) as Record< - string, - AgentStatusEntry - > - const nonEnumerableEntries = Object.defineProperty({}, targetPaneKey, { - value: previousEntry - }) as Record - - expect(selectAutomationAgentStatusEntryChange({}, targetPaneKey, previousEntry)).toBeUndefined() - expect(selectAutomationAgentStatusEntryChange(inheritedEntries, targetPaneKey, undefined)).toBe( - UNCHANGED_AUTOMATION_AGENT_STATUS_ENTRY - ) - expect( - selectAutomationAgentStatusEntryChange(nonEnumerableEntries, targetPaneKey, undefined) - ).toBe(UNCHANGED_AUTOMATION_AGENT_STATUS_ENTRY) - }) }) diff --git a/src/renderer/src/hooks/composer-branch-selection.test.ts b/src/renderer/src/hooks/composer-branch-selection.test.ts index 7a1b6323a4c1..46ecd9ddc783 100644 --- a/src/renderer/src/hooks/composer-branch-selection.test.ts +++ b/src/renderer/src/hooks/composer-branch-selection.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it } from 'vitest' import { - getComposerRepoWorktreeBranches, isBranchCheckedOutInWorktrees, resolveComposerBranchNameOverrideForCreate, resolveComposerBranchReuse, @@ -70,19 +69,6 @@ describe('resolveComposerBranchSelection', () => { ).toBe('feature/manual') }) - it('drops empty or missing branch-name overrides even when preserving workspace edits', () => { - for (const branchNameOverride of [undefined, '']) { - expect( - resolveComposerBranchNameOverrideForCreate({ - branchNameOverride, - branchAutoName: 'feature/fix', - workspaceName: 'edited display name', - preserveWorkspaceNameEdits: true - }) - ).toBeUndefined() - } - }) - it('keeps existing branch picker override behavior tied to the auto-name', () => { expect( resolveComposerBranchNameOverrideForCreate({ @@ -208,32 +194,7 @@ describe('isBranchCheckedOutInWorktrees', () => { }) }) -describe('getComposerRepoWorktreeBranches', () => { - it('supplies only the selected repo branches to reuse eligibility', () => { - expect( - getComposerRepoWorktreeBranches( - [ - { repoId: 'repo-a', branch: 'feature/a' }, - { repoId: 'repo-b', branch: 'feature/b' } - ], - 'repo-a' - ) - ).toEqual(['feature/a']) - }) -}) - describe('resolveComposerReuseOverride', () => { - it('keeps the selection override for a reusable (non-busy) local branch', () => { - expect( - resolveComposerReuseOverride({ - refName: 'feature-x', - localBranchName: 'feature-x', - branchNameOverride: 'feature-x', - branchCheckedOutElsewhere: false - }) - ).toBe('feature-x') - }) - it('drops the override for a local branch checked out in another worktree', () => { // Why: pinning a busy branch would collide and produce a suffixed branch. expect( @@ -284,25 +245,6 @@ describe('resolveComposerBranchReuse', () => { }) ).toBeUndefined() }) - it('marks an existing local branch reusable and defaults reuse ON for an auto-derived name', () => { - expect( - resolveComposerBranchReuse({ - refName: 'feature-x', - localBranchName: 'feature-x', - branchCheckedOutElsewhere: false - }) - ).toEqual({ reuseEligibleBranch: 'feature-x', defaultReuse: true }) - }) - - it('offers reuse for a remote-only ref', () => { - expect( - resolveComposerBranchReuse({ - refName: 'origin/feature/something', - localBranchName: 'feature/something', - branchCheckedOutElsewhere: false - }) - ).toEqual({ reuseEligibleBranch: 'feature/something', defaultReuse: true }) - }) it('retains reuse intent for a busy branch so the host can report or open its workspace', () => { expect( diff --git a/src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx b/src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx deleted file mode 100644 index 18c28ff58462..000000000000 --- a/src/renderer/src/hooks/composer-state/attachment-drop-failure.test.tsx +++ /dev/null @@ -1,86 +0,0 @@ -// @vitest-environment happy-dom - -import { act, renderHook } from '@testing-library/react' -import { createRef } from 'react' -import type { Dispatch, SetStateAction } from 'react' -import { beforeEach, describe, expect, it, vi } from 'vitest' - -const mocks = vi.hoisted(() => ({ toastError: vi.fn(), importExternalPaths: vi.fn() })) - -vi.mock('sonner', () => ({ toast: { error: mocks.toastError, message: vi.fn() } })) -vi.mock('@/store', () => ({ - useAppStore: Object.assign(() => undefined, { getState: () => ({}) }) -})) -vi.mock('@/runtime/runtime-file-import-client', () => ({ - importExternalPathsToRuntime: (...args: unknown[]) => mocks.importExternalPaths(...args) -})) - -import { useAttachmentDropState } from './attachment-drop-state' - -const FAILING_PATHS = new Set(['/drop/bad-1.png', '/drop/bad-2.png', '/drop/bad-3.png']) - -function dropPaths(count: number): string[] { - return [ - ...FAILING_PATHS, - ...Array.from({ length: count - FAILING_PATHS.size }, (_, index) => `/drop/ok-${index}.png`) - ] -} - -function installFsApi(): void { - Object.assign(window, { - api: { - fs: { - stat: vi.fn(async ({ filePath }: { filePath: string }) => { - if (FAILING_PATHS.has(filePath)) { - throw new Error( - "Error invoking remote method 'fs:stat': Error: ENOENT: no such file or directory" - ) - } - return { isDirectory: false } - }) - } - } - }) -} - -function renderDropState(setAttachmentPaths: Dispatch>) { - return renderHook(() => - useAttachmentDropState({ - agentPromptRef: { current: '' }, - cancelPromptCaretFrame: () => {}, - connectionId: null, - promptCaretFrameRef: { current: null }, - promptTextareaRef: createRef(), - selectedRepoPath: '/repo', - selectedRepoRuntimeEnvironmentId: null, - selectedWorktreeId: null, - setAgentPrompt: () => {}, - setAttachmentPaths - }) - ) -} - -beforeEach(() => { - vi.clearAllMocks() - installFsApi() -}) - -describe('local composer drop failures', () => { - it('reports partially skipped paths in one aggregated toast and still attaches the rest', async () => { - const attached: string[] = [] - const { result } = renderDropState((next) => { - attached.push(...(typeof next === 'function' ? next([]) : next)) - }) - - await act(async () => { - await result.current.applyLocalComposerDrop(dropPaths(12)) - }) - - expect(mocks.toastError).toHaveBeenCalledTimes(1) - const [title, options] = mocks.toastError.mock.calls[0] ?? [] - expect(title).toBe('3 of 12 items could not be attached.') - expect(options.description).toBe('No longer at its original path.') - expect(attached).toHaveLength(9) - expect(attached).not.toContain('/drop/bad-1.png') - }) -}) diff --git a/src/renderer/src/hooks/composer-state/composer-name-source-selection.test.ts b/src/renderer/src/hooks/composer-state/composer-name-source-selection.test.ts index b4a3e2b6709a..c3711c1b269e 100644 --- a/src/renderer/src/hooks/composer-state/composer-name-source-selection.test.ts +++ b/src/renderer/src/hooks/composer-state/composer-name-source-selection.test.ts @@ -3,7 +3,6 @@ import { act, renderHook } from '@testing-library/react' import { describe, expect, it, vi } from 'vitest' import { useIssueSourceActions } from './issue-source-actions' -import { resolveDraftBaseBranchNamesWorkspace } from './workspace-identity-state' import { useGitHubProviderSelection } from './github-provider-selection' import type { LinearIssue } from '../../../../shared/linear/issue-types' @@ -216,29 +215,3 @@ describe('composer name source selection', () => { expect(result.current.smartNameSelection?.kind).toBe('github-issue') }) }) - -describe('base ref intent across a draft round trip', () => { - it('restores a base ref chosen in the picker as a base, not as a name source', () => { - expect(resolveDraftBaseBranchNamesWorkspace({ persistDraft: true, draftValue: false })).toBe( - false - ) - }) - - it('restores a branch picked in the name field as a name source', () => { - expect(resolveDraftBaseBranchNamesWorkspace({ persistDraft: true, draftValue: true })).toBe( - true - ) - }) - - it('treats a draft written before the flag existed as a name source', () => { - expect( - resolveDraftBaseBranchNamesWorkspace({ persistDraft: true, draftValue: undefined }) - ).toBe(true) - }) - - it('ignores any stored intent when the composer does not persist drafts', () => { - expect(resolveDraftBaseBranchNamesWorkspace({ persistDraft: false, draftValue: false })).toBe( - true - ) - }) -}) diff --git a/src/renderer/src/hooks/direct-ssh-state-routing.test.ts b/src/renderer/src/hooks/direct-ssh-state-routing.test.ts deleted file mode 100644 index 5b324773fca7..000000000000 --- a/src/renderer/src/hooks/direct-ssh-state-routing.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -// @vitest-environment happy-dom -import { describe, expect, it } from 'vitest' -import type { DirectSshAuthority, SshProviderEpoch } from '../../../shared/ssh-types' -import { directSshAuthorityFromConnectionState } from './direct-ssh-state-routing' - -function authority(epoch = 'epoch-a'): DirectSshAuthority { - return { - targetId: 'target-a', - providerEpoch: epoch as SshProviderEpoch, - connectionGeneration: 1 - } -} - -describe('directSshAuthorityFromConnectionState', () => { - it('rejects mismatched keys and malformed partial authority', () => { - expect( - directSshAuthorityFromConnectionState('other-target', { - ...authority(), - status: 'connected', - error: null, - reconnectAttempt: 0 - }) - ).toBeNull() - expect( - directSshAuthorityFromConnectionState('target-a', { - targetId: 'target-a', - status: 'connected', - error: null, - reconnectAttempt: 0, - connectionGeneration: 1 - }) - ).toBeNull() - }) -}) diff --git a/src/renderer/src/hooks/editor-external-watch-overflow.test.ts b/src/renderer/src/hooks/editor-external-watch-overflow.test.ts index 12e58286510b..5937f28e3255 100644 --- a/src/renderer/src/hooks/editor-external-watch-overflow.test.ts +++ b/src/renderer/src/hooks/editor-external-watch-overflow.test.ts @@ -111,21 +111,6 @@ describe('reconcileEditorTabsAfterOverflow', () => { expect(setExternalMutation).not.toHaveBeenCalledWith('a.ts', 'deleted') }) - it('compares dirty tabs asynchronously without reloading them', () => { - setTabs(tab('dirty.ts', { isDirty: true, lastKnownDiskSignature: 'sig' })) - reconcileEditorTabsAfterOverflow(target, true) - - expect(harness.compareDirty).toHaveBeenCalledWith( - { ...target, connectionId: undefined, runtimeEnvironmentId: null }, - ['dirty.ts'], - false, - true - ) - expect(setExternalMutation).not.toHaveBeenCalled() - expect(harness.runtimePathsExist).not.toHaveBeenCalled() - expect(harness.scheduleReload).not.toHaveBeenCalled() - }) - it('a storm overflow reloads clean tabs without probing or dropping combined bodies', () => { setTabs( tab('a.md', { externalMutation: 'deleted' }),