From 9ef747cfc10244e529e68d03edcc9920a9ee6ef4 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sat, 14 Nov 2026 16:35:55 -0800 Subject: [PATCH] test: remove low-value renderer main shared and script suites (#42548) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../scripts/ci/sharding/ci-shard-timings.json | 34 ----------- .../vitest-node-runtime-files.mjs | 1 - .../session-transcript-record-budget.test.ts | 27 -------- .../login/codex-device-auth-prompt.test.ts | 26 -------- .../codex-app-server-direct-open.test.ts | 26 -------- ...x-structured-live-provider-process.test.ts | 25 -------- .../ephemeral-vm/pending-vm-checkouts.test.ts | 28 --------- .../attachments/body-image-urls.test.ts | 26 -------- ...k-item-search-fallback-environment.test.ts | 27 -------- .../wsl-move-orchestrator.test.ts | 26 -------- ...tructured-chat-naming-agent-launch.test.ts | 27 -------- .../relay-readiness-retention.test.ts | 24 -------- .../crew/crew-pending-questions.test.ts | 25 -------- .../federation-sync-generation.test.ts | 27 -------- ...content-change-handler.undo-clean.test.tsx | 52 ---------------- .../native-chat-composer-focus-intent.test.ts | 57 ----------------- .../delivery/native-chat-pending.test.ts | 54 ---------------- .../state/use-plugin-review-queue.test.tsx | 55 ----------------- .../use-debounced-settings-text-draft.test.ts | 60 ------------------ .../DeleteWorktreeLineageNotice.test.tsx | 56 ----------------- .../viewport/use-scroll-to-top.test.tsx | 61 ------------------- ...ection-queue-rejection-containment.test.ts | 54 ---------------- .../terminal-pane-host-state-memo.test.ts | 53 ---------------- .../WorkspaceEmojiPickerPanel.test.tsx | 53 ---------------- ...direct-ssh-unrestored-forward-sync.test.ts | 52 ---------------- .../src/hooks/useMetadataListRequest.test.tsx | 53 ---------------- .../markdown-heading-outline.test.ts | 54 ---------------- .../workspace-port-scan-debounce.test.ts | 59 ------------------ .../claude-agent-view-observations.test.ts | 50 --------------- .../foreign-host-status-guard.test.ts | 59 ------------------ ...ok-listener-claude-permission-mode.test.ts | 29 --------- .../agent-hook-listener-transport.test.ts | 29 --------- .../agent-chat-permission-mode.test.ts | 29 --------- src/shared/environment-overlay.test.ts | 27 -------- ...down-document-paths-windows-client.test.ts | 29 --------- src/shared/git/diff/git-blob-absence.test.ts | 30 --------- .../github/api/api-availability.test.ts | 29 --------- .../pull-request-for-branch-outcome.test.ts | 28 --------- .../imported-folder-project-identity.test.ts | 28 --------- .../native-chat-resolution-receipt.test.ts | 30 --------- .../native-chat-shell-environment.test.ts | 27 -------- src/shared/opencode-launch-command.test.ts | 29 --------- src/shared/pi-agent-kind.test.ts | 27 -------- .../ripgrep/ripgrep-match-offsets.test.ts | 28 --------- .../listing/source-control-tree.test.ts | 29 --------- src/shared/subprocess-stdin-write.test.ts | 30 --------- 46 files changed, 1689 deletions(-) delete mode 100644 src/main/ai-vault/transcripts/session-transcript-record-budget.test.ts delete mode 100644 src/main/codex-accounts/login/codex-device-auth-prompt.test.ts delete mode 100644 src/main/codex/app-server/codex-app-server-direct-open.test.ts delete mode 100644 src/main/codex/structured/session-lifecycle/codex-structured-live-provider-process.test.ts delete mode 100644 src/main/ephemeral-vm/pending-vm-checkouts.test.ts delete mode 100644 src/main/github/attachments/body-image-urls.test.ts delete mode 100644 src/main/github/client/list/work-item-search-fallback-environment.test.ts delete mode 100644 src/main/persistence/moving-wsl-projects/wsl-move-orchestrator.test.ts delete mode 100644 src/main/runtime/agent-session/naming/structured-chat-naming-agent-launch.test.ts delete mode 100644 src/main/runtime/mobile-cloud-relay/authentication/relay-readiness-retention.test.ts delete mode 100644 src/main/runtime/orchestration/crew/crew-pending-questions.test.ts delete mode 100644 src/main/runtime/orchestration/federation/synchronization/federation-sync-generation.test.ts delete mode 100644 src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.undo-clean.test.tsx delete mode 100644 src/renderer/src/components/native-chat/composer/focus/native-chat-composer-focus-intent.test.ts delete mode 100644 src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts delete mode 100644 src/renderer/src/components/plugins/state/use-plugin-review-queue.test.tsx delete mode 100644 src/renderer/src/components/settings/form-controls/use-debounced-settings-text-draft.test.ts delete mode 100644 src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeLineageNotice.test.tsx delete mode 100644 src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.tsx delete mode 100644 src/renderer/src/components/terminal-pane/agent-completion/process-inspection/agent-process-inspection-queue-rejection-containment.test.ts delete mode 100644 src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts delete mode 100644 src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx delete mode 100644 src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts delete mode 100644 src/renderer/src/hooks/useMetadataListRequest.test.tsx delete mode 100644 src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts delete mode 100644 src/renderer/src/lib/workspace-ports/workspace-port-scan-debounce.test.ts delete mode 100644 src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts delete mode 100644 src/renderer/src/store/slices/worktrees/metadata/foreign-host-status-guard.test.ts delete mode 100644 src/shared/agent-hook-listener/normalization/agent-hook-listener-claude-permission-mode.test.ts delete mode 100644 src/shared/agent-hook-listener/transport/agent-hook-listener-transport.test.ts delete mode 100644 src/shared/agent-launch/permissions/agent-chat-permission-mode.test.ts delete mode 100644 src/shared/environment-overlay.test.ts delete mode 100644 src/shared/file-listing/markdown-document-paths-windows-client.test.ts delete mode 100644 src/shared/git/diff/git-blob-absence.test.ts delete mode 100644 src/shared/github/api/api-availability.test.ts delete mode 100644 src/shared/github/pull-requests/refresh/pull-request-for-branch-outcome.test.ts delete mode 100644 src/shared/imported-folder-project-identity.test.ts delete mode 100644 src/shared/native-chat/native-chat-resolution-receipt.test.ts delete mode 100644 src/shared/native-chat/native-chat-shell-environment.test.ts delete mode 100644 src/shared/opencode-launch-command.test.ts delete mode 100644 src/shared/pi-agent-kind.test.ts delete mode 100644 src/shared/ripgrep/ripgrep-match-offsets.test.ts delete mode 100644 src/shared/source-control/listing/source-control-tree.test.ts delete mode 100644 src/shared/subprocess-stdin-write.test.ts diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 5a7e224b400..323197e0a57 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -653,7 +653,6 @@ "src/main/ai-vault/transcripts/session-transcript-consumers.test.ts": 562, "src/main/ai-vault/transcripts/session-transcript-every-agent-capture.test.ts": 856, "src/main/ai-vault/transcripts/session-transcript-message-content.test.ts": 76, - "src/main/ai-vault/transcripts/session-transcript-record-budget.test.ts": 44, "src/main/ai-vault/shell-command-words.test.ts": 320, "src/main/ai-vault/structured-chat-cli-fork.test.ts": 1238, "src/main/ai-vault/structured-chat-conversation-copy.test.ts": 917, @@ -1036,7 +1035,6 @@ "src/main/codex-accounts/credentials/codex-account-identity-api-key-guard.test.ts": 55, "src/main/codex-accounts/managed-homes/codex-config-mirror.test.ts": 331, "src/main/codex-accounts/credentials/codex-credential-absence-grace.test.ts": 62, - "src/main/codex-accounts/login/codex-device-auth-prompt.test.ts": 48, "src/main/codex-accounts/managed-homes/codex-managed-home-path-wsl-check.test.ts": 71, "src/main/codex-accounts/reset-credits/codex-reset-credit-ledger.test.ts": 283, "src/main/filesystem/atomic-file-publication.test.ts": 127, @@ -1079,7 +1077,6 @@ "src/main/codex/app-server/codex-app-server-client.test.ts": 13839, "src/main/codex/app-server/codex-app-server-connection-exit-order.test.ts": 264, "src/main/codex/app-server/codex-app-server-connection-tree-unproven.test.ts": 634, - "src/main/codex/app-server/codex-app-server-direct-open.test.ts": 280, "src/main/codex/app-server/codex-app-server-session-supervision.test.ts": 14357, "src/main/codex/app-server/codex-app-server-session.test.ts": 343, "src/main/codex/app-server/codex-app-server-teardown.integration.test.ts": 16506, @@ -1166,7 +1163,6 @@ "src/main/codex/structured/journal/codex-structured-journal-turn-settles-once-journal.test.ts": 824, "src/main/codex/structured/launch/codex-structured-launch-args.test.ts": 96, "src/main/codex/structured/launch/codex-structured-launch-resolution.test.ts": 589, - "src/main/codex/structured/session-lifecycle/codex-structured-live-provider-process.test.ts": 525, "src/main/codex/structured/turns/codex-structured-message-options.test.ts": 1146, "src/main/codex/structured/prompts/codex-structured-prompt-ownership.test.ts": 531, "src/main/codex/structured/prompts/codex-structured-prompt-replies.test.ts": 125, @@ -1702,7 +1698,6 @@ "src/main/github/work-item-details-query-reuse.test.ts": 592, "src/main/github/work-item-details.test.ts": 613, "src/main/github/work-item-pr-cursor-page.test.ts": 2179, - "src/main/github/work-item-search-fallback-environment.test.ts": 609, "src/main/github/work-item-search-freshness.test.ts": 1425, "src/main/github/work-item-search-pagination.test.ts": 618, "src/main/gitlab/projects/gitlab-known-host-probe.test.ts": 389, @@ -2314,7 +2309,6 @@ "src/main/persistence/moving-wsl-projects/cutover-recovery/wsl-move-cutover-journal.test.ts": 795, "src/main/persistence/moving-wsl-projects/wsl-move-orchestration-history-rewrite.test.ts": 1245, "src/main/persistence/moving-wsl-projects/orchestration/wsl-move-orchestrator-user-choices.test.ts": 638, - "src/main/persistence/moving-wsl-projects/wsl-move-orchestrator.test.ts": 567, "src/main/persistence/moving-wsl-projects/quiescence/wsl-move-quiesce.test.ts": 413, "src/main/persistence/moving-wsl-projects/terminal-state/wsl-move-shell-history-blobs.test.ts": 194, "src/main/persistence/moving-wsl-projects/terminal-state/wsl-move-slept-scrollback.test.ts": 466, @@ -2761,7 +2755,6 @@ "src/main/runtime/mobile-cloud-relay/relay-control-origin.test.ts": 147, "src/main/runtime/mobile-cloud-relay/control-channel/relay-host-proof.test.ts": 122, "src/main/runtime/mobile-cloud-relay/director/relay-http-client.test.ts": 175, - "src/main/runtime/mobile-cloud-relay/authentication/relay-readiness-retention.test.ts": 196, "src/main/runtime/mobile-cloud-relay/region-selection/relay-region-preference.test.ts": 253, "src/main/runtime/mobile-cloud-relay/pairing/relay-revoke-outbox.test.ts": 73, "src/main/runtime/mobile-cloud-relay/relay-session-broker.test.ts": 804, @@ -2841,7 +2834,6 @@ "src/main/runtime/orchestration/crew/crew-follow-up-authority-inputs.test.ts": 2246, "src/main/runtime/orchestration/crew/crew-parent-persistence.test.ts": 553, "src/main/runtime/orchestration/crew/crew-parent-relations.test.ts": 533, - "src/main/runtime/orchestration/crew/crew-pending-questions.test.ts": 450, "src/main/runtime/orchestration/crew/crew-read-model-performance.test.ts": 1319, "src/main/runtime/orchestration/crew/crew-read-model.test.ts": 490, "src/main/runtime/orchestration/crew/crew-recipient-authority.test.ts": 3948, @@ -4229,7 +4221,6 @@ "src/renderer/src/components/editor/rich-markdown/viewport/rich-markdown-viewport.test.tsx": 883, "src/renderer/src/components/editor/use-custom-editor-outside-merge.test.tsx": 2069, "src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.test.tsx": 2031, - "src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.undo-clean.test.tsx": 1299, "src/renderer/src/components/editor/markdown-preview/document-worker/use-markdown-preview-document.test.tsx": 326, "src/renderer/src/components/editor/markdown-preview/search/use-markdown-preview-search-reveal.test.tsx": 390, "src/renderer/src/components/editor/use-monaco-editor-mount.cursor-owner.test.tsx": 1332, @@ -4387,7 +4378,6 @@ "src/renderer/src/components/native-chat/pane/routing/native-chat-open-wake.test.ts": 1807, "src/renderer/src/components/native-chat/pane/ownership/native-chat-owner-selectors.test.tsx": 525, "src/renderer/src/components/native-chat/paste/native-chat-paste-routing.test.tsx": 2417, - "src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts": 273, "src/renderer/src/components/native-chat/composer/editor/native-chat-prompt-document-text.test.ts": 219, "src/renderer/src/components/native-chat/composer/editor/native-chat-prompt-document.test.ts": 459, "src/renderer/src/components/native-chat/queue/editing/native-chat-queued-edit-draft.test.ts": 649, @@ -4477,7 +4467,6 @@ "src/renderer/src/components/plugins/page/PluginSettingsSection.test.tsx": 572, "src/renderer/src/components/plugins/state/use-plugin-contribution-source.test.tsx": 1935, "src/renderer/src/components/plugins/state/use-plugin-install-link.test.tsx": 518, - "src/renderer/src/components/plugins/state/use-plugin-review-queue.test.tsx": 389, "src/renderer/src/components/plugins/view/plugin-view-acts.test.tsx": 3241, "src/renderer/src/components/plugins/view/plugin-view-data-acts.test.tsx": 3002, "src/renderer/src/components/plugins/view/plugin-view-editor-shot-cleanup.test.ts": 59, @@ -4623,7 +4612,6 @@ "src/renderer/src/components/settings/source-control/source-control-action-permission-draft.test.tsx": 6938, "src/renderer/src/components/ssh-host-form/ssh-target-draft.test.ts": 72, "src/renderer/src/components/integrations/task-trackers/linear-integration-card.test.tsx": 1414, - "src/renderer/src/components/settings/form-controls/use-debounced-settings-text-draft.test.ts": 308, "src/renderer/src/components/settings/repository/hooks/use-repository-hook-settings-draft.test.tsx": 586, "src/renderer/src/components/settings/repository/hooks/use-repository-issue-command-wsl-stopped.test.ts": 523, "src/renderer/src/components/session-search/use-session-search-status.test.tsx": 477, @@ -4714,7 +4702,6 @@ "src/renderer/src/components/sidebar/worktree-list/rows/repo-header-ssh-isolation.test.tsx": 2945, "src/renderer/src/components/sidebar/worktree-list/rows/section-header-create-host.test.tsx": 2393, "src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.ts": 293, - "src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.tsx": 269, "src/renderer/src/components/sidebar/worktree-list/drag/worktree-manual-order-store-write.test.ts": 2144, "src/renderer/src/components/sidebar/worktree-list/drag/worktree-manual-order.test.ts": 332, "src/renderer/src/components/sidebar/workspace-actions/parenting/worktree-parent-eligibility.test.ts": 68, @@ -4800,7 +4787,6 @@ "src/renderer/src/components/terminal-pane/agent-completion/agent-completion-no-evidence-cadence.test.ts": 349, "src/renderer/src/components/terminal-pane/agent-status/input-inference/agent-interrupt-inference.test.ts": 146, "src/renderer/src/components/terminal-pane/pty-connection/startup/agent-pre-ready-typed-draft.test.ts": 1195, - "src/renderer/src/components/terminal-pane/agent-completion/process-inspection/agent-process-inspection-queue-rejection-containment.test.ts": 56, "src/renderer/src/components/terminal-pane/account-restart/detached/claude-detached-pane-restart.test.ts": 1938, "src/renderer/src/components/terminal-pane/provider-notices/claude-diff-panel/claude-diff-panel-notice-banner.test.tsx": 1986, "src/renderer/src/components/terminal-pane/notifications/claude-side-question-completion.test.ts": 2305, @@ -4966,7 +4952,6 @@ "src/renderer/src/components/terminal-pane/input/keyboard/terminal-option-kitty-release.test.ts": 52, "src/renderer/src/components/terminal-pane/input/file-drop/terminal-pane-element-file-drop.test.tsx": 1748, "src/renderer/src/components/terminal-pane/layout/reconciliation/terminal-pane-frame-reconciliation.test.ts": 903, - "src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts": 4534, "src/renderer/src/components/terminal-pane/layout/split/terminal-pane-split-request-routing.test.ts": 2015, "src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-commit.test.ts": 2090, "src/renderer/src/components/terminal-pane/layout/detach/terminal-pane-tab-detach-main-move.test.ts": 2147, @@ -5033,7 +5018,6 @@ "src/renderer/src/components/workspace-cleanup/removal/workspace-cleanup-removal-candidates.test.ts": 206, "src/renderer/src/components/workspace-cleanup/removal/settlement/workspace-cleanup-removal-timeout-recovery.test.ts": 1817, "src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerButton.test.tsx": 1086, - "src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx": 763, "src/renderer/src/components/workspace-emoji/useWorkspaceEmojiShortcodeInput.test.tsx": 365, "src/renderer/src/components/worktree-creation/PendingNativeChatCreation.test.tsx": 4075, "src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx": 4445, @@ -5069,7 +5053,6 @@ "src/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.ts": 934, "src/renderer/src/hooks/ipc-events/direct-ssh-hydration-fanout.test.ts": 1825, "src/renderer/src/hooks/ipc-events/direct-ssh-hydration-target-metadata.test.ts": 1875, - "src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts": 95, "src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge-reveal.test.ts": 1764, "src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.ts": 2200, "src/renderer/src/hooks/ipc-events/os-markdown-file-open-bridge.test.ts": 280, @@ -5123,7 +5106,6 @@ "src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts": 530, "src/renderer/src/hooks/useIpcEvents-session-tab-close-request.test.ts": 2252, "src/renderer/src/hooks/useIssueMetadata.test.tsx": 344, - "src/renderer/src/hooks/useMetadataListRequest.test.tsx": 266, "src/renderer/src/hooks/clipboard/primary-selection/usePrimarySelectionPaste.terminal-native-paste.test.tsx": 388, "src/renderer/src/hooks/clipboard/primary-selection/usePrimarySelectionPaste.test.tsx": 411, "src/renderer/src/hooks/useReadOnScreenAttention.away.test.ts": 2420, @@ -5215,7 +5197,6 @@ "src/renderer/src/lib/work-items/linear/linear-issue-workspace-attachment.test.ts": 99, "src/renderer/src/lib/work-items/linked-work-item-context.test.ts": 64, "src/renderer/src/lib/editor/monaco/monaco-editor-gutter-disposal.test.ts": 295, - "src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts": 70, "src/renderer/src/lib/monaco-languages/monarch-embed-entry-recursion.test.ts": 697, "src/renderer/src/lib/monaco-languages/plugin-grammar-worker-client.test.ts": 198, "src/renderer/src/lib/monaco-languages/plugin-syntax-slot-pool.test.ts": 65, @@ -5271,7 +5252,6 @@ "src/renderer/src/lib/text-generation-error-copy.test.ts": 466, "src/renderer/src/lib/workspace/activation/workspace-activation-path-gate.test.ts": 2107, "src/renderer/src/lib/browser/workspace/workspace-browser-tab-open-placement.test.ts": 1996, - "src/renderer/src/lib/workspace-ports/workspace-port-scan-debounce.test.ts": 57, "src/renderer/src/lib/workspace/persistence/workspace-session-host-emptied-fields.test.ts": 279, "src/renderer/src/lib/workspace/persistence/workspace-session-ssh-partition-ownership.test.ts": 309, "src/renderer/src/lib/workspace/persistence/workspace-session-ssh-partition-round-trip.test.ts": 1775, @@ -5296,7 +5276,6 @@ "src/renderer/src/lib/workspace/ownership/worktree-runtime-owner.test.ts": 380, "src/renderer/src/lib/workspace/persistence/wsl-move-renderer-store-rewrites.test.ts": 1072, "src/renderer/src/runtime/rpc/calls/abortable-runtime-environment-call.test.ts": 189, - "src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts": 105, "src/renderer/src/runtime/web-session-tabs-sync/closing/close-mirrored-editor-tab.test.ts": 397, "src/renderer/src/runtime/sync-runtime-graph/editor-buffer-dirty-readers.test.ts": 1892, "src/renderer/src/runtime/files/mutations/file-explorer-delete-owner-provenance.test.ts": 1878, @@ -5655,7 +5634,6 @@ "src/shared/abort-signal-reason-memory.test.ts": 80, "src/shared/abort-signal-reason.test.ts": 81, "src/shared/agent-launch/permissions/agent-chat-permission-host-support.test.ts": 195, - "src/shared/agent-launch/permissions/agent-chat-permission-mode.test.ts": 199, "src/shared/agent-session/options/agent-cli-flag-detection.test.ts": 56, "src/shared/agent-cli-install-dir-fallback.test.ts": 130, "src/shared/agent-launch/startup/agent-command-line-intent.test.ts": 95, @@ -5671,7 +5649,6 @@ "src/shared/agent-hook-listener/normalization/agent-hook-listener-grok.test.ts": 262, "src/shared/agent-hook-listener/agent-hook-listener-opencode-session-correlation.test.ts": 57, "src/shared/agent-hook-listener/normalization/agent-hook-listener-startless-child-lifecycle.test.ts": 241, - "src/shared/agent-hook-listener/transport/agent-hook-listener-transport.test.ts": 326, "src/shared/agent-hook-listener/claude-session-continuation.test.ts": 114, "src/shared/agent-hook-listener/claude-settled-permission-requests.test.ts": 54, "src/shared/agent-hook-listener/providers/claude/transcripts/claude-transcript-semantics.test.ts": 163, @@ -5843,7 +5820,6 @@ "src/shared/foreground-process-selection.test.ts": 100, "src/shared/foreground-wrapper-agent.test.ts": 82, "src/shared/git/compatibility/git-binary-compatibility.test.ts": 377, - "src/shared/git/diff/git-blob-absence.test.ts": 54, "src/shared/git/branches/git-branch-cleanup-real-git.test.ts": 883, "src/shared/git/status/git-branch-line-total-soft-deadline.test.ts": 74, "src/shared/git/status/git-branch-line-total.test.ts": 135, @@ -5876,13 +5852,11 @@ "src/shared/git/status/git-uncommitted-line-stats.test.ts": 87, "src/shared/git/worktrees/git-worktree-admin.test.ts": 161, "src/shared/github/account-binding.test.ts": 48, - "src/shared/github/api-availability.test.ts": 47, "src/shared/github/project-board-columns.test.ts": 64, "src/shared/github/project-identity.test.ts": 33, "src/shared/github/project-ref-input.test.ts": 40, "src/shared/github/project-roadmap-timeline.test.ts": 72, "src/shared/github/pull-request-auto-merge-availability.test.ts": 52, - "src/shared/github/pull-request-for-branch-outcome.test.ts": 43, "src/shared/github/pull-request-merge-methods.test.ts": 41, "src/shared/github/repository-identity-key.test.ts": 39, "src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts": 95, @@ -5900,7 +5874,6 @@ "src/shared/source-control/hosted-review/hosted-review-refs.test.ts": 57, "src/shared/html-file-url.test.ts": 49, "src/shared/image-data-uri.test.ts": 59, - "src/shared/imported-folder-project-identity.test.ts": 64, "src/shared/in-flight-promise-dedupe.test.ts": 63, "src/shared/jcode-session-files.test.ts": 70, "src/shared/jira/jira-favourite-filters.test.ts": 145, @@ -5938,7 +5911,6 @@ "src/shared/map-settled-with-concurrency.test.ts": 61, "src/shared/map-with-concurrency.test.ts": 50, "src/shared/markdown-document-listing-limits.test.ts": 44, - "src/shared/markdown-document-paths-windows-client.test.ts": 58, "src/shared/markdown-document-paths.test.ts": 51, "src/shared/mcp-config.test.ts": 92, "src/shared/mermaid-flowchart-contrast.test.ts": 180, @@ -5971,7 +5943,6 @@ "src/shared/native-chat/native-chat-notice.test.ts": 161, "src/shared/native-chat/native-chat-orca-stop-cut.test.ts": 180, "src/shared/native-chat/native-chat-provider-retry-runs.test.ts": 260, - "src/shared/native-chat/native-chat-shell-environment.test.ts": 44, "src/shared/native-chat/native-chat-terminal-turn.test.ts": 76, "src/shared/native-chat/native-chat-visual-directive.test.ts": 78, "src/shared/native-chat/native-chat-visual-height-governor.test.ts": 56, @@ -6027,7 +5998,6 @@ "src/shared/opencode-generation-output.test.ts": 103, "src/shared/agent-status/process/opencode-headless-command.test.ts": 68, "src/shared/opencode-installed-plugin.test.ts": 52, - "src/shared/opencode-launch-command.test.ts": 80, "src/shared/opencode-plugin-atomic-write.test.ts": 70, "src/shared/opencode-plugin-permissions.test.ts": 121, "src/shared/opencode-tui-config-registration.test.ts": 91, @@ -6062,7 +6032,6 @@ "src/shared/palette-match/palette-ranking.test.ts": 46, "src/shared/pan-zoom-view.test.ts": 39, "src/shared/physical-exit-tracker.test.ts": 46, - "src/shared/pi-agent-kind.test.ts": 86, "src/shared/plugin-theme-settings.test.ts": 55, "src/shared/plugins/approval/plugin-consent-fingerprint.test.ts": 197, "src/shared/plugins/approval/plugin-update-access-growth.test.ts": 189, @@ -6187,7 +6156,6 @@ "src/shared/ripgrep-dense-match-json.test.ts": 161, "src/shared/ripgrep-filename-decoder.test.ts": 49, "src/shared/ripgrep-line-decoding.test.ts": 352, - "src/shared/ripgrep-match-offsets.test.ts": 151, "src/shared/ripgrep-process-availability.test.ts": 56, "src/shared/ripgrep-search-diagnostics.test.ts": 72, "src/shared/rpc-contract/automation-params-extra-agent-args.test.ts": 131, @@ -6245,7 +6213,6 @@ "src/shared/sleeping-record-legacy-pane-key.test.ts": 59, "src/shared/source-control/listing/source-control-discard-all-sequence.test.ts": 50, "src/shared/source-control/recovery/source-control-push-failure.test.ts": 51, - "src/shared/source-control/listing/source-control-tree.test.ts": 63, "src/shared/source-scan/source-tree-scan.test.ts": 50, "src/shared/source-scan/source-tree-walk.test.ts": 62, "src/shared/ssh-pending-pty-kill.test.ts": 43, @@ -6258,7 +6225,6 @@ "src/shared/structured-agent-turn-clock-anchor.test.ts": 172, "src/shared/structured-native-chat-launch-route.test.ts": 66, "src/shared/structured-session-message-contracts.test.ts": 411, - "src/shared/subprocess-stdin-write.test.ts": 32, "src/shared/tab-agent-from-signals-pi-identity.test.ts": 103, "src/shared/task-query.test.ts": 55, "src/shared/task-source-context.test.ts": 103, diff --git a/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs b/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs index 7091649f492..6a44e5a9a96 100644 --- a/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs +++ b/config/scripts/test-runtime/sqlite-admission/vitest-node-runtime-files.mjs @@ -113,7 +113,6 @@ const NODE_RUNTIME_INCLUDE = [ 'src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts', 'src/shared/ephemeral-vm-recipe-output-capture.test.ts', 'src/main/updater/lifecycle/main-window-updater-deferred-setup.test.ts', - 'src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts', 'src/main/native-chat/agent-session-journal/**/*.test.ts', 'src/main/runtime/agent-session/records/agent-session-conversation-name-store.test.ts', 'src/main/runtime/rpc/methods/structured-sessions/attachments/structured-agent-session-visual.test.ts', diff --git a/src/main/ai-vault/transcripts/session-transcript-record-budget.test.ts b/src/main/ai-vault/transcripts/session-transcript-record-budget.test.ts deleted file mode 100644 index 1ebb11dcd4d..00000000000 --- a/src/main/ai-vault/transcripts/session-transcript-record-budget.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect, it } from 'vitest' -import { mergeSkippedTranscriptRecords } from './session-transcript-record-budget' - -const MiB = 1024 * 1024 - -it('merges skips by start offset and keeps the larger size', () => { - expect( - mergeSkippedTranscriptRecords( - [{ byteOffset: 40, approximateBytes: 11 * MiB }], - [ - { byteOffset: 40, approximateBytes: 14 * MiB }, - { byteOffset: 8, approximateBytes: 12 * MiB } - ] - ) - ).toEqual([ - { byteOffset: 8, approximateBytes: 12 * MiB }, - { byteOffset: 40, approximateBytes: 14 * MiB } - ]) -}) - -it('caps the tracked list so a pathological transcript cannot grow it', () => { - const many = Array.from({ length: 200 }, (_, index) => ({ - byteOffset: index * 11 * MiB, - approximateBytes: 11 * MiB - })) - expect(mergeSkippedTranscriptRecords([], many)).toHaveLength(32) -}) diff --git a/src/main/codex-accounts/login/codex-device-auth-prompt.test.ts b/src/main/codex-accounts/login/codex-device-auth-prompt.test.ts deleted file mode 100644 index e9a2f5456f1..00000000000 --- a/src/main/codex-accounts/login/codex-device-auth-prompt.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { parseCodexDeviceAuthPrompt } from './codex-device-auth-prompt' - -// Captured from `codex login --device-auth` (codex-cli 0.163.0) with piped stdout; code replaced. -const TRANSCRIPT = - "\nWelcome to Codex [v\u001b[90m0.163.0\u001b[0m]\n\u001b[90mOpenAI's command-line coding agent\u001b[0m\n\nFollow these steps to sign in with ChatGPT using device code authorization:\n\n1. Open this link in your browser and sign in to your account\n \u001b[94mhttps://auth.openai.com/codex/device\u001b[0m\n\n2. Enter this one-time code \u001b[90m(expires in 15 minutes)\u001b[0m\n \u001b[94mABCD-EFGH1\u001b[0m\n\n\u001b[90mContinue only if you started this login in Codex. If a website or another person gave you this code, cancel.\u001b[0m\n" - -describe('parseCodexDeviceAuthPrompt', () => { - it('reads the device page and one-time code from the captured transcript', () => { - expect(parseCodexDeviceAuthPrompt(TRANSCRIPT)).toEqual({ - url: 'https://auth.openai.com/codex/device', - userCode: 'ABCD-EFGH1' - }) - }) - - it('waits until the code is complete', () => { - const codeAt = TRANSCRIPT.indexOf('ABCD') - expect(parseCodexDeviceAuthPrompt(TRANSCRIPT.slice(0, codeAt + 6))).toBeNull() - expect(parseCodexDeviceAuthPrompt(TRANSCRIPT.slice(0, codeAt - 10))).toBeNull() - }) - - it('offers no page but OpenAIโ€™s own', () => { - const spoofed = TRANSCRIPT.replace('https://auth.openai.com/codex/device', 'https://evil.test/') - expect(parseCodexDeviceAuthPrompt(spoofed)).toBeNull() - }) -}) diff --git a/src/main/codex/app-server/codex-app-server-direct-open.test.ts b/src/main/codex/app-server/codex-app-server-direct-open.test.ts deleted file mode 100644 index 8f63f5af791..00000000000 --- a/src/main/codex/app-server/codex-app-server-direct-open.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PassThrough } from 'node:stream' -import { afterEach, expect, it, vi } from 'vitest' -import { createFakePipedChild } from '../../../shared/__fixtures__/fake-spawned-child' -import { openCodexAppServerConnection } from './codex-app-server-connection' - -afterEach(() => vi.useRealTimers()) - -it('ends a direct open and reaps its child when initialize never answers', async () => { - vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] }) - const child = createFakePipedChild(9_999_999) - child.stdout = new PassThrough() - child.stderr = new PassThrough() - child.stdin = new PassThrough() - child.stdin.on('finish', () => child.emit('exit', 0, null)) - const opening = openCodexAppServerConnection( - { command: 'codex', args: ['app-server'] }, - {}, - () => child - ).catch((error: unknown) => error) - - await vi.advanceTimersByTimeAsync(14_999) - expect(child.stdin.writableEnded).toBe(false) - await vi.advanceTimersByTimeAsync(1) - expect(await opening).toMatchObject({ name: 'CodexAppServerTimeoutError' }) - expect(child.stdin.writableEnded).toBe(true) -}) diff --git a/src/main/codex/structured/session-lifecycle/codex-structured-live-provider-process.test.ts b/src/main/codex/structured/session-lifecycle/codex-structured-live-provider-process.test.ts deleted file mode 100644 index d9076548228..00000000000 --- a/src/main/codex/structured/session-lifecycle/codex-structured-live-provider-process.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - acquireReadyCodexForTest, - adapterFor, - fakeCodex, - identityFor -} from './codex-structured-session-adapter-fixture' -import { describe, expect, it } from 'vitest' - -describe('Codex adapter liveness for lease renewal', () => { - it('holds its acquisition until the connection reports the root exit', async () => { - const codex = fakeCodex() - const adapter = adapterFor(codex) - const { acquisitionGeneration } = await acquireReadyCodexForTest(adapter, { - identity: identityFor('session-1'), - fence: 7, - spawnToken: 'spawn-9' - }) - - expect(adapter.holdsLiveProviderProcess('session-1', acquisitionGeneration!)).toBe(true) - expect(adapter.holdsLiveProviderProcess('session-1', 'another-acquisition')).toBe(false) - - codex.connections[0]!.handlers.onExit?.(new Error('codex app-server exited')) - expect(adapter.holdsLiveProviderProcess('session-1', acquisitionGeneration!)).toBe(false) - }) -}) diff --git a/src/main/ephemeral-vm/pending-vm-checkouts.test.ts b/src/main/ephemeral-vm/pending-vm-checkouts.test.ts deleted file mode 100644 index e89c84df283..00000000000 --- a/src/main/ephemeral-vm/pending-vm-checkouts.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - PendingVmCheckoutRegistry, - publishPendingVmCheckoutRepoChanges -} from './pending-vm-checkouts' - -describe('PendingVmCheckoutRegistry', () => { - it('tells phones to re-read each repo whose pending checkout appeared or went away', () => { - const registry = new PendingVmCheckoutRegistry() - registry.publish(1, [{ repoId: 'already', path: '/x' }]) - const notified: string[] = [] - const stop = publishPendingVmCheckoutRepoChanges(registry, (repoId) => notified.push(repoId)) - - registry.publish(2, [{ repoId: 'vm', path: '/srv/repo' }]) - expect(notified).toEqual(['vm']) - - // Another window's unrelated change does not re-announce this repo. - registry.publish(1, []) - expect(notified).toEqual(['vm', 'already']) - - registry.publish(2, []) - expect(notified).toEqual(['vm', 'already', 'vm']) - - stop() - registry.publish(2, [{ repoId: 'later', path: '/l' }]) - expect(notified).toEqual(['vm', 'already', 'vm']) - }) -}) diff --git a/src/main/github/attachments/body-image-urls.test.ts b/src/main/github/attachments/body-image-urls.test.ts deleted file mode 100644 index 3dceb105550..00000000000 --- a/src/main/github/attachments/body-image-urls.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { githubBodyImageUrls } from './body-image-urls' - -const original = 'https://github.com/user-attachments/assets/ce11040a-fb66-4289-927f-547b16dfc488' -const signed = - 'https://private-user-images.githubusercontent.com/1/2-ce11040a-fb66-4289-927f-547b16dfc488.png?jwt=TEST&download=1' - -describe('GitHub body image sources', () => { - it('matches rendered images to canonical assets without changing editable Markdown', () => { - const body = `![shot](${original})\n\n![missing](https://github.com/user-attachments/assets/cc11040a-fb66-4289-927f-547b16dfc488)\n\`https://github.com/user-attachments/assets/dd11040a-fb66-4289-927f-547b16dfc488\`` - const html = `https://private-user-images.githubusercontent.com/1/dd11040a-fb66-4289-927f-547b16dfc488.png` - expect(githubBodyImageUrls(body, html)).toEqual({ - 'https://github.com/user-attachments/assets/ce11040a-fb66-4289-927f-547b16dfc488': signed, - 'https://github.enterprise/team/repo/assets/42/ab11040a-fb66-4289-927f-547b16dfc488': - 'https://github.enterprise/storage/ab11040a-fb66-4289-927f-547b16dfc488.png?jwt=TEST' - }) - expect(githubBodyImageUrls(body, undefined)).toBeUndefined() - expect(githubBodyImageUrls(`![public](${original})`, ``)).toBeUndefined() - expect( - githubBodyImageUrls( - body, - '' - ) - ).toBeUndefined() - }) -}) diff --git a/src/main/github/client/list/work-item-search-fallback-environment.test.ts b/src/main/github/client/list/work-item-search-fallback-environment.test.ts deleted file mode 100644 index 7514420d8b7..00000000000 --- a/src/main/github/client/list/work-item-search-fallback-environment.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect, it, vi } from 'vitest' -import { api, capture } from '../../work-items/work-item-search-test-harness' -import { listWorkItems } from './list-work-items' -import './count-work-items' -import metadata from '../../__fixtures__/work-item-search-metadata.json' - -it('hydrates oversized associations with the preferred page credential', async () => { - vi.stubEnv('GH_TOKEN', 'fixture-original-credential') - const row = structuredClone(metadata[0].graphql) - api.specialNodes = [{ ...row, labels: { ...row.labels, pageInfo: { hasNextPage: true } } }] - capture.mockImplementation(async (binary, args, options) => { - if (args.includes('graphql')) { - vi.stubEnv('GH_TOKEN', 'fixture-later-credential') - } - return api.capture(binary, args, options) - }) - const result = await listWorkItems('fixture/repo', 24, 'is:issue') - expect(result.items[0].labels).toHaveLength(125) - const queries = api.calls.filter( - (call) => - call.args.includes('graphql') || call.args.some((arg) => /^repos\/.+\/issues\/\d+$/.test(arg)) - ) - expect(queries.map((call) => call.fixtureCredential)).toEqual([ - 'fixture-original-credential', - 'fixture-original-credential' - ]) -}) diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-orchestrator.test.ts b/src/main/persistence/moving-wsl-projects/wsl-move-orchestrator.test.ts deleted file mode 100644 index 37d083798c8..00000000000 --- a/src/main/persistence/moving-wsl-projects/wsl-move-orchestrator.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { WslMoveOrchestrator } from './wsl-move-orchestrator' -import { fakePorts } from './orchestration/wsl-move-orchestrator.test-support' - -describe('WslMoveOrchestrator', () => { - it('keeps Restore offered when the release is refused', async () => { - const ports = fakePorts({ - finishedMove: () => ({ migrationId: 'm1' }), - checkMovedDistro: vi.fn(async () => 'replaced' as const), - releaseFinishedMove: vi.fn(async () => ({ - released: false as const, - reason: 'unsaved-files' as const, - unsavedWorkspaceIds: ['wt'] - })) - }) - const orchestrator = new WslMoveOrchestrator(ports) - await orchestrator.trigger('Ubuntu', 'connect') - const { record, release } = await orchestrator.userAction('Ubuntu', 'restore') - expect(release).toMatchObject({ released: false, reason: 'unsaved-files' }) - expect(record.state).toEqual({ kind: 'restore-offered' }) - }) - - // E11 (#33843): a Remove that could not prove the server stopped leaves the host to the user. - - // Review of #34087: the wait cap counts checks, so a restart after days closed does not park. -}) diff --git a/src/main/runtime/agent-session/naming/structured-chat-naming-agent-launch.test.ts b/src/main/runtime/agent-session/naming/structured-chat-naming-agent-launch.test.ts deleted file mode 100644 index fe0db84cbe3..00000000000 --- a/src/main/runtime/agent-session/naming/structured-chat-naming-agent-launch.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { afterEach, expect, it, vi } from 'vitest' -import { agentSessionRecordFixture } from '../../../../shared/agent-session/lifecycle/records/agent-session-record.test-fixture' -import { chatNamingAgentTarget } from './structured-chat-naming-agent-launch' - -afterEach(() => vi.unstubAllGlobals()) - -it('reapplies configured Windows naming variables and keeps the recorded account pin', async () => { - vi.stubGlobal('process', { ...process, platform: 'win32' }) - const target = await chatNamingAgentTarget( - agentSessionRecordFixture(), - '/workspace', - async () => ({ - TOKEN: 'inherited', - PATH: '/inherited/bin', - CLAUDE_CONFIG_DIR: '/ambient/home' - }), - { agentDefaultEnv: { claude: { tOKEN: 'configured', path: '/configured/bin' } } } - ) - if (target.kind !== 'local') { - throw new Error('Naming did not resolve a local launch') - } - expect(target.env).toEqual({ - TOKEN: 'configured', - PATH: '/configured/bin', - CLAUDE_CONFIG_DIR: '/home/user/.claude' - }) -}) diff --git a/src/main/runtime/mobile-cloud-relay/authentication/relay-readiness-retention.test.ts b/src/main/runtime/mobile-cloud-relay/authentication/relay-readiness-retention.test.ts deleted file mode 100644 index 7a311015e68..00000000000 --- a/src/main/runtime/mobile-cloud-relay/authentication/relay-readiness-retention.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' -import { sharedPromiseSettlementWaiters } from '../../../../shared/promise-settlement-waiters' -import { RelayReadinessWaiters } from './relay-readiness' - -afterEach(() => vi.useRealTimers()) - -describe('relay readiness wait lifetime', () => { - it('releases callers without cancelling shared work and permits a later wait', async () => { - vi.useFakeTimers() - let finish = (): void => {} - const work = new Promise((resolve) => { - finish = resolve - }) - const waiters = new RelayReadinessWaiters() - const first = waiters.until(work, Date.now() + 10_000) - waiters.releaseAll() - await expect(first).resolves.toBe(false) - expect(sharedPromiseSettlementWaiters(work).waiterCount).toBe(0) - const next = waiters.until(work, Date.now() + 10_000) - finish() - await expect(next).resolves.toBe(true) - expect(vi.getTimerCount()).toBe(0) - }) -}) diff --git a/src/main/runtime/orchestration/crew/crew-pending-questions.test.ts b/src/main/runtime/orchestration/crew/crew-pending-questions.test.ts deleted file mode 100644 index d7aa7a844e1..00000000000 --- a/src/main/runtime/orchestration/crew/crew-pending-questions.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect, it } from 'vitest' -import { fixture } from './crew-read-model.test-fixture' -import { buildCrewSnapshot } from './crew-party-snapshot' - -it('decorates handed-back peer questions after row creation without flattening direct children', () => { - const { db, deps, run, assign } = fixture() - const parent = assign('term_worker') - const helper = assign('term_helper', 'term_worker') - const question = db.createQuestion({ - runId: run.id, - dispatchId: helper.id, - askerHandle: 'term_helper', - to: `dispatch:${parent.id}`, - question: 'Choose the helper option?' - }) - db.completeDispatch(parent.id) - expect(db.getMessageById(question.message.id)?.to_handle).toBe(`run:${run.id}`) - const snapshot = buildCrewSnapshot('term_coord', deps) - expect(snapshot.sections.managing.map((row) => row.sendAddress)).toEqual(['term_worker']) - expect(snapshot.sections.talkingWith).toHaveLength(1) - expect(snapshot.sections.talkingWith[0].pendingQuestion?.preview).toBe( - 'Choose the helper option?' - ) - expect(db.getQuestion(question.message.id)?.status).toBe('pending') -}) diff --git a/src/main/runtime/orchestration/federation/synchronization/federation-sync-generation.test.ts b/src/main/runtime/orchestration/federation/synchronization/federation-sync-generation.test.ts deleted file mode 100644 index 7fae4a0cad7..00000000000 --- a/src/main/runtime/orchestration/federation/synchronization/federation-sync-generation.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { createIdleSyncHarness } from './federation-sync-test-harness' - -describe('federation sync generation', () => { - it.each(['stopRelay', 'database swap'] as const)( - 'keeps a sync interrupted by %s from acknowledging into current state', - async (interruption) => { - const { runtime, blockAck, replaceDb } = createIdleSyncHarness() - const gate = blockAck() - - const oldSync = runtime.syncOrchestrationFederatedDispatch('dispatch_remote') - await gate.reached - if (interruption === 'stopRelay') { - runtime.stopOrchestrationFederationRelay() - } else { - replaceDb() - } - gate.release() - await oldSync - - expect( - runtime.getOrchestrationDb().getFederatedDispatch('dispatch_remote') - ?.to_home_acknowledged_sequence - ).toBe(0) - } - ) -}) diff --git a/src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.undo-clean.test.tsx b/src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.undo-clean.test.tsx deleted file mode 100644 index 93daa6f3c9c..00000000000 --- a/src/renderer/src/components/editor/model-lifetime/buffer-text/use-editor-content-change-handler.undo-clean.test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -// @vitest-environment happy-dom -import { act, cleanup, renderHook } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import { createEditorStore } from '../../autosave/editor-autosave-controller-test-fixture' -import { useEditorContentChangeHandler } from './use-editor-content-change-handler' - -const storeRef = vi.hoisted((): { current: ReturnType | null } => ({ - current: null -})) - -vi.mock('@/store/index', () => { - const read = () => { - if (!storeRef.current) { - throw new Error('store not set') - } - return storeRef.current.getState() - } - const useAppStore = Object.assign( - (select: (state: ReturnType) => T): T => select(read()), - { getState: read } - ) - return { useAppStore } -}) - -afterEach(cleanup) - -it('drops the draft when an edit is undone back to the saved text, so a clean tab holds none', () => { - const store = createEditorStore() - storeRef.current = store - store.getState().openFile({ - filePath: '/repo/file.ts', - relativePath: 'file.ts', - worktreeId: 'wt-1', - language: 'typescript', - mode: 'edit' - }) - const file = store.getState().openFiles[0] - const { result } = renderHook(() => - useEditorContentChangeHandler({ - fileContents: { [file.id]: { content: 'saved', isBinary: false } }, - diffContents: {} - }) - ) - - act(() => result.current(file, 'saved typed')) - expect(store.getState().editorDrafts[file.id]).toBe('saved typed') - expect(store.getState().openFiles[0]?.isDirty).toBe(true) - - act(() => result.current(file, 'saved')) - expect(store.getState().openFiles[0]?.isDirty).toBe(false) - expect(store.getState().editorDrafts[file.id]).toBeUndefined() -}) diff --git a/src/renderer/src/components/native-chat/composer/focus/native-chat-composer-focus-intent.test.ts b/src/renderer/src/components/native-chat/composer/focus/native-chat-composer-focus-intent.test.ts deleted file mode 100644 index a07f7725417..00000000000 --- a/src/renderer/src/components/native-chat/composer/focus/native-chat-composer-focus-intent.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -// @vitest-environment happy-dom -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { - captureNativeChatComposerFocusIntent, - registerNativeChatComposerReclaim, - type NativeChatComposerFocusIntent -} from './native-chat-composer-focus-intent' - -let intent: NativeChatComposerFocusIntent | undefined -let unregister: (() => void) | undefined - -beforeEach(() => vi.useFakeTimers()) - -afterEach(() => { - intent?.cancel() - unregister?.() - document.body.replaceChildren() - vi.useRealTimers() -}) - -function mountDestination(): HTMLTextAreaElement { - const composer = document.createElement('textarea') - document.body.append(composer) - unregister = registerNativeChatComposerReclaim('destination', () => composer.focus(), composer) - return composer -} - -function mountSource(role: string): HTMLDivElement { - const source = document.createElement('div') - source.setAttribute('role', role) - source.tabIndex = -1 - document.body.append(source) - source.focus() - intent = captureNativeChatComposerFocusIntent() - intent.request('destination') - expect(document.activeElement).toBe(source) - return source -} - -describe('custom overlay launch handoff', () => { - it('cancels when a newer custom overlay appears before dismissal', async () => { - const composer = mountDestination() - const source = mountSource('menu') - const newer = document.createElement('div') - newer.setAttribute('role', 'dialog') - newer.tabIndex = -1 - document.body.append(newer) - newer.focus() - await vi.advanceTimersByTimeAsync(0) - expect(document.activeElement).toBe(newer) - - source.remove() - newer.remove() - await vi.advanceTimersByTimeAsync(0) - expect(document.activeElement).not.toBe(composer) - }) -}) diff --git a/src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts b/src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts deleted file mode 100644 index 074d3c03b25..00000000000 --- a/src/renderer/src/components/native-chat/session/terminal/delivery/native-chat-pending.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { NativeChatMessage } from '../../../../../../../shared/native-chat/native-chat-types' - -import { launchPromptAsMessage, shouldPruneLaunchPrompt } from './native-chat-pending' - -function userMessage(id: string, text: string, timestamp = 1): NativeChatMessage { - return { - id, - role: 'user', - blocks: [{ type: 'text', text }], - timestamp, - source: 'transcript' - } -} - -function assistantMessage(id: string, text: string, timestamp = 2): NativeChatMessage { - return { - id, - role: 'assistant', - blocks: [{ type: 'text', text }], - timestamp, - source: 'transcript' - } -} - -describe('launchPromptAsMessage', () => { - // Grok has no timestamps; excluding its rows stranded launch echoes at the transcript tail. - it('hides and prunes the launch prompt against a timestampless transcript (grok)', () => { - const entry = { tabId: 'tab-1', agent: 'grok' as const, text: 'rename it', createdAt: 42 } - const transcript = [ - { ...userMessage('u1', 'rename it'), timestamp: null }, - { ...assistantMessage('a1', 'done'), timestamp: null } - ] - - expect(launchPromptAsMessage(entry, transcript)).toBeNull() - expect(shouldPruneLaunchPrompt(entry, transcript)).toBe(true) - }) - - it('does not bind a launch prompt to an older identical completed turn', () => { - const entry = { - tabId: 'tab-1', - agent: 'claude' as const, - text: 'run tests', - createdAt: 100 - } - const oldHistory = [ - { ...userMessage('old-user', 'run tests'), timestamp: 10 }, - { ...assistantMessage('old-answer', 'passed'), timestamp: 20 } - ] - - expect(launchPromptAsMessage(entry, oldHistory)).not.toBeNull() - expect(shouldPruneLaunchPrompt(entry, oldHistory)).toBe(false) - }) -}) diff --git a/src/renderer/src/components/plugins/state/use-plugin-review-queue.test.tsx b/src/renderer/src/components/plugins/state/use-plugin-review-queue.test.tsx deleted file mode 100644 index 3f876597a16..00000000000 --- a/src/renderer/src/components/plugins/state/use-plugin-review-queue.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -// @vitest-environment happy-dom - -import { act } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, describe, expect, it } from 'vitest' -import type { PluginHostListEntry } from '../../../../../shared/plugins/plugin-list-entry' -import { usePluginReviewQueue } from './use-plugin-review-queue' - -let root: Root | null = null -let queue: ReturnType | null = null - -function Harness(): null { - queue = usePluginReviewQueue() - return null -} - -function pending(pluginKey: string): PluginHostListEntry { - return { - pluginKey, - consentFingerprint: 'f', - name: pluginKey, - version: '1.0.0', - publisher: 'acme', - status: 'pending', - needsReconsent: true, - isDev: false, - official: false, - bundled: false, - capabilities: [], - panels: [], - commands: [], - hasWorker: false, - restarts: 0 - } -} - -afterEach(() => { - act(() => root?.unmount()) - root = null -}) - -describe('usePluginReviewQueue', () => { - it('opens each queued review in turn, skipping ones no longer needing review', async () => { - root = createRoot(document.createElement('div')) - await act(async () => root?.render()) - await act(async () => queue?.enqueue(['a', 'b', 'c'])) - expect(queue?.reviewKey).toBe('a') - - // Why: "b" was approved elsewhere meanwhile, so only "c" still needs review. - await act(async () => queue?.advance('a', [pending('c')])) - expect(queue?.reviewKey).toBe('c') - await act(async () => queue?.advance('c', [])) - expect(queue?.reviewKey).toBeNull() - }) -}) diff --git a/src/renderer/src/components/settings/form-controls/use-debounced-settings-text-draft.test.ts b/src/renderer/src/components/settings/form-controls/use-debounced-settings-text-draft.test.ts deleted file mode 100644 index 25eff0984c8..00000000000 --- a/src/renderer/src/components/settings/form-controls/use-debounced-settings-text-draft.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -// @vitest-environment happy-dom - -// @vitest-environment happy-dom - -import { act, cleanup, renderHook } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { useDebouncedSettingsTextDraft } from './use-debounced-settings-text-draft' - -beforeEach(() => { - vi.useFakeTimers() -}) - -afterEach(() => { - cleanup() - vi.useRealTimers() -}) - -describe('useDebouncedSettingsTextDraft flush paths', () => { - it('commits a pending edit on beforeunload, since a window close never unmounts the tree', () => { - const commit = vi.fn() - const { result, unmount } = renderHook(() => - useDebouncedSettingsTextDraft({ value: '', commit }) - ) - - act(() => result.current.onChange('quit-mid-word')) - act(() => { - window.dispatchEvent(new Event('beforeunload', { cancelable: true })) - }) - - expect(commit).toHaveBeenCalledExactlyOnceWith('quit-mid-word') - - unmount() - act(() => { - vi.advanceTimersByTime(700) - }) - expect(commit).toHaveBeenCalledTimes(1) - }) - - it('keeps a keystroke typed while the previous commit is still in flight', () => { - const commit = vi.fn() - const { result, rerender } = renderHook( - ({ value }) => useDebouncedSettingsTextDraft({ value, commit }), - { initialProps: { value: '' } } - ) - - act(() => result.current.onChange('abc')) - act(() => { - vi.advanceTimersByTime(700) - }) - act(() => result.current.onChange('abcd')) - // Model a delayed commit echo arriving after further typing. - rerender({ value: 'abc' }) - - expect(result.current.value).toBe('abcd') - - act(() => result.current.onBlur()) - expect(commit).toHaveBeenLastCalledWith('abcd') - expect(commit).toHaveBeenCalledTimes(2) - }) -}) diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeLineageNotice.test.tsx b/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeLineageNotice.test.tsx deleted file mode 100644 index a22b8af0a9b..00000000000 --- a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeLineageNotice.test.tsx +++ /dev/null @@ -1,56 +0,0 @@ -// @vitest-environment happy-dom - -import { cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import type { Worktree } from '../../../../../../shared/worktree/types' -import { DeleteWorktreeLineageNotice } from './DeleteWorktreeLineageNotice' - -vi.mock('@/store', () => ({ - useAppStore: (selector: (state: { projects: never[]; projectHostSetups: never[] }) => unknown) => - selector({ projects: [], projectHostSetups: [] }) -})) - -afterEach(cleanup) - -it('lets a selected preserve option be cleared when it becomes unavailable, even with no children', () => { - const onChange = vi.fn() - const child: Worktree = { - id: 'child', - instanceId: 'child-instance', - repoId: 'repo', - path: '/parent/child', - displayName: 'child', - head: 'abc123', - branch: 'child', - isBare: false, - isMainWorktree: false, - comment: '', - linkedIssue: null, - linkedPR: null, - linkedLinearIssue: null, - isArchived: false, - isUnread: false, - isPinned: false, - sortOrder: 0, - lastActivityAt: 0 - } - const props = { - descendants: [child], - dirtyChangeCountsByWorktreeId: new Map(), - dirtyChangePreviewsByWorktreeId: new Map(), - preserveChildren: true, - canPreserveChildren: false, - disabled: false, - onPreserveChildrenChange: onChange - } - const { rerender } = render() - const checkbox = screen.getByRole('checkbox') - expect(checkbox.hasAttribute('disabled')).toBe(false) - fireEvent.click(checkbox) - expect(onChange).toHaveBeenCalledWith(false) - - rerender() - fireEvent.click(screen.getByRole('checkbox')) - expect(onChange).toHaveBeenCalledTimes(2) - expect(onChange).toHaveBeenLastCalledWith(false) -}) diff --git a/src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.tsx b/src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.tsx deleted file mode 100644 index 15384f41fe1..00000000000 --- a/src/renderer/src/components/sidebar/worktree-list/viewport/use-scroll-to-top.test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -// @vitest-environment happy-dom - -import { act, cleanup, renderHook } from '@testing-library/react' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { useWorktreeListScrollToTop } from './use-scroll-to-top' - -function createScroller(): HTMLElement { - const element = document.createElement('div') - element.tabIndex = 0 - document.body.append(element) - Object.defineProperties(element, { - scrollHeight: { configurable: true, value: 5000 }, - clientHeight: { configurable: true, value: 500 }, - // 16px narrower than offsetWidth so the scrollbar hit-test has a realistic gutter. - clientWidth: { configurable: true, value: 284 }, - offsetWidth: { configurable: true, value: 300 } - }) - element.getBoundingClientRect = () => ({ - bottom: 500, - height: 500, - left: 0, - right: 300, - top: 0, - width: 300, - x: 0, - y: 0, - toJSON: () => ({}) - }) - return element -} - -afterEach(() => { - cleanup() - vi.restoreAllMocks() - document.body.replaceChildren() -}) - -describe('useWorktreeListScrollToTop', () => { - it('returns focus to the list after jumping to the top', () => { - const element = createScroller() - element.scrollTop = 1200 - element.scrollTo = vi.fn(({ top }) => { - element.scrollTop = Number(top) - }) - const view = renderHook(() => useWorktreeListScrollToTop({ scrollElement: element })) - - act(() => { - for (let index = 0; index < 4; index += 1) { - element.dispatchEvent(new WheelEvent('wheel', { deltaY: -200 })) - } - }) - const button = document.createElement('button') - document.body.append(button) - button.focus() - - act(() => view.result.current.scrollToTop()) - - expect(element.scrollTop).toBe(0) - expect(document.activeElement).toBe(element) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/agent-completion/process-inspection/agent-process-inspection-queue-rejection-containment.test.ts b/src/renderer/src/components/terminal-pane/agent-completion/process-inspection/agent-process-inspection-queue-rejection-containment.test.ts deleted file mode 100644 index 03380fe3ca2..00000000000 --- a/src/renderer/src/components/terminal-pane/agent-completion/process-inspection/agent-process-inspection-queue-rejection-containment.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { afterEach, describe, expect, it } from 'vitest' -import { - enqueueAgentProcessInspection, - resetAgentProcessInspectionQueueForTests -} from './agent-process-inspection-queue' - -// Node emits 'unhandledRejection' a turn after the microtask queue drains. -async function settleRejections(): Promise { - for (let index = 0; index < 4; index += 1) { - await new Promise((resolve) => setTimeout(resolve, 0)) - } -} - -async function collectUnhandledRejections(run: () => Promise): Promise { - const unhandled: unknown[] = [] - const onUnhandledRejection = (reason: unknown): void => { - unhandled.push(reason) - } - process.on('unhandledRejection', onUnhandledRejection) - try { - await run() - } finally { - process.off('unhandledRejection', onUnhandledRejection) - } - return unhandled -} - -describe('agent process inspection queue rejection containment', () => { - afterEach(() => { - resetAgentProcessInspectionQueueForTests() - }) - - it('keeps draining the queue after a rejecting inspection', async () => { - const ran: string[] = [] - const unhandled = await collectUnhandledRejections(async () => { - enqueueAgentProcessInspection({ - priority: 'cadence', - canRun: () => true, - run: () => Promise.reject(new Error('unreachable')) - }) - enqueueAgentProcessInspection({ - priority: 'cadence', - canRun: () => true, - run: async () => { - ran.push('second') - } - }) - await settleRejections() - }) - - expect(unhandled).toEqual([]) - expect(ran).toEqual(['second']) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts b/src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts deleted file mode 100644 index 2c5b561580a..00000000000 --- a/src/renderer/src/components/terminal-pane/host-state/terminal-pane-host-state-memo.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -// useShallow skips renders, not selectors; memoize host resolution to avoid per-tab traversal and discarded objects on every publication. -import { beforeEach, describe, expect, it } from 'vitest' -import type { AppState } from '@/store/types' -import { - resetTerminalPaneHostStateMemoForTests, - selectTerminalPaneHostState -} from './terminal-pane-host-state' - -const LOCAL_WORKTREE = 'repo-1::/repo/worktrees/local' - -/** Only the fields the resolver touches; the memo key is the whole object. */ -function makeState(overrides: Partial> = {}): AppState { - return { - repos: [], - worktreesByRepo: {}, - detectedWorktreesByRepo: {}, - folderWorkspaces: [], - activeWorktreeId: null, - activeWorkspaceExecutionHostId: null, - runtimeEnvironments: [], - runtimeStatusByEnvironmentId: new Map(), - sshConnectionStates: new Map(), - sshStateByEnvironment: new Map(), - sshTargetLabels: new Map(), - removedSshTargetLabels: new Map(), - sshTargetsHydrated: true, - sshTargets: [], - ...overrides - } as unknown as AppState -} - -beforeEach(() => { - resetTerminalPaneHostStateMemoForTests() -}) - -describe('selectTerminalPaneHostState memo', () => { - it('releases the last store snapshot when no terminal selects again', async () => { - if (typeof globalThis.gc !== 'function') { - throw new Error('Run with the repository Vitest --expose-gc config') - } - function selectRetiredState(): WeakRef { - const state = makeState() - selectTerminalPaneHostState(state, LOCAL_WORKTREE) - return new WeakRef(state) - } - const retired = selectRetiredState() - for (let round = 0; round < 3; round++) { - await new Promise((resolve) => setImmediate(resolve)) - globalThis.gc() - } - expect(retired.deref()).toBeUndefined() - }) -}) diff --git a/src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx b/src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx deleted file mode 100644 index 84af6551920..00000000000 --- a/src/renderer/src/components/workspace-emoji/WorkspaceEmojiPickerPanel.test.tsx +++ /dev/null @@ -1,53 +0,0 @@ -// @vitest-environment happy-dom - -import { cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { WorkspaceEmojiPickerPanel } from './WorkspaceEmojiPickerPanel' - -afterEach(cleanup) - -function searchBox(): HTMLElement { - return screen.getByPlaceholderText('Search emoji') -} - -describe('WorkspaceEmojiPickerPanel', () => { - it('filters by shortcode and picks the highlighted match on Enter without bubbling', () => { - const onPick = vi.fn() - const onParentKeyDown = vi.fn() - render( -
- -
- ) - - fireEvent.change(searchBox(), { target: { value: 'tada' } }) - expect(screen.getAllByRole('option')[0].textContent).toContain(':tada:') - fireEvent.keyDown(searchBox(), { key: 'Enter' }) - - expect(onPick).toHaveBeenCalledWith('๐ŸŽ‰') - expect(onParentKeyDown).not.toHaveBeenCalled() - }) - - it('shows an empty state when nothing matches', () => { - render() - fireEvent.change(searchBox(), { target: { value: 'zzzznotanemoji' } }) - - expect(screen.queryAllByRole('option')).toHaveLength(0) - expect(screen.getByText('No emoji found')).toBeTruthy() - }) - - it.each([{ isComposing: true }, { keyCode: 229 }])( - 'leaves IME-owned Enter to the search input (%o)', - (imeEvent) => { - const onPick = vi.fn() - render() - - fireEvent.change(searchBox(), { target: { value: 'tada' } }) - fireEvent.keyDown(searchBox(), { key: 'Enter', ...imeEvent }) - expect(onPick).not.toHaveBeenCalled() - - fireEvent.keyDown(searchBox(), { key: 'Enter' }) - expect(onPick).toHaveBeenCalledWith('๐ŸŽ‰') - } - ) -}) diff --git a/src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts b/src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts deleted file mode 100644 index a88765504c6..00000000000 --- a/src/renderer/src/hooks/ipc-events/direct-ssh-unrestored-forward-sync.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { UnrestoredPortForward } from '../../../../shared/ssh-types' - -const h = vi.hoisted(() => ({ setUnrestoredPortForwards: vi.fn() })) - -vi.mock('@/store', () => ({ - useAppStore: { getState: () => ({ setUnrestoredPortForwards: h.setUnrestoredPortForwards }) } -})) - -const { createDirectSshUnrestoredForwardSync } = - await import('./direct-ssh-unrestored-forward-sync') - -const HELD: UnrestoredPortForward = { - localPort: 4100, - remoteHost: '127.0.0.1', - remotePort: 80, - error: 'port in use' -} - -describe('saved forwards mirrored from main', () => { - let resolveRead: (list: UnrestoredPortForward[]) => void = () => {} - - beforeEach(() => { - h.setUnrestoredPortForwards.mockReset() - vi.stubGlobal('window', { - api: { - ssh: { - listUnrestoredPortForwards: () => - new Promise((resolve) => (resolveRead = resolve)) - } - } - }) - }) - - // A read answered before a removal landed must not bring the removed forward back. - it('drops a read a newer push superseded', async () => { - const sync = createDirectSshUnrestoredForwardSync(() => false) - sync.refresh('t1') - sync.applyPush('t1', []) - resolveRead([HELD]) - await Promise.resolve() - await Promise.resolve() - expect(h.setUnrestoredPortForwards.mock.calls).toEqual([['t1', []]]) - }) - - it('applies a read nothing superseded', async () => { - const sync = createDirectSshUnrestoredForwardSync(() => false) - sync.refresh('t1') - resolveRead([HELD]) - await vi.waitFor(() => expect(h.setUnrestoredPortForwards).toHaveBeenCalledWith('t1', [HELD])) - }) -}) diff --git a/src/renderer/src/hooks/useMetadataListRequest.test.tsx b/src/renderer/src/hooks/useMetadataListRequest.test.tsx deleted file mode 100644 index ed2e22e2572..00000000000 --- a/src/renderer/src/hooks/useMetadataListRequest.test.tsx +++ /dev/null @@ -1,53 +0,0 @@ -// @vitest-environment happy-dom - -import { act, cleanup, renderHook } from '@testing-library/react' -import { afterEach, describe, expect, it } from 'vitest' -import { createMetadataRequestStore } from './metadata-request-cache' -import { useMetadataListRequest } from './useMetadataListRequest' - -function deferred(): { promise: Promise; resolve: (value: T) => void } { - let resolve!: (value: T) => void - const promise = new Promise((settle) => { - resolve = settle - }) - return { promise, resolve } -} - -afterEach(cleanup) - -describe('useMetadataListRequest', () => { - it('ignores stale responses and retains the result while disabled', async () => { - const store = createMetadataRequestStore() - const first = deferred() - const second = deferred() - const view = renderHook( - ({ cacheKey }: { cacheKey: string | null }) => - useMetadataListRequest({ - cacheKey, - store, - errorFallback: 'Failed to load metadata', - load: () => (cacheKey === 'first' ? first.promise : second.promise) - }), - { initialProps: { cacheKey: 'first' as string | null } } - ) - - view.rerender({ cacheKey: 'second' }) - await act(async () => { - second.resolve(['second']) - await second.promise - }) - expect(view.result.current.data).toEqual(['second']) - - view.rerender({ cacheKey: null }) - await act(async () => { - first.resolve(['first']) - await first.promise - }) - expect(view.result.current).toEqual({ - data: ['second'], - loading: false, - error: null, - resolvedKey: 'second' - }) - }) -}) diff --git a/src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts b/src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts deleted file mode 100644 index 1e09be4d866..00000000000 --- a/src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - buildMarkdownHeadingSections, - type MarkdownHeadingSection -} from './markdown-heading-outline' - -type Outline = { title: string; lines: [number, number]; children?: Outline[] } - -function outline(sections: MarkdownHeadingSection[]): Outline[] { - return sections.map((section) => ({ - title: section.title, - lines: [section.startLine, section.endLine], - ...(section.children.length > 0 ? { children: outline(section.children) } : {}) - })) -} - -describe('buildMarkdownHeadingSections', () => { - it('nests sections by level and ends each before the next same-or-higher heading', () => { - const lines = ['# A', 'text', '## B', '### C', 'x', '## D', '# E', 'tail'] - expect(outline(buildMarkdownHeadingSections(lines))).toEqual([ - { - title: 'A', - lines: [1, 6], - children: [ - { title: 'B', lines: [3, 5], children: [{ title: 'C', lines: [4, 5] }] }, - { title: 'D', lines: [6, 6] } - ] - }, - { title: 'E', lines: [7, 8] } - ]) - }) - - it('ignores fenced code, front matter, and thematic breaks but reads setext headings', () => { - const lines = [ - '---', - 'title: # not a heading', - '---', - '````md', - '# fenced', - '```', - '````', - 'Setext Title', - '===', - '', - '---', - '- item', - '---', - '## Closed ##' - ] - expect(outline(buildMarkdownHeadingSections(lines))).toEqual([ - { title: 'Setext Title', lines: [8, 14], children: [{ title: 'Closed', lines: [14, 14] }] } - ]) - }) -}) diff --git a/src/renderer/src/lib/workspace-ports/workspace-port-scan-debounce.test.ts b/src/renderer/src/lib/workspace-ports/workspace-port-scan-debounce.test.ts deleted file mode 100644 index c7853693477..00000000000 --- a/src/renderer/src/lib/workspace-ports/workspace-port-scan-debounce.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { describe, it, expect } from 'vitest' -import { - reconcileTransientPortScanFailures, - type KeyedPortScan, - type PortScanDebounceState -} from './workspace-port-scan-debounce' -import type { WorkspacePortScanResult } from '../../../../shared/workspace-ports' - -function good(portIds: string[]): WorkspacePortScanResult { - return { - platform: 'unknown', - scannedAt: 1, - ports: portIds.map((id) => ({ - id, - bindHost: '127.0.0.1', - connectHost: '127.0.0.1', - port: Number(id.split(':')[1] ?? 0), - protocol: 'http', - kind: 'external' - })) - } -} - -const FAILURE_THRESHOLD = 2 - -function createHarness(): { - apply: (results: KeyedPortScan[]) => KeyedPortScan[] - publish: (key: string, result: WorkspacePortScanResult) => void - state: PortScanDebounceState -} { - const state: PortScanDebounceState = new Map() - let publishedScans: Record = {} - return { - apply: (results) => { - const reconciled = reconcileTransientPortScanFailures( - results, - publishedScans, - state, - FAILURE_THRESHOLD - ) - publishedScans = Object.fromEntries(reconciled.map(({ key, result }) => [key, result])) - return reconciled - }, - publish: (key, result) => { - publishedScans = { ...publishedScans, [key]: result } - }, - state - } -} - -describe('reconcileTransientPortScanFailures', () => { - it('prunes state for hosts that disappear', () => { - const { apply, state } = createHarness() - apply([{ key: 'gone:all', result: good(['tcp:3000']) }]) - apply([{ key: 'other:all', result: good(['tcp:4000']) }]) - expect(state.has('gone:all')).toBe(false) - expect(state.has('other:all')).toBe(true) - }) -}) diff --git a/src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts b/src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts deleted file mode 100644 index 50bda1b72f7..00000000000 --- a/src/renderer/src/runtime/provider-accounts/observations/claude-agent-view-observations.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { afterEach, expect, it, vi } from 'vitest' -import type { RuntimeRpcSubscriptionHandlers } from '../../rpc/subscriptions/runtime-rpc-subscribe' - -const subscribe = vi.hoisted(() => vi.fn()) -vi.mock('../../rpc/subscriptions/runtime-rpc-subscribe', () => ({ subscribeRuntimeRpc: subscribe })) - -import { readClaudeAgentViews, subscribeClaudeAgentViews } from './claude-agent-view-observations' - -afterEach(() => { - vi.useRealTimers() - vi.clearAllMocks() -}) - -it('clears disconnected observations until fresh evidence arrives', async () => { - vi.useFakeTimers() - const streams: RuntimeRpcSubscriptionHandlers[] = [] - const close = vi.fn() - subscribe.mockImplementation(async (_target, _method, _params, handlers) => { - streams.push(handlers) - return { unsubscribe: close } - }) - const key = 'reconnecting-host' - const first = subscribeClaudeAgentViews( - key, - { kind: 'environment', environmentId: 'env' }, - vi.fn() - ) - const second = subscribeClaudeAgentViews( - key, - { kind: 'environment', environmentId: 'env' }, - vi.fn() - ) - const snapshot = [{ paneKey: 'pane', sessionId: 'session', agentId: 'keyboard-child' }] - streams[0].onEvent(snapshot) - expect(readClaudeAgentViews(key)).toEqual([ - { paneKey: 'pane', sessionId: 'session', agentId: 'keyboard-child' } - ]) - await Promise.resolve() - first() - streams[0].onClose() - expect(readClaudeAgentViews(key)).toEqual([]) - streams[0].onEvent(snapshot) - expect(readClaudeAgentViews(key)).toEqual([]) - await vi.advanceTimersByTimeAsync(5000) - streams[1].onEvent([{ paneKey: 'pane', sessionId: 'session' }]) - expect(readClaudeAgentViews(key)).toEqual([{ paneKey: 'pane', sessionId: 'session' }]) - second() - await Promise.resolve() - expect(readClaudeAgentViews(key)).toEqual([]) -}) diff --git a/src/renderer/src/store/slices/worktrees/metadata/foreign-host-status-guard.test.ts b/src/renderer/src/store/slices/worktrees/metadata/foreign-host-status-guard.test.ts deleted file mode 100644 index 0fdce853139..00000000000 --- a/src/renderer/src/store/slices/worktrees/metadata/foreign-host-status-guard.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' - -import 'sonner' - -import { makeWorktree } from '../worktree.test-fixture' -import { - createTestStore, - mockApi, - resetRemoteRuntimeMocks, - resetWorktreeSliceModuleMemory -} from '../worktrees-slice-test-harness' - -const requestWorktreeBaseFallbackNotice = vi.hoisted(() => vi.fn()) - -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 -})) - -beforeEach(resetWorktreeSliceModuleMemory) - -describe('worktree remote runtime mutations', () => { - beforeEach(() => { - vi.clearAllMocks() - resetRemoteRuntimeMocks() - }) - - it("keeps a local card out of a paired host's own column but still applies its rank", async () => { - const store = createTestStore() - const local = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' }) - store.setState({ - worktreesByRepo: { repo1: [local] }, - workspaceStatuses: [{ id: 'in-progress', label: 'In progress' }], - hostWorkspaceStatuses: { 'env-1': [{ id: 'status-6', label: 'Today' }] } - }) - - await store - .getState() - .updateWorktreesMeta([ - { worktreeId: local.id, updates: { workspaceStatus: 'status-6', manualOrder: 5 } } - ]) - await store.getState().updateWorktreeMeta(local.id, { workspaceStatus: 'status-6' }) - - expect(store.getState().worktreesByRepo.repo1[0]).toMatchObject({ manualOrder: 5 }) - expect(store.getState().worktreesByRepo.repo1[0]?.workspaceStatus).toBeUndefined() - expect(mockApi.worktrees.updateMeta).toHaveBeenCalledWith( - expect.objectContaining({ updates: { manualOrder: 5 } }) - ) - }) -}) diff --git a/src/shared/agent-hook-listener/normalization/agent-hook-listener-claude-permission-mode.test.ts b/src/shared/agent-hook-listener/normalization/agent-hook-listener-claude-permission-mode.test.ts deleted file mode 100644 index f0fac65b262..00000000000 --- a/src/shared/agent-hook-listener/normalization/agent-hook-listener-claude-permission-mode.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { beforeEach, describe, expect, it } from 'vitest' -import { createHookListenerState, type HookListenerState } from '../listener-state' -import { normalizeAndAccept } from './agent-hook-listener-test-harness' - -describe("Claude's permission mode on the pane's provider session", () => { - let state: HookListenerState - - beforeEach(() => { - state = createHookListenerState() - }) - - function post(payload: Record): string | undefined { - return normalizeAndAccept(state, 'claude', { - session_id: '6f1f0b5e-2c3d-4e5f-8a9b-0c1d2e3f4a5b', - ...payload - })?.providerSession?.permissionMode - } - - // A hand-typed resume of the same conversation may drop the bypass the last process had. - it('keeps the mode across /clear but not into a fresh resume of the same conversation', () => { - post({ - hook_event_name: 'UserPromptSubmit', - prompt: 'hi', - permission_mode: 'bypassPermissions' - }) - expect(post({ hook_event_name: 'SessionStart', source: 'clear' })).toBe('bypassPermissions') - expect(post({ hook_event_name: 'SessionStart', source: 'resume' })).toBeUndefined() - }) -}) diff --git a/src/shared/agent-hook-listener/transport/agent-hook-listener-transport.test.ts b/src/shared/agent-hook-listener/transport/agent-hook-listener-transport.test.ts deleted file mode 100644 index 097a3a4616d..00000000000 --- a/src/shared/agent-hook-listener/transport/agent-hook-listener-transport.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { mkdtempSync, readdirSync, rmSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { getEndpointFileName, writeEndpointFile } from './endpoint-publication' - -describe('shared agent-hook-listener', () => { - describe('writeEndpointFile', () => { - let dir: string - beforeEach(() => { - dir = mkdtempSync(join(tmpdir(), 'agent-hook-listener-')) - }) - afterEach(() => { - rmSync(dir, { recursive: true, force: true }) - }) - - it('refuses unsafe values', () => { - const finalPath = join(dir, getEndpointFileName()) - const ok = writeEndpointFile(dir, finalPath, { - port: 12345, - token: 'safe-token', - env: 'foo&bar', - version: '1' - }) - expect(ok).toBe(false) - expect(readdirSync(dir)).toEqual([]) - }) - }) -}) diff --git a/src/shared/agent-launch/permissions/agent-chat-permission-mode.test.ts b/src/shared/agent-launch/permissions/agent-chat-permission-mode.test.ts deleted file mode 100644 index 1d68c1d39c9..00000000000 --- a/src/shared/agent-launch/permissions/agent-chat-permission-mode.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { agentChatPermissionModes } from './agent-chat-permission-support' -import { newChatPermissionMode, savedChatPermissionMode } from './agent-chat-permission-mode' - -const CLAUDE_CHAT_PERMISSION_MODES = agentChatPermissionModes('claude')! -const CODEX_CHAT_PERMISSION_MODES = agentChatPermissionModes('codex')! - -describe('agent chat permission modes', () => { - it('seeds a new chat from the host setting, narrowed to what its agent offers', () => { - expect(newChatPermissionMode('codex', 'accept-edits')).toBe('ask') - expect(newChatPermissionMode('claude', 'accept-edits')).toBe('accept-edits') - expect(newChatPermissionMode('claude', 'auto')).toBe('auto') - expect(newChatPermissionMode('codex', 'full-access')).toBe('full-access') - expect(newChatPermissionMode('claude', 'retired-mode')).toBe('ask') - expect(newChatPermissionMode('claude', undefined)).toBe('ask') - expect(newChatPermissionMode('omp', 'full-access')).toBe('full-access') - expect(newChatPermissionMode('omp', 'accept-edits')).toBe('ask') - expect(newChatPermissionMode('pi', 'full-access')).toBeNull() - }) -}) - -describe('the mode a chat runs', () => { - it('asks for a chat saved before modes existed, or with a value its agent cannot run', () => { - expect(savedChatPermissionMode(CLAUDE_CHAT_PERMISSION_MODES, undefined)).toBe('ask') - expect(savedChatPermissionMode(CLAUDE_CHAT_PERMISSION_MODES, null)).toBe('ask') - expect(savedChatPermissionMode(CODEX_CHAT_PERMISSION_MODES, 'accept-edits')).toBe('ask') - expect(savedChatPermissionMode(CLAUDE_CHAT_PERMISSION_MODES, 'bypassPermissions')).toBe('ask') - }) -}) diff --git a/src/shared/environment-overlay.test.ts b/src/shared/environment-overlay.test.ts deleted file mode 100644 index fa0522547c7..00000000000 --- a/src/shared/environment-overlay.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect, it } from 'vitest' -import { overlayEnvironmentVariables } from './environment-overlay' - -it('replaces Windows aliases in configured order while preserving untouched inherited names', () => { - const base = { TOKEN: 'old', Token: 'also old', PATH: 'first', Path: 'second', KEEP: 'keep' } - const configured = { token: 'first override', tOKEN: '', Custom: 'configured' } - expect(overlayEnvironmentVariables(base, configured, 'win32')).toEqual({ - PATH: 'first', - Path: 'second', - KEEP: 'keep', - TOKEN: '', - CUSTOM: 'configured' - }) - expect(Object.entries(base)).toEqual([ - ['TOKEN', 'old'], - ['Token', 'also old'], - ['PATH', 'first'], - ['Path', 'second'], - ['KEEP', 'keep'] - ]) - expect(configured).toEqual({ token: 'first override', tOKEN: '', Custom: 'configured' }) - expect(overlayEnvironmentVariables(base, undefined, 'win32')).toEqual(base) - expect(overlayEnvironmentVariables({ TOKEN: 'old' }, { token: 'new' }, 'linux')).toEqual({ - TOKEN: 'old', - token: 'new' - }) -}) diff --git a/src/shared/file-listing/markdown-document-paths-windows-client.test.ts b/src/shared/file-listing/markdown-document-paths-windows-client.test.ts deleted file mode 100644 index 07c6a33dd5f..00000000000 --- a/src/shared/file-listing/markdown-document-paths-windows-client.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import type * as NodePath from 'node:path' - -vi.mock('node:path', async (importOriginal) => { - const actual = await importOriginal() - return { ...actual, extname: actual.win32.extname } -}) - -import { markdownDocumentFromRelativePath } from './markdown-document-paths' - -describe('remote Markdown filenames on a Windows client', () => { - it.each(['notes.md\\', 'nested/.md', '../outside.md'])( - 'rejects non-Markdown or escaping POSIX filename %s', - (relativePath) => { - expect(markdownDocumentFromRelativePath('/home/repo', relativePath)).toBeNull() - } - ) - - it('normalizes Windows remote separators before reading the basename', () => { - expect(markdownDocumentFromRelativePath('C:\\repo', 'notes\\README.MD')).toEqual({ - filePath: 'C:\\repo/notes/README.MD', - relativePath: 'notes/README.MD', - basename: 'README.MD', - name: 'README' - }) - expect(markdownDocumentFromRelativePath('C:\\repo', 'notes\\.md')).toBeNull() - expect(markdownDocumentFromRelativePath('C:\\repo', '..\\outside.md')).toBeNull() - }) -}) diff --git a/src/shared/git/diff/git-blob-absence.test.ts b/src/shared/git/diff/git-blob-absence.test.ts deleted file mode 100644 index 272e01d921c..00000000000 --- a/src/shared/git/diff/git-blob-absence.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { isMissingGitBlobPath } from './git-blob-absence' - -describe('Git blob path absence', () => { - it.each([ - 'fatal: bad object :new.txt', - 'fatal: invalid object name HEAD', - 'fatal: detected dubious ownership in repository', - 'fatal: bad config line 1', - "fatal: path 'other.txt' does not exist (neither on disk nor in the index)", - "fatal: path 'new.txt' is in the index, but not at stage 0" - ])('does not classify another failure as absence (%s)', (stderr) => { - expect(isMissingGitBlobPath({ code: 128, stderr }, 'new.txt')).toBe(false) - }) - - it('requires the exit status as well as the diagnostic', () => { - const stderr = "fatal: path 'new.txt' exists on disk, but not in the index" - expect(isMissingGitBlobPath({ code: 1, stderr }, 'new.txt')).toBe(false) - expect(isMissingGitBlobPath({ code: '128', stderr }, 'new.txt')).toBe(false) - }) - - it('matches newline and quote filenames literally', () => { - const filePath = "quote' and\nnewline.txt" - const stderr = `fatal: path '${filePath}' exists on disk, but not in the index\n` - expect(isMissingGitBlobPath({ code: 128, stderr }, filePath)).toBe(true) - expect( - isMissingGitBlobPath({ code: 128, stderr: `fatal: bad object :${filePath}` }, filePath) - ).toBe(false) - }) -}) diff --git a/src/shared/github/api/api-availability.test.ts b/src/shared/github/api/api-availability.test.ts deleted file mode 100644 index 0a6e9bd4241..00000000000 --- a/src/shared/github/api/api-availability.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { classifyGitHubUnavailable } from './api-availability' - -describe('classifyGitHubUnavailable', () => { - it('classifies rate limiting as rate_limited (even when it carries HTTP 403)', () => { - expect(classifyGitHubUnavailable('HTTP 403: API rate limit exceeded')).toBe('rate_limited') - expect(classifyGitHubUnavailable('You have exceeded a secondary rate limit')).toBe( - 'rate_limited' - ) - expect(classifyGitHubUnavailable('HTTP 429 Too Many Requests')).toBe('rate_limited') - }) - - it('returns null for non-reachability failures', () => { - expect(classifyGitHubUnavailable('HTTP 403: Resource not accessible by integration')).toBeNull() - expect(classifyGitHubUnavailable('HTTP 404: Not Found')).toBeNull() - expect(classifyGitHubUnavailable('could not resolve to a Repository with the name')).toBeNull() - expect( - classifyGitHubUnavailable( - "GraphQL: Could not resolve to a Repository with the name 'network'." - ) - ).toBeNull() - expect(classifyGitHubUnavailable('gh auth login required')).toBeNull() - expect(classifyGitHubUnavailable('')).toBeNull() - }) - - it('does not misread unrelated 3-digit numbers as a server outage', () => { - expect(classifyGitHubUnavailable('found 512 pull requests')).toBeNull() - }) -}) diff --git a/src/shared/github/pull-requests/refresh/pull-request-for-branch-outcome.test.ts b/src/shared/github/pull-requests/refresh/pull-request-for-branch-outcome.test.ts deleted file mode 100644 index 8dabf2549dd..00000000000 --- a/src/shared/github/pull-requests/refresh/pull-request-for-branch-outcome.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import type { PRInfo } from '../pull-request-types' -import { normalizeGitHubPRForBranchOutcome } from './pull-request-for-branch-outcome' - -const PR: PRInfo = { - number: 42, - title: 'Feature', - state: 'merged', - url: 'https://github.com/acme/orca/pull/42', - checksStatus: 'success', - updatedAt: '2026-08-04T22:46:08Z', - mergeable: 'UNKNOWN' -} - -describe('normalizeGitHubPRForBranchOutcome', () => { - it('normalizes legacy PRInfo and null responses', () => { - expect(normalizeGitHubPRForBranchOutcome(PR, 20)).toEqual({ - kind: 'found', - pr: PR, - fetchedAt: 20 - }) - expect(normalizeGitHubPRForBranchOutcome(null, 20)).toEqual({ - kind: 'no-pr', - fetchedAt: 20 - }) - }) -}) diff --git a/src/shared/imported-folder-project-identity.test.ts b/src/shared/imported-folder-project-identity.test.ts deleted file mode 100644 index 6a8e8c3a2e2..00000000000 --- a/src/shared/imported-folder-project-identity.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { deriveGitRemoteIdentity } from './git/remotes/git-remote-identity' -import { resolveImportedFolderProjectLink } from './imported-folder-project-identity' - -function folder(remoteUrl: string | null) { - return { - id: 'imported-repo', - gitRemoteIdentity: remoteUrl - ? deriveGitRemoteIdentity(`origin\t${remoteUrl} (fetch)\norigin\t${remoteUrl} (push)\n`) - : null - } -} - -describe('resolveImportedFolderProjectLink', () => { - it('still refuses a GitHub remote that names another repository', () => { - expect(() => - resolveImportedFolderProjectLink( - folder('https://github.com/acme/other.git'), - 'github:acme/orca', - { - provider: 'github', - owner: 'acme', - repo: 'orca' - } - ) - ).toThrow('its Git remote "origin" points at acme/other') - }) -}) diff --git a/src/shared/native-chat/native-chat-resolution-receipt.test.ts b/src/shared/native-chat/native-chat-resolution-receipt.test.ts deleted file mode 100644 index 091879d2081..00000000000 --- a/src/shared/native-chat/native-chat-resolution-receipt.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { expect, it } from 'vitest' -import { nativeChatReceiptDevice } from './native-chat-resolution-receipt' -import type { AgentJournalResolution } from '../agent-session/journal/agent-session-journal-types' - -const resolution: AgentJournalResolution = { - state: 'resolved', - selectedOptionId: 'red', - resolvedBy: '5d857d9e-ec3f-4762-b7f4-69691f580707', - resolvedAt: 10 -} -const labels = { current: 'this phone', computer: 'the computer', unknown: 'another device' } - -it.each([ - [undefined, 'another device'], - [{ kind: 'current' }, 'this phone'], - [{ kind: 'named', name: "Kelvin's iPhone" }, "Kelvin's iPhone"], - [{ kind: 'named', name: ' ' }, 'another device'] -] satisfies [AgentJournalResolution['resolvedByDevice'], string][])( - 'uses readable receipt labels for current, named and older-host devices: %j', - (resolvedByDevice, expected) => { - expect(nativeChatReceiptDevice({ ...resolution, resolvedByDevice }, labels)).toBe(expected) - } -) - -it.each(['trusted-local:desktop', 'desktop-renderer'])( - "does not display older hosts' local caller key %s", - (resolvedBy) => { - expect(nativeChatReceiptDevice({ ...resolution, resolvedBy }, labels)).toBe('the computer') - } -) diff --git a/src/shared/native-chat/native-chat-shell-environment.test.ts b/src/shared/native-chat/native-chat-shell-environment.test.ts deleted file mode 100644 index ea2658bad9a..00000000000 --- a/src/shared/native-chat/native-chat-shell-environment.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - isNativeChatShellEnvironmentName, - nativeChatShellEnvironmentPolicy -} from './native-chat-shell-environment' - -describe('isNativeChatShellEnvironmentName', () => { - it('accepts a whole shell variable name and nothing else', () => { - for (const name of ['CODEX_LB_API_KEY', 'https_proxy', '_OK', 'A1']) { - expect(isNativeChatShellEnvironmentName(name), name).toBe(true) - } - for (const name of ['', ' ', 'FOO-BAR', '1BAD', 'FOO BAR', 'FOO,BAR', 'HTTPS_PROXY ']) { - expect(isNativeChatShellEnvironmentName(name), JSON.stringify(name)).toBe(false) - } - }) -}) - -describe('nativeChatShellEnvironmentPolicy', () => { - it('carries the listed names, re-validated, when inheritance is off', () => { - expect( - nativeChatShellEnvironmentPolicy({ - nativeChatInheritShellEnvironment: false, - nativeChatShellEnvironmentVariables: ['CODEX_LB_API_KEY', 'not valid', 'CODEX_LB_API_KEY'] - }) - ).toEqual({ inheritAll: false, names: ['CODEX_LB_API_KEY'] }) - }) -}) diff --git a/src/shared/opencode-launch-command.test.ts b/src/shared/opencode-launch-command.test.ts deleted file mode 100644 index 569e317c0d6..00000000000 --- a/src/shared/opencode-launch-command.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { selectOpenCodeHookAgent } from './opencode-launch-command' - -describe('OpenCode hook selection', () => { - it.each([ - 'opencode --session fixture', - '"C:\\tools\\opencode.exe" --session fixture', - '/usr/local/bin/opencode' - ])('preserves disabled v1 identity for %s', (command) => { - expect(selectOpenCodeHookAgent(undefined, command, (agent) => agent === 'opencode2')).toBeNull() - }) - it('trusts the supplied identity for wrapped or renamed commands', () => { - expect(selectOpenCodeHookAgent('opencode', 'opencode2', () => true)).toBe('opencode') - expect( - selectOpenCodeHookAgent('opencode2', 'my-wrapper', (agent) => agent === 'opencode2') - ).toBe('opencode2') - }) -}) - -describe('selectOpenCodeHookAgent after a sleep prefix', () => { - it('selects OpenCode 2 hooks instead of the v1 fallback', () => { - expect(selectOpenCodeHookAgent(undefined, 'sleep 30 && opencode2', () => true)).toBe( - 'opencode2' - ) - expect( - selectOpenCodeHookAgent(undefined, 'sleep 30 && opencode2', (agent) => agent === 'opencode') - ).toBeNull() - }) -}) diff --git a/src/shared/pi-agent-kind.test.ts b/src/shared/pi-agent-kind.test.ts deleted file mode 100644 index 2c67c18b4a4..00000000000 --- a/src/shared/pi-agent-kind.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { detectExplicitPiAgentKindFromCommand } from './pi-agent-kind' - -describe('detectExplicitPiAgentKindFromCommand', () => { - it('does not classify bare shells or other agents as Pi launches', () => { - expect(detectExplicitPiAgentKindFromCommand(undefined)).toBeNull() - expect(detectExplicitPiAgentKindFromCommand('')).toBeNull() - expect(detectExplicitPiAgentKindFromCommand('codex --resume session-a')).toBeNull() - expect(detectExplicitPiAgentKindFromCommand('codex "ask about pi"')).toBeNull() - expect(detectExplicitPiAgentKindFromCommand('claude')).toBeNull() - expect(detectExplicitPiAgentKindFromCommand('python3 script.py')).toBeNull() - }) - - it('classifies the launched agent instead of mentions in its arguments', () => { - expect(detectExplicitPiAgentKindFromCommand('pi "compare omp"')).toBe('pi') - expect(detectExplicitPiAgentKindFromCommand('omp "compare pi"')).toBe('omp') - expect(detectExplicitPiAgentKindFromCommand('prime-agent "compare pi and omp"')).toBe( - 'prime-agent' - ) - }) -}) - -describe('detectExplicitPiAgentKindFromCommand after a sleep prefix', () => { - it.each(['pi', 'omp', 'prime-agent'] as const)('prepares the %s integration', (agent) => { - expect(detectExplicitPiAgentKindFromCommand(`sleep 30 && ${agent}`)).toBe(agent) - }) -}) diff --git a/src/shared/ripgrep/ripgrep-match-offsets.test.ts b/src/shared/ripgrep/ripgrep-match-offsets.test.ts deleted file mode 100644 index e679134808d..00000000000 --- a/src/shared/ripgrep/ripgrep-match-offsets.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { createRipgrepOffsetReader, ripgrepMatchRanges } from './ripgrep-match-offsets' - -describe('ripgrep match offsets', () => { - it('converts ordered ASCII, accented, CJK and astral boundaries to UTF16', () => { - const text = 'aรฉๆ—ฅ๐Ÿ˜€z' - const read = createRipgrepOffsetReader(text) - expect([0, 1, 3, 6, 10, 11].map(read)).toEqual([0, 1, 2, 3, 5, 6]) - expect(read(11)).toBe(6) - }) - - it('rejects invalid, backwards and partial codepoint offsets', () => { - const read = createRipgrepOffsetReader('รฉ๐Ÿ˜€') - expect(read(-1)).toBeNull() - expect(read(0.5)).toBeNull() - expect(read(1)).toBeNull() - expect(read(2)).toBe(1) - expect(read(0)).toBeNull() - expect(read(6)).toBe(3) - expect(read(7)).toBeNull() - }) - - it('preserves zero-length matches and whole-codepoint line fallbacks', () => { - expect([...ripgrepMatchRanges('๐Ÿ˜€รฉ', [{ start: 4, end: 4 }])]).toEqual([{ start: 2, end: 2 }]) - expect([...ripgrepMatchRanges('๐Ÿ˜€รฉ', [])]).toEqual([{ start: 0, end: 2 }]) - expect([...ripgrepMatchRanges('', [])]).toEqual([{ start: 0, end: 0 }]) - }) -}) diff --git a/src/shared/source-control/listing/source-control-tree.test.ts b/src/shared/source-control/listing/source-control-tree.test.ts deleted file mode 100644 index 75ba1175045..00000000000 --- a/src/shared/source-control/listing/source-control-tree.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import type { GitStatusEntry } from '../../git/status/git-status-types' -import { buildSourceControlTree, collectSourceControlTreeFileEntries } from './source-control-tree' - -function entry(partial: Partial & { path: string }): GitStatusEntry { - return { - status: 'modified', - area: 'unstaged', - ...partial - } -} - -describe('buildSourceControlTree', () => { - it('collects all descendant file entries for directory actions', () => { - const tree = buildSourceControlTree('unstaged', [ - entry({ path: 'src/app.ts' }), - entry({ path: 'src/components/Button.tsx' }), - entry({ path: 'docs/readme.md' }) - ]) - - const src = tree.find((node) => node.type === 'directory' && node.path === 'src') - - expect(src ? collectSourceControlTreeFileEntries(src).map((item) => item.path) : []).toEqual([ - 'src/components/Button.tsx', - 'src/app.ts' - ]) - }) -}) diff --git a/src/shared/subprocess-stdin-write.test.ts b/src/shared/subprocess-stdin-write.test.ts deleted file mode 100644 index 49fd8e94f0d..00000000000 --- a/src/shared/subprocess-stdin-write.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { EventEmitter } from 'node:events' -import type { Writable } from 'node:stream' -import { describe, expect, it, vi } from 'vitest' -import { endSubprocessStdin } from './subprocess-stdin-write' - -describe('endSubprocessStdin', () => { - it('handles an early-exit pipe error emitted while ending a large write', () => { - const pipeError = Object.assign(new Error('write EPIPE'), { code: 'EPIPE' }) - const stdin = new EventEmitter() as Writable - stdin.end = vi.fn(() => { - stdin.emit('error', pipeError) - return stdin - }) as Writable['end'] - expect(() => endSubprocessStdin(stdin, 'x'.repeat(1_000_000))).not.toThrow() - - expect(stdin.listenerCount('error')).toBe(0) - }) - - it('keeps the error handler attached for a pipe failure after the caller times out', () => { - const stdin = new EventEmitter() as Writable - stdin.end = vi.fn(() => stdin) as Writable['end'] - endSubprocessStdin(stdin, 'payload') - expect(stdin.listenerCount('error')).toBe(1) - - const pipeError = Object.assign(new Error('write EPIPE'), { code: 'EPIPE' }) - expect(() => stdin.emit('error', pipeError)).not.toThrow() - - expect(stdin.listenerCount('error')).toBe(0) - }) -})