From e7cfc542080e871f5e1d35ece3d1722368d1dfd5 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Tue, 3 Nov 2026 04:18:12 -0800 Subject: [PATCH] test: remove 18 low-value renderer and web tests (#37809) --- config/reliability-gates.jsonc | 5 +- config/scripts/ci-shard-timings.json | 4 - .../ui/ui-slice-surface-actions.test.ts | 9 -- .../worktrees-fetch-listing-merge.test.ts | 19 ---- .../worktrees-fetch-owner-routing.test.ts | 80 ---------------- ...-fetch-persisted-metadata-fallback.test.ts | 50 ---------- .../worktrees-fetch-removal-purge.test.ts | 80 ---------------- .../slices/worktrees-lineage-state.test.ts | 44 --------- .../worktrees-metadata-persistence.test.ts | 34 ------- .../worktrees-pending-creation-state.test.ts | 14 --- .../worktrees-recent-stamp-switch-on.test.ts | 94 ------------------- .../worktrees-remote-runtime-create.test.ts | 72 -------------- .../worktrees-terminal-pr-url-linking.test.ts | 38 -------- .../terminal-tab-mirrored-id.test.ts | 29 ------ .../web-ai-vault-search-compat.test.ts | 36 ------- .../web-shell-attachment-picker.test.ts | 35 ------- 16 files changed, 3 insertions(+), 640 deletions(-) delete mode 100644 src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts delete mode 100644 src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts delete mode 100644 src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts delete mode 100644 src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 0744ab3c1d8..7704f4390bb 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -10623,7 +10623,7 @@ "providers": ["local", "remote-runtime", "ssh", "wsl"], "coveredPlatforms": ["macos"], "coveredProviders": ["local", "remote-runtime", "ssh", "wsl"], - "coverageNotes": "This audit removes browser generic Active Server settings isolation and unknown-choice examples; their direct preference and rejection alarms are lost. Other routing evidence is not an equivalent replacement. Historical commands and results remain historical. Platform-neutral deterministic tests separate the durable Active Server preference from per-client connection, selected-workspace, browser-session, Add Project, and execution-host routing. The composed regression models Local desktop -> connect/navigate Windows 2 -> reveal a local terminal -> restart. Multi-client browser host overrides, multi-server profile caches, generic settings IPC rejection, local and remote workspace ownership, Add Project eligibility/owner capture/stale-result fencing, host-qualified group/folder/worktree identity, and restart reset of transient routing are covered. A visible macOS Orca desktop server plus separate paired Electron and web clients prove selected-runtime Add Project operations and disabled creation when the only listed host is blocked or unavailable; headless-server parity also passed. Live Linux, Windows, WSL, and SSH Add Project journeys remain uncollected. The static wrapper-rendering suite was removed during the low-value-test audit; its supplied-prop host-browser and control-visibility output assertions are no longer checked by that suite. This removal supplies no new runtime-routing evidence. The fake-React Clone hook unit suite was also retired: its captured-owner and same-ID sibling assertions no longer supply unit evidence. Historical run commands and counts remain historical; this retirement adds no runtime-routing, cross-platform, or mobile evidence. The test-value audit narrowed resolved-worktree-execution-host.test.ts to cache reuse and invalidation. Its direct hydrated-worktree, missing-folder, restored-owner, host-stamp and empty-runtime selection alarms are lost. Other routing and recovery suites do not establish equivalent selector coverage; historical run commands and results remain historical. The test-value audit narrowed worktree-runtime-owner.test.ts to deterministic owner-lookup work bounds with correct worktree/folder results and changed-collection invalidation. Its separate host/default/folder/mirror inventory alarms are lost; these retained in-memory checks establish no actual host delivery, restart or equivalent replacement coverage. Historical run commands and results remain historical. web-runtime-session.test.ts no longer supplies the terminal/browser/staged-browser explicit-host collision assertions formerly referenced here. Those direct routing alarms are lost; the remaining selector and live routing evidence does not establish equivalent replacement coverage. The test-value audit removes the direct host/provider/project-setup selector tables. selectors.test.ts retains only floating-tab/unread scan-cost checks, which supply no current Active Server routing evidence. Its separate missing-runtime/no-local-fallback and owner-choice alarms are lost; other gate evidence is not an equivalent replacement. Historical executed commands and results remain historical. browser.test.ts no longer supplies the host/profile projection examples. Current routing commands and references name the retained deferred host-list/import completion tests in browser-session-host-selection.test.ts instead. Its actual source supports stale-completion fencing; it does not establish the formerly listed multi-client selection or restart-reset claims. Other evidence is not an equivalent replacement; historical executed commands/counts/results remain historical. The test-value audit deletes repos-paired-runtime-add.test.ts. Its supplied-result assertion that an explicitly selected paired host receives repo.add with the selected path, folder kind and 15000ms timeout while native repos.add and pickFolder remain unused is intentionally lost. Other gate evidence is not an equivalent replacement. Historical executed commands, counts and results remain unchanged. The test-value audit narrows repos-selected-owner-routing.test.ts to an overlapping selected-runtime import/local refresh, reversed same-host folder replies, and group/folder replies crossing an actual pairing revision. Its separate same-ID host-partition, desktop-only pruning, sequential explicit-runtime preservation, and SSH scan/cancel forwarding alarms are intentionally lost. The stale-response case overwrites its group result before the final assertion, so it supplies only a folder stale-response alarm. The catalog-reconciliation caller also retires the refresh-identity and runtime-visibility-default registrars: their immediate reference/field/count, filter/dismissal, readoption-inventory, timestamp and settings/capability-copy/retention alarms are lost. No equivalent replacement or new live host, restart, platform or mobile evidence is claimed; historical executed commands, counts and results remain unchanged. The test-value audit removes the reversed-order direct worktree lookup example from selected-host-active-workspace-identity.test.ts. Its explicit-runtime path lookup with reversed same-ID catalog rows is intentionally lost; that example did not activate a workspace. After the subsequent audit, current assertions in this suite name only the retained local-first worktree activation; the selected-runtime folder/group host-echo example was removed. They are not equivalent replacements for the reversed-order lookup alarm. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit narrows renderer store settings.test.ts by removing immediate authoritative-settings/response rebasing, checked-failure forwarding, best-effort logging, mobile-address/provider normalization, successful catalog-start, hand-seeded partial-status coverage and ghost-status filtering examples. Those direct response, normalization, error and catalog-projection alarms are intentionally lost. The runtime focus-switch resource/draft preservation, unreachable/incompatible refusal and held catalog coalescing/retry/staleness cases remain; they are not equivalent replacements for the removed alarms. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit narrows worktrees-fetch-owner-routing.test.ts by removing default-local transport selection, ownerless runtime stamping, isolated force-local routing, and mocked mobile-denial/toast examples. Those direct routing, field and presentation alarms are lost. Retained concurrency and authority-fencing cases do not establish equivalent replacement coverage or live host, platform, restart or mobile evidence. Historical commands, counts and results remain unchanged. The test-value audit removes the separate paired-web host-switch resource-preservation example from renderer store settings.test.ts. Its explicit web-mode terminal/browser no-close and retained PTY/remote-browser-handle alarms are intentionally lost. The surviving desktop host-merge, resource/draft preservation, refusal and catalog retry/coalescing/staleness cases are not equivalent replacement coverage. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit removes the selected-runtime folder/group activation example from selected-host-active-workspace-identity.test.ts. That large same-ID fixture only asserted that the explicit host argument was stored and read back; it did not check the chosen folder path, group or delivered operation. Its narrow non-rejection/host-echo alarm is intentionally lost. Only the local-first worktree case that independently checks the returned runtime path remains in this suite. Historical executed commands, counts and results remain unchanged; no equivalent replacement or new live-host evidence is claimed.", + "coverageNotes": "This audit removes browser generic Active Server settings isolation and unknown-choice examples; their direct preference and rejection alarms are lost. Other routing evidence is not an equivalent replacement. Historical commands and results remain historical. Platform-neutral deterministic tests separate the durable Active Server preference from per-client connection, selected-workspace, browser-session, Add Project, and execution-host routing. The composed regression models Local desktop -> connect/navigate Windows 2 -> reveal a local terminal -> restart. Multi-client browser host overrides, multi-server profile caches, generic settings IPC rejection, local and remote workspace ownership, Add Project eligibility/owner capture/stale-result fencing, host-qualified group/folder/worktree identity, and restart reset of transient routing are covered. A visible macOS Orca desktop server plus separate paired Electron and web clients prove selected-runtime Add Project operations and disabled creation when the only listed host is blocked or unavailable; headless-server parity also passed. Live Linux, Windows, WSL, and SSH Add Project journeys remain uncollected. The static wrapper-rendering suite was removed during the low-value-test audit; its supplied-prop host-browser and control-visibility output assertions are no longer checked by that suite. This removal supplies no new runtime-routing evidence. The fake-React Clone hook unit suite was also retired: its captured-owner and same-ID sibling assertions no longer supply unit evidence. Historical run commands and counts remain historical; this retirement adds no runtime-routing, cross-platform, or mobile evidence. The test-value audit narrowed resolved-worktree-execution-host.test.ts to cache reuse and invalidation. Its direct hydrated-worktree, missing-folder, restored-owner, host-stamp and empty-runtime selection alarms are lost. Other routing and recovery suites do not establish equivalent selector coverage; historical run commands and results remain historical. The test-value audit narrowed worktree-runtime-owner.test.ts to deterministic owner-lookup work bounds with correct worktree/folder results and changed-collection invalidation. Its separate host/default/folder/mirror inventory alarms are lost; these retained in-memory checks establish no actual host delivery, restart or equivalent replacement coverage. Historical run commands and results remain historical. web-runtime-session.test.ts no longer supplies the terminal/browser/staged-browser explicit-host collision assertions formerly referenced here. Those direct routing alarms are lost; the remaining selector and live routing evidence does not establish equivalent replacement coverage. The test-value audit removes the direct host/provider/project-setup selector tables. selectors.test.ts retains only floating-tab/unread scan-cost checks, which supply no current Active Server routing evidence. Its separate missing-runtime/no-local-fallback and owner-choice alarms are lost; other gate evidence is not an equivalent replacement. Historical executed commands and results remain historical. browser.test.ts no longer supplies the host/profile projection examples. Current routing commands and references name the retained deferred host-list/import completion tests in browser-session-host-selection.test.ts instead. Its actual source supports stale-completion fencing; it does not establish the formerly listed multi-client selection or restart-reset claims. Other evidence is not an equivalent replacement; historical executed commands/counts/results remain historical. The test-value audit deletes repos-paired-runtime-add.test.ts. Its supplied-result assertion that an explicitly selected paired host receives repo.add with the selected path, folder kind and 15000ms timeout while native repos.add and pickFolder remain unused is intentionally lost. Other gate evidence is not an equivalent replacement. Historical executed commands, counts and results remain unchanged. The test-value audit narrows repos-selected-owner-routing.test.ts to an overlapping selected-runtime import/local refresh, reversed same-host folder replies, and group/folder replies crossing an actual pairing revision. Its separate same-ID host-partition, desktop-only pruning, sequential explicit-runtime preservation, and SSH scan/cancel forwarding alarms are intentionally lost. The stale-response case overwrites its group result before the final assertion, so it supplies only a folder stale-response alarm. The catalog-reconciliation caller also retires the refresh-identity and runtime-visibility-default registrars: their immediate reference/field/count, filter/dismissal, readoption-inventory, timestamp and settings/capability-copy/retention alarms are lost. No equivalent replacement or new live host, restart, platform or mobile evidence is claimed; historical executed commands, counts and results remain unchanged. The test-value audit removes the reversed-order direct worktree lookup example from selected-host-active-workspace-identity.test.ts. Its explicit-runtime path lookup with reversed same-ID catalog rows is intentionally lost; that example did not activate a workspace. After the subsequent audit, current assertions in this suite name only the retained local-first worktree activation; the selected-runtime folder/group host-echo example was removed. They are not equivalent replacements for the reversed-order lookup alarm. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit narrows renderer store settings.test.ts by removing immediate authoritative-settings/response rebasing, checked-failure forwarding, best-effort logging, mobile-address/provider normalization, successful catalog-start, hand-seeded partial-status coverage and ghost-status filtering examples. Those direct response, normalization, error and catalog-projection alarms are intentionally lost. The runtime focus-switch resource/draft preservation, unreachable/incompatible refusal and held catalog coalescing/retry/staleness cases remain; they are not equivalent replacements for the removed alarms. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit narrows worktrees-fetch-owner-routing.test.ts by removing default-local transport selection, ownerless runtime stamping, isolated force-local routing, and mocked mobile-denial/toast examples. Those direct routing, field and presentation alarms are lost. Retained concurrency and authority-fencing cases do not establish equivalent replacement coverage or live host, platform, restart or mobile evidence. Historical commands, counts and results remain unchanged. The test-value audit removes the separate paired-web host-switch resource-preservation example from renderer store settings.test.ts. Its explicit web-mode terminal/browser no-close and retained PTY/remote-browser-handle alarms are intentionally lost. The surviving desktop host-merge, resource/draft preservation, refusal and catalog retry/coalescing/staleness cases are not equivalent replacement coverage. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed. The test-value audit removes the selected-runtime folder/group activation example from selected-host-active-workspace-identity.test.ts. That large same-ID fixture only asserted that the explicit host argument was stored and read back; it did not check the chosen folder path, group or delivered operation. Its narrow non-rejection/host-echo alarm is intentionally lost. Only the local-first worktree case that independently checks the returned runtime path remains in this suite. Historical executed commands, counts and results remain unchanged; no equivalent replacement or new live-host evidence is claimed. The continued test-value audit narrows worktrees-fetch-owner-routing.test.ts by retiring the simple explicit-local duplicate-repo request and runtime-only host-stamping examples. Those exact request-option and supplied-row alarms are intentionally lost. The retained force-local sibling-preservation and project-setup stamping cases use different inputs and are not equivalent replacements. Historical commands, counts and results remain unchanged; no live-host, restart, platform or mobile evidence is added.", "motivatingLinks": [ "https://github.com/stablyai/orca/pull/9687", "https://linear.app/stably/issue/STA-4024/p1-paired-web-add-project-enables-unavailable-host-fallback-after-pr" @@ -10889,7 +10889,8 @@ "The test-value audit narrows renderer store settings.test.ts by removing immediate authoritative-settings/response rebasing, checked-failure forwarding, best-effort logging, mobile-address/provider normalization, successful catalog-start, hand-seeded partial-status coverage and ghost-status filtering examples. Those direct response, normalization, error and catalog-projection alarms are intentionally lost. The runtime focus-switch resource/draft preservation, unreachable/incompatible refusal and held catalog coalescing/retry/staleness cases remain; they are not equivalent replacements for the removed alarms. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed.", "The test-value audit narrows worktrees-fetch-owner-routing.test.ts by removing default-local transport selection, ownerless runtime stamping, isolated force-local routing, and mocked mobile-denial/toast examples. Those direct routing, field and presentation alarms are lost. Retained concurrency and authority-fencing cases do not establish equivalent replacement coverage or live host, platform, restart or mobile evidence. Historical commands, counts and results remain unchanged.", "The test-value audit removes the separate paired-web host-switch resource-preservation example from renderer store settings.test.ts. Its explicit web-mode terminal/browser no-close and retained PTY/remote-browser-handle alarms are intentionally lost. The surviving desktop host-merge, resource/draft preservation, refusal and catalog retry/coalescing/staleness cases are not equivalent replacement coverage. Historical executed commands, counts and results remain unchanged; no new live host, restart, platform or mobile evidence is claimed.", - "The test-value audit removes the selected-runtime folder/group activation example from selected-host-active-workspace-identity.test.ts. That large same-ID fixture only asserted that the explicit host argument was stored and read back; it did not check the chosen folder path, group or delivered operation. Its narrow non-rejection/host-echo alarm is intentionally lost. Only the local-first worktree case that independently checks the returned runtime path remains in this suite. Historical executed commands, counts and results remain unchanged; no equivalent replacement or new live-host evidence is claimed." + "The test-value audit removes the selected-runtime folder/group activation example from selected-host-active-workspace-identity.test.ts. That large same-ID fixture only asserted that the explicit host argument was stored and read back; it did not check the chosen folder path, group or delivered operation. Its narrow non-rejection/host-echo alarm is intentionally lost. Only the local-first worktree case that independently checks the returned runtime path remains in this suite. Historical executed commands, counts and results remain unchanged; no equivalent replacement or new live-host evidence is claimed.", + "The continued test-value audit narrows worktrees-fetch-owner-routing.test.ts by retiring the simple explicit-local duplicate-repo request and runtime-only host-stamping examples. Those exact request-option and supplied-row alarms are intentionally lost. The retained force-local sibling-preservation and project-setup stamping cases use different inputs and are not equivalent replacements. Historical commands, counts and results remain unchanged; no live-host, restart, platform or mobile evidence is added." ], "demotionRule": "Demote or block release if any non-Advanced path mutates Active Server, if local reveal or Add Project depends on the durable default instead of captured workspace/host ownership, if an Add Project operation reaches a different host after it begins, or if transient host state survives restart." }, diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index 4f269829731..49a692a58f2 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -11450,7 +11450,6 @@ "src/renderer/src/store/slices/worktrees-multiple-attachments.test.ts": 1132, "src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts": 1132, "src/renderer/src/store/slices/worktrees-purge-terminal-state.test.ts": 1133, - "src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts": 1141, "src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts": 1244, "src/renderer/src/store/slices/worktrees-remote-runtime-removal.test.ts": 1227, "src/renderer/src/store/slices/worktrees-removal-state-cleanup.test.ts": 1229, @@ -11482,7 +11481,6 @@ "src/renderer/src/store/terminals/terminal-no-op-subscriber.test.ts": 1763, "src/renderer/src/store/terminals/terminal-startup-queue-restart.test.ts": 1895, "src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts": 1945, - "src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts": 1662, "src/renderer/src/store/terminals/workspace-terminal-placeholders.test.ts": 302, "src/renderer/src/store/use-runtime-status-view.test.tsx": 1979, "src/renderer/src/store/workspace-layout-cache.test.ts": 63, @@ -11491,11 +11489,9 @@ "src/renderer/src/store/worktree-diff-comments-selector.test.ts": 346, "src/renderer/src/store/worktree-host-collision-index.test.ts": 1875, "src/renderer/src/web/preload-api/web-agent-session-attachment-upload.test.ts": 1588, - "src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts": 306, "src/renderer/src/web/preload-api/web-chat-permission-normalization.test.ts": 293, "src/renderer/src/web/preload-api/web-filesystem-api-connection-pin.test.ts": 509, "src/renderer/src/web/preload-api/web-runtime-calls-connection-pin.test.ts": 51, - "src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts": 201, "src/renderer/src/web/preload-api/web-ui-compact-notice.test.ts": 1192, "src/renderer/src/web/preload-api/web-ui-explorer-root.test.ts": 880, "src/renderer/src/web/web-clipboard-copy-terminal-selection.test.ts": 176, diff --git a/src/renderer/src/store/slices/ui/ui-slice-surface-actions.test.ts b/src/renderer/src/store/slices/ui/ui-slice-surface-actions.test.ts index eb79bc2a286..859d1bcc86d 100644 --- a/src/renderer/src/store/slices/ui/ui-slice-surface-actions.test.ts +++ b/src/renderer/src/store/slices/ui/ui-slice-surface-actions.test.ts @@ -27,13 +27,4 @@ describe('workspace port-scan surface actions', () => { expect(countNotifications(() => setRefreshing(false))).toBe(0) expect(useAppStore.getState().workspacePortScanRefreshing).toBe(false) }) - - it('still notifies once on a real transition, in both directions', () => { - const setRefreshing = useAppStore.getState().setWorkspacePortScanRefreshing - - expect(countNotifications(() => setRefreshing(true))).toBe(1) - expect(useAppStore.getState().workspacePortScanRefreshing).toBe(true) - expect(countNotifications(() => setRefreshing(false))).toBe(1) - expect(useAppStore.getState().workspacePortScanRefreshing).toBe(false) - }) }) diff --git a/src/renderer/src/store/slices/worktrees-fetch-listing-merge.test.ts b/src/renderer/src/store/slices/worktrees-fetch-listing-merge.test.ts index 1d26c0a9336..326fdfd3258 100644 --- a/src/renderer/src/store/slices/worktrees-fetch-listing-merge.test.ts +++ b/src/renderer/src/store/slices/worktrees-fetch-listing-merge.test.ts @@ -417,25 +417,6 @@ describe('fetchWorktrees', () => { await rename }) - it('keeps the last known worktree list when a refresh transiently returns empty', async () => { - const store = createTestStore() - const existing = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' }) - - mockApi.worktrees.listDetected.mockResolvedValueOnce( - makeDetectedResult('repo1', [], { - authoritative: false, - source: 'metadata-fallback' - }) - ) - store.setState({ worktreesByRepo: { repo1: [existing] }, sortEpoch: 7 } as Partial) - - const result = await store.getState().fetchWorktrees('repo1') - - expect(store.getState().worktreesByRepo.repo1).toEqual([existing]) - expect(store.getState().sortEpoch).toBe(7) - expect(result).toBe(false) - }) - it('keeps the scanned rows and their tabs when a stopped WSL distro returns stored rows', async () => { const store = createTestStore() const scanned = makeWorktree({ diff --git a/src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts b/src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts index 33f7c802200..0426d556e81 100644 --- a/src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts +++ b/src/renderer/src/store/slices/worktrees-fetch-owner-routing.test.ts @@ -145,50 +145,6 @@ describe('fetchWorktrees', () => { ]) }) - it('fetches the requested host when duplicate repo ids exist', async () => { - const store = createTestStore() - const localWorktree = makeWorktree({ - id: 'same-repo::/local/wt', - repoId: 'same-repo', - path: '/local/wt' - }) - store.setState({ - settings: { activeRuntimeEnvironmentId: 'env-1' } as never, - repos: [ - { - id: 'same-repo', - path: '/local/repo', - displayName: 'Local', - badgeColor: '#000', - addedAt: 0, - executionHostId: 'local' - }, - { - id: 'same-repo', - path: '/remote/repo', - displayName: 'Runtime', - badgeColor: '#111', - addedAt: 1, - executionHostId: 'runtime:env-1' - } - ] - } as Partial) - mockApi.worktrees.listDetected.mockResolvedValueOnce( - makeDetectedResult('same-repo', [localWorktree]) - ) - - await store.getState().fetchWorktrees('same-repo', { executionHostId: 'local' }) - - expect(mockApi.worktrees.listDetected).toHaveBeenCalledWith( - expect.objectContaining({ - repoId: 'same-repo', - executionHostId: 'local' - }) - ) - expect(runtimeEnvironmentCall).not.toHaveBeenCalled() - expect(store.getState().worktreesByRepo['same-repo']).toEqual([localWorktree]) - }) - it('honors an explicit runtime owner before the repo catalog is hydrated', async () => { const store = createTestStore() const remote = makeWorktree({ @@ -337,42 +293,6 @@ describe('fetchWorktrees', () => { expect(store.getState().worktreesByRepo['repo-missing']).toBeUndefined() }) - it('stamps remote runtime worktrees with the owning repo runtime host', async () => { - const store = createTestStore() - // Why: a remote runtime returns worktrees from its own perspective, so their hostId arrives as the default "local". - const remote = makeWorktree({ - id: 'repo-remote::/remote/wt1', - repoId: 'repo-remote', - path: '/remote/wt1', - branch: 'refs/heads/remote', - hostId: 'local' - }) - store.setState({ - repos: [ - { - id: 'repo-remote', - path: '/home/dvic/src/omarchy-dotfiles', - displayName: 'omarchy-dotfiles', - badgeColor: '#000', - addedAt: 0, - executionHostId: 'runtime:env-1' - } - ] - }) - runtimeEnvironmentCall.mockResolvedValue({ - id: 'rpc-1', - ok: true, - result: makeDetectedResult('repo-remote', [remote]), - _meta: { runtimeId: 'runtime-remote' } - }) - - await store.getState().fetchWorktrees('repo-remote', { forceLocalOwner: true }) - - expect(store.getState().worktreesByRepo['repo-remote']).toEqual([ - { ...remote, hostId: 'runtime:env-1', runtimeOwnerEnvironmentId: 'env-1' } - ]) - }) - it('rejects a pre-reconnect runtime listing after a newer generation publishes', async () => { const store = createTestStore() const stale = makeWorktree({ diff --git a/src/renderer/src/store/slices/worktrees-fetch-persisted-metadata-fallback.test.ts b/src/renderer/src/store/slices/worktrees-fetch-persisted-metadata-fallback.test.ts index 2f1e7838bf4..eea46af1bbc 100644 --- a/src/renderer/src/store/slices/worktrees-fetch-persisted-metadata-fallback.test.ts +++ b/src/renderer/src/store/slices/worktrees-fetch-persisted-metadata-fallback.test.ts @@ -6,7 +6,6 @@ import { TEST_SSH_AUTHORITY, makeDetectedResult } from './worktrees-detected-lis import { makeWorktree } from './worktrees-slice-test-fixtures' import { createTestStore, - forgetRemovedForExecutionHostMock, listKnownForExecutionHostMock, mockApi, resetRemoteRuntimeMocks, @@ -299,55 +298,6 @@ describe('fetchWorktrees', () => { expect(store.getState().worktreesByRepo[sshRepo.id]).toEqual([live]) }) - it('retires persisted metadata for worktrees an authoritative SSH scan proved gone', async () => { - const store = createTestStore() - const sshRepo = { - id: 'repo-ssh', - path: '/home/orca/repo', - displayName: 'SSH Repo', - badgeColor: '#000', - addedAt: 0, - connectionId: 'ssh-1' - } - const live = makeWorktree({ - id: 'repo-ssh::/home/orca/live', - repoId: 'repo-ssh', - path: '/home/orca/live', - hostId: 'ssh:ssh-1' - }) - const deletedOnRemote = makeWorktree({ - id: 'repo-ssh::/home/orca/deleted', - repoId: 'repo-ssh', - path: '/home/orca/deleted' - }) - const connectedStates = createTestStore().getState().sshConnectionStates - listKnownForExecutionHostMock.mockResolvedValueOnce({ - status: 'complete', - repoId: sshRepo.id, - executionHostId: 'ssh:ssh-1', - result: makeDetectedResult(sshRepo.id, [deletedOnRemote], { - authoritative: false, - source: 'metadata-fallback' - }) - }) - store.setState({ repos: [sshRepo], sshConnectionStates: new Map() } as Partial) - await store.getState().fetchWorktrees(sshRepo.id) - - // The non-authoritative fallback saw the same absence but must not act on it. - expect(forgetRemovedForExecutionHostMock).not.toHaveBeenCalled() - - worktreeListMock.mockResolvedValueOnce([live]) - store.setState({ sshConnectionStates: connectedStates } as Partial) - await store.getState().fetchWorktrees(sshRepo.id) - - // Why: the renderer's suppression memory dies with the reload, so the metadata itself has to go. - expect(forgetRemovedForExecutionHostMock).toHaveBeenCalledExactlyOnceWith({ - repoId: sshRepo.id, - executionHostId: 'ssh:ssh-1', - worktreeIds: [deletedOnRemote.id] - }) - }) - it('skips the metadata fallback entirely for authoritative-only callers', async () => { const store = createTestStore() const sshRepo = { diff --git a/src/renderer/src/store/slices/worktrees-fetch-removal-purge.test.ts b/src/renderer/src/store/slices/worktrees-fetch-removal-purge.test.ts index cbeff64139f..561652041a1 100644 --- a/src/renderer/src/store/slices/worktrees-fetch-removal-purge.test.ts +++ b/src/renderer/src/store/slices/worktrees-fetch-removal-purge.test.ts @@ -110,50 +110,6 @@ describe('fetchWorktrees', () => { expect(store.getState().sortEpoch).toBe(8) }) - it('keeps pr-checks and plugin panel tabs for surviving worktrees after an authoritative purge', async () => { - const store = createTestStore() - const removed = makeWorktree({ - id: 'repo1::/path/removed', - repoId: 'repo1', - path: '/path/removed' - }) - const surviving = makeWorktree({ - id: 'repo1::/path/surviving', - repoId: 'repo1', - path: '/path/surviving' - }) - - worktreeListMock.mockResolvedValue([surviving]) - store.setState({ - worktreesByRepo: { repo1: [removed, surviving] }, - sortEpoch: 7, - rightSidebarTabByWorktree: { - [removed.id]: 'search' as never, - [surviving.id]: 'pr-checks' as never - }, - rightSidebarExplorerViewByWorktree: { - [removed.id]: 'search', - [surviving.id]: 'files' - } - } as Partial) - - await store.getState().fetchWorktrees('repo1') - - // pr-checks is not dropped like unknown values; it survives the purge. - expect(store.getState().rightSidebarTabByWorktree).toEqual({ [surviving.id]: 'pr-checks' }) - - // A shape-valid plugin panel tab also survives the purge. - store.setState({ - rightSidebarTabByWorktree: { - [surviving.id]: 'plugin:orca-samples.my-plugin/dashboard' as never - } - } as Partial) - await store.getState().fetchWorktrees('repo1') - expect(store.getState().rightSidebarTabByWorktree).toEqual({ - [surviving.id]: 'plugin:orca-samples.my-plugin/dashboard' - }) - }) - it('retains hidden state until an authoritative refresh removes the worktree', async () => { const store = createTestStore() const visible = makeWorktree({ @@ -314,42 +270,6 @@ describe('fetchWorktrees', () => { expect(hasDismissedHugeRepoWarning(beginHugeRepoWarningProbe(hidden))).toBe(false) }) - it('refreshes only repos owned by the changed visibility-default host', async () => { - const store = createTestStore() - mockApi.worktrees.listDetected.mockImplementationOnce(async (args) => - qualifyDetectedResult(args, makeDetectedResult(args.repoId, [])) - ) - store.setState({ - repos: [ - { - id: 'local-repo', - path: '/local', - displayName: 'Local', - badgeColor: '#000', - addedAt: 0, - executionHostId: 'local' - }, - { - id: 'runtime-repo', - path: '/remote', - displayName: 'Remote', - badgeColor: '#000', - addedAt: 0, - executionHostId: 'runtime:env-1' - } - ], - hasHydratedWorktreePurge: true - } as Partial) - - await store.getState().fetchAllWorktrees({ visibilityOwnerHostId: 'local' }) - - expect(mockApi.worktrees.listDetected).toHaveBeenCalledOnce() - expect(mockApi.worktrees.listDetected).toHaveBeenCalledWith( - expect.objectContaining({ repoId: 'local-repo', executionHostId: 'local' }) - ) - expect(mockApi.runtime.call).not.toHaveBeenCalled() - }) - it('purges session-only tab keys after an authoritative refresh', async () => { const store = createTestStore() const deleted = makeWorktree({ diff --git a/src/renderer/src/store/slices/worktrees-lineage-state.test.ts b/src/renderer/src/store/slices/worktrees-lineage-state.test.ts index 3c8f364f966..768f30e9040 100644 --- a/src/renderer/src/store/slices/worktrees-lineage-state.test.ts +++ b/src/renderer/src/store/slices/worktrees-lineage-state.test.ts @@ -186,50 +186,6 @@ describe('worktree lineage state', () => { }) }) - it('stamps the owning runtime host onto worktrees returned by a remote lineage update', async () => { - const store = createTestStore() - const lineage = makeLineage({ - worktreeId: 'repo-remote::/remote/child', - parentWorktreeId: 'repo-remote::/remote/parent' - }) - const child = makeWorktree({ - id: lineage.worktreeId, - repoId: 'repo-remote', - path: '/remote/child' - }) - // Why: the remote returns the updated worktree from its own perspective, so it arrives with the default local host. - const updatedChild = { ...child, hostId: 'local' as const, lineage } - store.setState({ - repos: [ - { - id: 'repo-remote', - path: '/home/dvic/src/omarchy-dotfiles', - displayName: 'omarchy-dotfiles', - badgeColor: '#000', - addedAt: 0, - executionHostId: 'runtime:env-1' - } - ], - worktreesByRepo: { 'repo-remote': [child] } - } as Partial) - runtimeEnvironmentCall.mockResolvedValueOnce({ - id: 'rpc-remote-lineage', - ok: true, - result: { worktree: updatedChild }, - _meta: { runtimeId: 'runtime-remote' } - }) - - await store.getState().updateWorktreeLineage(lineage.worktreeId, { - parentWorktreeId: lineage.parentWorktreeId - }) - - expect(store.getState().worktreesByRepo['repo-remote']?.[0]).toEqual({ - ...updatedChild, - hostId: 'runtime:env-1', - runtimeOwnerEnvironmentId: 'env-1' - }) - }) - it('assigns a parent through the worktree owner runtime when host-stamped', async () => { const store = createTestStore() const lineage = makeLineage() diff --git a/src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts b/src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts index c099ace4be0..fea7aa31079 100644 --- a/src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts +++ b/src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts @@ -170,40 +170,6 @@ describe('worktree remote runtime mutations', () => { expect(mockApi.worktrees.forceDeletePreservedBranch).not.toHaveBeenCalled() }) - it('persists SSH-owned worktree metadata through local IPC even when a runtime is focused', async () => { - const store = createTestStore() - const wt = makeWorktree({ - id: 'repo-ssh::/home/orca/wt1', - repoId: 'repo-ssh', - path: '/home/orca/wt1', - hostId: 'ssh:ssh-1' - }) - store.setState({ - settings: { activeRuntimeEnvironmentId: 'env-1' } as never, - repos: [ - { - id: 'repo-ssh', - path: '/home/orca/repo', - displayName: 'SSH Repo', - badgeColor: '#000', - addedAt: 0, - connectionId: 'ssh-1' - } - ], - worktreesByRepo: { 'repo-ssh': [wt] } - } as Partial) - - await store.getState().updateWorktreeMeta(wt.id, { comment: 'ssh note' }) - - expect(mockApi.worktrees.updateMeta).toHaveBeenCalledWith({ - worktreeId: wt.id, - executionHostId: 'ssh:ssh-1', - updates: expect.objectContaining({ comment: 'ssh note' }) - }) - expect(runtimeEnvironmentCall).not.toHaveBeenCalled() - expect(store.getState().worktreesByRepo['repo-ssh'][0]?.comment).toBe('ssh note') - }) - it('clears pending first-agent rename when the title is updated', async () => { const store = createTestStore() const wt = makeWorktree({ diff --git a/src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts b/src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts index c10b9b594f7..4d8d3153fd9 100644 --- a/src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts +++ b/src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts @@ -59,20 +59,6 @@ describe('pending worktree creation state', () => { resetRemoteRuntimeMocks() }) - it('removePendingWorktreeCreation clears the active surface only when it points at the removed entry', () => { - const store = createTestStore() - store.getState().beginPendingWorktreeCreation(makePendingCreation('c1')) - store.getState().beginPendingWorktreeCreation(makePendingCreation('c2')) - // c2 is active now; removing the background c1 must not steal the surface. - store.getState().removePendingWorktreeCreation('c1') - - expect(store.getState().pendingWorktreeCreations.c1).toBeUndefined() - expect(store.getState().activePendingCreationId).toBe('c2') - - store.getState().removePendingWorktreeCreation('c2') - expect(store.getState().activePendingCreationId).toBeNull() - }) - it('removePendingWorktreeCreation cleans up a provisioned-root setup and VM runtime', async () => { const store = createTestStore() const deleteProjectHostSetup = vi.mocked(store.getState().deleteProjectHostSetup) diff --git a/src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts b/src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts deleted file mode 100644 index f93169808ba..00000000000 --- a/src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { folderWorkspaceKey } from '../../../../shared/workspace-scope' -import { makeFolderWorkspace, makeWorktree } from './worktrees-slice-test-fixtures' -import { - createTestStore, - mockApi, - resetRemoteRuntimeMocks, - resetWorktreeSliceModuleMemory -} from './worktrees-slice-test-harness' - -vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) - -vi.mock('sonner', () => ({ - toast: { - warning: vi.fn(), - info: vi.fn(), - success: vi.fn(), - error: vi.fn(), - dismiss: vi.fn() - } -})) - -vi.mock('@/components/worktree-base-fallback-notice', () => ({ - requestWorktreeBaseFallbackNotice: vi.fn() -})) - -beforeEach(resetWorktreeSliceModuleMemory) - -// With the switch on, the owning host writes every Recent stamp and the unread flag; the window -// writes neither. -describe('window-side Recent stamps with the sidebar-inputs switch on', () => { - const wt = makeWorktree({ - id: 'repo1::/path/wt1', - repoId: 'repo1', - path: '/path/wt1', - lastActivityAt: 5 - }) - - beforeEach(() => { - vi.clearAllMocks() - resetRemoteRuntimeMocks() - }) - - function storeWith() { - const store = createTestStore() - store.setState({ worktreesByRepo: { repo1: [wt] } }) - return store - } - - const lastActivityAt = (store: ReturnType) => - store.getState().worktreesByRepo.repo1[0].lastActivityAt - - const persistedStamp = () => - mockApi.worktrees.updateMeta.mock.calls.some( - ([args]: [{ updates: Record }]) => 'lastActivityAt' in args.updates - ) - - it('a terminal start or exit writes no stamp', () => { - const store = storeWith() - store.getState().bumpWorktreeActivity(wt.id) - expect(lastActivityAt(store)).toBe(5) - expect(persistedStamp()).toBe(false) - }) - - it('a comment edit writes no stamp', async () => { - const store = storeWith() - await store.getState().updateWorktreeMeta(wt.id, { comment: 'note' }) - expect(store.getState().worktreesByRepo.repo1[0].comment).toBe('note') - expect(lastActivityAt(store)).toBe(5) - expect(persistedStamp()).toBe(false) - }) - - it('a folder workspace’s terminal activity and finish write no stamp and no flag', async () => { - const store = createTestStore() - const folder = makeFolderWorkspace({ id: 'folder-1', lastActivityAt: 5 }) - store.setState({ folderWorkspaces: [folder], projectGroups: [] }) - store.getState().bumpWorktreeActivity(folderWorkspaceKey(folder.id)) - store.getState().markAgentAttentionUnread({ - workspaceId: folderWorkspaceKey(folder.id), - subjectKey: null, - groupId: null, - reason: 'agent-completion' - }) - await new Promise((resolve) => setTimeout(resolve, 0)) - expect(store.getState().folderWorkspaces[0]).toMatchObject({ - isUnread: false, - lastActivityAt: 5 - }) - const folderWrites = vi.mocked(store.getState().updateFolderWorkspace).mock.calls - expect( - folderWrites.some(([, updates]) => 'lastActivityAt' in updates || 'isUnread' in updates) - ).toBe(false) - }) -}) diff --git a/src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts b/src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts index abae4f43f02..0c1a5490295 100644 --- a/src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts +++ b/src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts @@ -258,78 +258,6 @@ describe('worktree remote runtime mutations', () => { expect(runtimeEnvironmentCall).not.toHaveBeenCalled() }) - it('passes startup commands through remote runtime worktree creation', async () => { - const store = createRepoTestStore() - const wt = makeWorktree({ - id: 'repo1::/path/agent-startup', - repoId: 'repo1', - path: '/path/agent-startup' - }) - runtimeEnvironmentCall.mockResolvedValue({ - id: 'rpc-create', - ok: true, - result: { worktree: wt }, - _meta: { runtimeId: 'runtime-remote' } - }) - store.setState({ - settings: { activeRuntimeEnvironmentId: 'env-1' } as never, - worktreesByRepo: { repo1: [] } - } as Partial) - seedRepoHost(store, 'runtime:env-1') - - await store - .getState() - .createWorktree( - 'repo1', - 'agent-startup', - undefined, - 'skip', - undefined, - 'sidebar', - 'Launch agent', - undefined, - undefined, - undefined, - 'codex', - undefined, - undefined, - undefined, - undefined, - undefined, - { - command: "codex 'summarize repo'", - env: { ORCA_AGENT_MODE: 'direct' }, - launchConfig: { - agentCommand: 'codex', - agentArgs: '--model gpt-5', - agentEnv: { ORCA_AGENT_MODE: 'direct' } - } - } - ) - - expect(runtimeEnvironmentCall).toHaveBeenCalledWith( - expect.objectContaining({ - method: 'worktree.create', - params: expect.objectContaining({ - repo: 'repo1', - name: 'agent-startup', - setupDecision: 'skip', - telemetrySource: 'sidebar', - displayName: 'Launch agent', - createdWithAgent: 'codex', - startupCommand: "codex 'summarize repo'", - startupEnv: { ORCA_AGENT_MODE: 'direct' }, - startupLaunchConfig: { - agentCommand: 'codex', - agentArgs: '--model gpt-5', - agentEnv: { ORCA_AGENT_MODE: 'direct' } - }, - activate: true - }) - }) - ) - }) - it('retries a suffixed branchNameOverride when runtime create reports a branch conflict', async () => { const store = createRepoTestStore() const wt = makeWorktree({ diff --git a/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts b/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts index b968965d97c..2a612bf0ae1 100644 --- a/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts +++ b/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts @@ -217,44 +217,6 @@ describe('worktree remote runtime mutations', () => { expect(mockApi.worktrees.updateMeta).toHaveBeenCalled() }) - it('does not link an arbitrary same-repo terminal PR URL for a known push target when lookup misses', async () => { - const store = createTestStore() - installReviewRead().mockResolvedValue(null) - const wt = makeWorktree({ - id: 'repo1::/path/wt1', - repoId: 'repo1', - path: '/worktrees/orca', - branch: 'refs/heads/feature/pr-link', - pushTarget: { - remoteName: 'origin', - branchName: 'feature/pr-link', - remoteUrl: 'https://github.com/acme/orca.git' - } - }) - store.setState({ - repos: [ - { id: 'repo1', path: '/repos/orca', displayName: 'orca', badgeColor: '#000', addedAt: 0 } - ], - worktreesByRepo: { repo1: [wt] } - }) - - store.getState().observeTerminalGitHubPullRequestLink(wt.id, { - url: 'https://github.com/acme/orca/pull/1', - slug: { owner: 'acme', repo: 'orca' }, - number: 1 - }) - - for (let i = 0; i < 20; i++) { - await Promise.resolve() - } - - expect(store.getState().worktreesByRepo.repo1[0]?.linkedPR).toBeNull() - expect(mockApi.worktrees.updateMeta).not.toHaveBeenCalledWith({ - worktreeId: wt.id, - updates: { linkedPR: 1 } - }) - }) - it('rejects a same-number branch result for a different repository URL', async () => { const store = createTestStore() const readHostedReview = installReviewRead().mockResolvedValue(confirmedReview(42)) diff --git a/src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts b/src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts deleted file mode 100644 index ca29bf454e6..00000000000 --- a/src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { createTestStore, makeWorktree, seedStore } from '../slices/store-test-helpers' -import { createStoreCascadesMockApi } from '../slices/store-cascades-test-harness' -import { toWebTerminalSurfaceTabId } from '../../../../shared/terminal-surface-id' -createStoreCascadesMockApi() -const WT = 'repo1::/path/wt1' -const MIRRORED = toWebTerminalSurfaceTabId('host-tab-1') -function seeded() { - const store = createTestStore() - seedStore(store, { - worktreesByRepo: { repo1: [makeWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1' })] }, - activeWorktreeId: WT - }) - return store -} -describe('createTab with a mirrored host tab id', () => { - it('keeps the id so the host snapshot finds the tab', () => { - const store = seeded() - const tab = store.getState().createTab(WT, undefined, undefined, { - id: MIRRORED, - mirroredHostTab: true - }) - expect(tab.id).toBe(MIRRORED) - expect(store.getState().tabsByWorktree[WT]?.map((entry) => entry.id)).toContain(MIRRORED) - expect(() => - store.getState().createTab(WT, undefined, undefined, { id: MIRRORED, mirroredHostTab: true }) - ).toThrow(/already exists/) - }) -}) diff --git a/src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts b/src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts deleted file mode 100644 index 8a3cf5f5f56..00000000000 --- a/src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' -import { searchResults } from '../../../../shared/ai-vault-search-test-fixture' -import { unavailableSessionSearchStatus } from '../../../../shared/ai-vault-search-client' -import { AI_VAULT_AGENTS } from '../../../../shared/ai-vault-types' - -const callRuntimeResult = vi.hoisted(() => vi.fn()) -vi.mock('./web-runtime-calls', () => ({ callRuntimeResult })) -vi.mock('./web-runtime-session', () => ({ - requireActiveEnvironment: () => ({ id: 'owning-host' }) -})) -import { createWebAiVaultApi } from './web-ai-vault-api' - -beforeEach(() => { - callRuntimeResult.mockReset() -}) - -describe('web session search preload compatibility', () => { - it('calls the selected host, parses its response and applies remote exposure', async () => { - callRuntimeResult.mockResolvedValue(searchResults()) - const api = createWebAiVaultApi() - const result = await api.searchSessions({ query: 'needle' }) - expect(callRuntimeResult).toHaveBeenCalledExactlyOnceWith('aiVault.searchSessions', { - query: 'needle', - limit: 20, - supportedAgents: [...AI_VAULT_AGENTS], - supportsQoderHistory: true, - supportsJcodeHistory: true - }) - expect(result).toMatchObject({ kind: 'results', hits: [{ source: { presence: 'present' } }] }) - expect(JSON.stringify(result)).not.toContain('resumeCommand') - expect(result).not.toHaveProperty('debug') - callRuntimeResult.mockResolvedValue(unavailableSessionSearchStatus()) - expect(await api.searchStatus()).toEqual(unavailableSessionSearchStatus()) - expect(callRuntimeResult).toHaveBeenLastCalledWith('aiVault.searchStatus', {}) - }) -}) diff --git a/src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts b/src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts deleted file mode 100644 index 6f73e0d4c47..00000000000 --- a/src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -// @vitest-environment happy-dom -import { afterEach, describe, expect, it, vi } from 'vitest' -import { takeBrowserAttachmentFile } from '@/lib/browser-attachment-files' -import { createShellApi } from './web-shell-api' - -vi.mock('./web-runtime-worktree-catalog', () => ({ resolveRuntimeFilePath: vi.fn() })) - -function chooseOnClick(files: File[] | null): void { - vi.spyOn(HTMLInputElement.prototype, 'click').mockImplementation(function ( - this: HTMLInputElement - ) { - if (files === null) { - this.dispatchEvent(new Event('cancel')) - return - } - Object.defineProperty(this, 'files', { value: files }) - this.dispatchEvent(new Event('change')) - }) -} - -afterEach(() => { - vi.restoreAllMocks() -}) - -describe('web chat attachment picker', () => { - it('opens the browser file picker and returns tokens the chat upload can read', async () => { - const files = [new File(['a'], 'a.txt'), new File(['b'], 'b.png')] - chooseOnClick(files) - - const tokens = await createShellApi().pickAttachments!() - - expect(tokens).toHaveLength(2) - expect(tokens.map((token) => takeBrowserAttachmentFile(token))).toEqual(files) - }) -})