From 126e59e1ad43977f97431d6a129bc75833d01de1 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sun, 15 Nov 2026 18:26:10 -0800 Subject: [PATCH] test: remove 55 low-value suites (#42916) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../workflows/zcode-transcript-contract.yml | 2 +- config/flaky-test-pattern-baseline.txt | 2 - .../scripts/ci/sharding/ci-shard-timings.json | 42 --- .../check-agent-status-map-ratchet.test.mjs | 68 ---- .../SyntheticMouseClickDeliveryTests.swift | 40 --- package.json | 2 +- src/main/amp/hook-service.test.ts | 67 ---- .../native-account-usage-read.test.ts | 54 --- ...cal-ssh-browser-partition-identity.test.ts | 48 --- ...count-session-bridge-hardlink-only.test.ts | 61 ---- ...sh-breadcrumb-renderer-attribution.test.ts | 66 ---- .../testing/daemon-appimage-launch.test.ts | 64 ---- ...nal-history-seed-transfer-registry.test.ts | 46 --- .../launch/testing/daemon-exit-record.test.ts | 57 ---- .../daemon-generation-liveness.test.ts | 48 --- ...etry-protected-milestone-admission.test.ts | 62 ---- ...cad-state-mutation-fence-heartbeat.test.ts | 46 --- .../plugin-update-review-notices.test.ts | 53 --- .../mobile-notification-replay.test.ts | 53 --- ...-main-layout-commands-layout-owner.test.ts | 58 ---- .../orca-runtime-sidebar-inputs-feed.test.ts | 54 --- .../bundled-skill-workspace-targets.test.ts | 51 --- src/main/speech/stt-live-decode.test.ts | 50 --- .../ssh-exec-command-decoder-fallback.test.ts | 59 ---- .../client-agent-dashboard-snapshot.test.ts | 65 ---- ...ource-control-agent-hook-isolation.test.ts | 63 ---- .../hosts/automation-host-scheduler.test.ts | 180 ---------- ...red-client-hosted-recovery-window.test.tsx | 192 ----------- ...red-agent-session-transcript-order.test.ts | 155 --------- ...ed-agent-session-delivery-notices.test.tsx | 152 --------- .../AiVaultSessionHistoryDialog.test.tsx | 170 ---------- ...use-checks-panel-terminal-worktree.test.ts | 182 ---------- .../parent-pr-checks-rows.test.ts | 196 ----------- .../sidebar-click-focus-handoff.test.tsx | 175 ---------- .../skill-freshness-auto-update.test.ts | 168 ---------- .../tab-bar/TabBarCreateEntry.search.test.tsx | 315 ------------------ ...terminal-pane-frame-reconciliation.test.ts | 150 --------- .../wsl-move/wsl-move-scope-rows.test.ts | 172 ---------- .../runtime-reconnect-host-status.test.ts | 172 ---------- .../orcad-bind-address.test.ts | 13 - .../repository/repo-host-identity.test.ts | 33 -- src/shared/repository/repo-host-identity.ts | 2 +- .../windows-security-addon.test.ts | 34 -- .../launch/powershell-native-argument.test.ts | 31 -- .../launch/startup-command-staging.test.ts | 84 ----- .../packages/skill-package-manifest.test.ts | 47 --- .../paths/skill-path-containment.test.ts | 55 --- .../skills/sharing/skill-share-link.test.ts | 14 - .../osc52-clipboard-settings.test.ts | 24 -- .../git-bash-console-capacity.test.ts | 43 --- .../opencode-generation-command.test.ts | 47 --- .../output/opencode-generation-output.test.ts | 85 ----- .../profile-state-build-compatibility.test.ts | 18 - src/shared/updater/release-channel.test.ts | 48 --- .../requirements/macos-darwin-floor.test.ts | 9 - .../validation/zod-salvage-absence.test.ts | 20 -- src/shared/validation/zod-salvage.ts | 2 +- .../bundled-web-client-manifest.test.ts | 38 --- .../worktree/github-issue-repository.test.ts | 52 --- .../agent-scratch-worktrees.test.ts | 62 ---- .../external-worktree-inbox.test.ts | 103 ------ 61 files changed, 4 insertions(+), 4520 deletions(-) delete mode 100644 config/scripts/static-analysis/ratchets/renderer-state/check-agent-status-map-ratchet.test.mjs delete mode 100644 native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SyntheticMouseClickDeliveryTests.swift delete mode 100644 src/main/amp/hook-service.test.ts delete mode 100644 src/main/antigravity/native-account-usage-read.test.ts delete mode 100644 src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts delete mode 100644 src/main/codex/history/bridges/codex-account-session-bridge-hardlink-only.test.ts delete mode 100644 src/main/crash-reporting/breadcrumbs/crash-breadcrumb-renderer-attribution.test.ts delete mode 100644 src/main/daemon/executable-host/linux/testing/daemon-appimage-launch.test.ts delete mode 100644 src/main/daemon/history/seed-transfer/testing/terminal-history-seed-transfer-registry.test.ts delete mode 100644 src/main/daemon/launch/testing/daemon-exit-record.test.ts delete mode 100644 src/main/daemon/launch/testing/daemon-generation-liveness.test.ts delete mode 100644 src/main/ipc/telemetry-protected-milestone-admission.test.ts delete mode 100644 src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts delete mode 100644 src/main/plugins/catalog/plugin-update-review-notices.test.ts delete mode 100644 src/main/runtime/push/notifications/mobile-notification-replay.test.ts delete mode 100644 src/main/runtime/session-tabs/windowless-main-layout-commands-layout-owner.test.ts delete mode 100644 src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts delete mode 100644 src/main/skills/bundled-skill-install/bundled-skill-workspace-targets.test.ts delete mode 100644 src/main/speech/stt-live-decode.test.ts delete mode 100644 src/main/ssh/remote-exec/ssh-exec-command-decoder-fallback.test.ts delete mode 100644 src/main/telemetry/client-agent-dashboard-snapshot.test.ts delete mode 100644 src/main/text-generation/execution/source-control-agent-hook-isolation.test.ts delete mode 100644 src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts delete mode 100644 src/renderer/src/components/browser-pane/restored-client-hosted-recovery-window.test.tsx delete mode 100644 src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts delete mode 100644 src/renderer/src/components/native-chat/session/structured/delivery/use-structured-agent-session-delivery-notices.test.tsx delete mode 100644 src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionHistoryDialog.test.tsx delete mode 100644 src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-terminal-worktree.test.ts delete mode 100644 src/renderer/src/components/right-sidebar/hosted-review/folder-checks/parent-pr-checks-rows.test.ts delete mode 100644 src/renderer/src/components/sidebar/worktree-list/navigation/sidebar-click-focus-handoff.test.tsx delete mode 100644 src/renderer/src/components/skills/freshness/skill-freshness-auto-update.test.ts delete mode 100644 src/renderer/src/components/tab-bar/TabBarCreateEntry.search.test.tsx delete mode 100644 src/renderer/src/components/terminal-pane/layout/reconciliation/terminal-pane-frame-reconciliation.test.ts delete mode 100644 src/renderer/src/components/wsl-move/wsl-move-scope-rows.test.ts delete mode 100644 src/renderer/src/hooks/ipc-events/runtime-reconnect-host-status.test.ts delete mode 100644 src/shared/remote-runtime/orcad-lifecycle/orcad-bind-address.test.ts delete mode 100644 src/shared/repository/repo-host-identity.test.ts delete mode 100644 src/shared/secure-storage/windows-security-addon.test.ts delete mode 100644 src/shared/shell/launch/powershell-native-argument.test.ts delete mode 100644 src/shared/shell/launch/startup-command-staging.test.ts delete mode 100644 src/shared/skills/packages/skill-package-manifest.test.ts delete mode 100644 src/shared/skills/paths/skill-path-containment.test.ts delete mode 100644 src/shared/skills/sharing/skill-share-link.test.ts delete mode 100644 src/shared/terminal/clipboard/osc52-clipboard-settings.test.ts delete mode 100644 src/shared/terminal/pty/lifecycle/git-bash-console-capacity.test.ts delete mode 100644 src/shared/text-generation/launch/opencode-generation-command.test.ts delete mode 100644 src/shared/text-generation/output/opencode-generation-output.test.ts delete mode 100644 src/shared/updater/profile-state-build-compatibility.test.ts delete mode 100644 src/shared/updater/release-channel.test.ts delete mode 100644 src/shared/updater/requirements/macos-darwin-floor.test.ts delete mode 100644 src/shared/validation/zod-salvage-absence.test.ts delete mode 100644 src/shared/web-client/bundled-web-client-manifest.test.ts delete mode 100644 src/shared/worktree/github-issue-repository.test.ts delete mode 100644 src/shared/worktree/visibility/agent-scratch-worktrees.test.ts delete mode 100644 src/shared/worktree/visibility/external-worktree-inbox.test.ts diff --git a/.github/workflows/zcode-transcript-contract.yml b/.github/workflows/zcode-transcript-contract.yml index eacd35634f8..a048c925e00 100644 --- a/.github/workflows/zcode-transcript-contract.yml +++ b/.github/workflows/zcode-transcript-contract.yml @@ -40,4 +40,4 @@ jobs: bun-version-file: config/.bun-version no-cache: true - name: Verify SQLite ordering, legacy readers, and host routing - run: pnpm test src/main/native-chat/transcript-history/opencode/transcript-zcode.test.ts src/main/native-chat/transcript-history/opencode/transcript-opencode-sqlite-query.test.ts src/main/ai-vault/scanners/zcode/session-scanner-zcode.test.ts src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts src/shared/native-chat/transcript/native-chat-transcript-projection.test.ts src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts + run: pnpm test src/main/native-chat/transcript-history/opencode/transcript-zcode.test.ts src/main/native-chat/transcript-history/opencode/transcript-opencode-sqlite-query.test.ts src/main/ai-vault/scanners/zcode/session-scanner-zcode.test.ts src/main/ai-vault/scanners/opencode/reader-transport/opencode-wsl-runtime-preparation.test.ts src/shared/native-chat/transcript/native-chat-transcript-projection.test.ts diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 06cfa3e8371..bf5d106ca73 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -473,7 +473,6 @@ 1 test-no-wall-clock:src/shared/agent-hook-listener/transport/agent-hook-spool-drain.test.ts 1 test-no-wall-clock:src/shared/agent-hook-listener/transport/agent-hook-spool-read.test.ts 2 test-no-wall-clock:src/shared/shell/launch/startup-command-staging.node-pty.test.ts -1 test-no-wall-clock:src/shared/shell/launch/startup-command-staging.test.ts 2 test-no-wall-clock:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts 10 test-no-wall-clock:src/wsl-guest/agent-hooks/publication/agent-hook-integration.test.ts 1 test-no-wall-clock:src/wsl-guest/agent-hooks/server/agent-hook-server.test.ts @@ -521,7 +520,6 @@ 1 test-timeout-needs-reason:src/main/ipc/filesystem/filesystem-quick-open-options.integration.test.ts 1 test-timeout-needs-reason:src/main/ipc/preflight-runnable-local-cli.test.ts 1 test-timeout-needs-reason:src/main/jcode/hook-gate-script.test.ts -1 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts 1 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-windows-host-lane.test.ts 4 test-timeout-needs-reason:src/main/managed-server/lifecycle/orcad-managed-tunnel-transport-real-openssh.test.ts 3 test-timeout-needs-reason:src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.test.ts diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index abe661feda6..1c68b98716d 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -568,7 +568,6 @@ "src/main/ai-vault/structured-chat-conversation-copy.test.ts": 917, "src/main/ai-vault/structured-session-ownership-client-audience.test.ts": 1092, "src/main/ai-vault/structured-session-ownership.test.ts": 1191, - "src/main/amp/hook-service.test.ts": 68, "src/main/antigravity/antigravity-browser-helper.test.ts": 161, "src/main/antigravity/antigravity-chat-sign-in.test.ts": 1497, "src/main/antigravity/antigravity-sign-in-callback.test.ts": 59, @@ -768,7 +767,6 @@ "src/main/browser/element-grab/grab-guest-script.test.ts": 107, "src/main/browser/cdp/debugger/guest-cdp-command.test.ts": 105, "src/main/browser/cdp/input/guest-focused-frame-route.test.ts": 78, - "src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts": 479, "src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts": 287, "src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts": 92, "src/main/browser/backends/offscreen-browser-backend-lifecycle.test.ts": 341, @@ -937,7 +935,6 @@ "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, "src/main/codex/hooks/reconciliation/codex-account-home-hook.test.ts": 365, - "src/main/codex/history/bridges/codex-account-session-bridge-hardlink-only.test.ts": 260, "src/main/codex/history/bridges/codex-account-session-bridge.test.ts": 465, "src/main/codex/history/resume/codex-ai-vault-session-resume.test.ts": 131, "src/main/codex/structured/catalog/codex-at-rest-skills-probe.test.ts": 614, @@ -1072,7 +1069,6 @@ "src/main/connector-cloud/connector-snapshot.test.ts": 126, "src/main/connector-cloud/connector-turn-events.test.ts": 411, "src/main/copilot/hook-service.test.ts": 180, - "src/main/crash-reporting/breadcrumbs/crash-breadcrumb-renderer-attribution.test.ts": 60, "src/main/crash-reporting/breadcrumbs/crash-breadcrumb-store-orphan-cleanup.test.ts": 81, "src/main/crash-reporting/reports/crash-report-store.test.ts": 438, "src/main/crash-reporting/minidumps/minidump-crash-signature.test.ts": 87, @@ -1084,7 +1080,6 @@ "src/main/daemon/transport/client/testing/client.test.ts": 464, "src/main/daemon/emulation/testing/conpty-reflow-viewport.test.ts": 222, "src/main/daemon/executable-host/linux/testing/daemon-appimage-copy-host.electron.test.ts": 3292, - "src/main/daemon/executable-host/linux/testing/daemon-appimage-launch.test.ts": 153, "src/main/daemon/observability/testing/daemon-audit-eligibility-event.test.ts": 896, "src/main/daemon/admission/testing/daemon-automatic-work-guard.test.ts": 240, "src/main/daemon/providers/lifecycle/testing/daemon-automatic-work-resume.test.ts": 880, @@ -1101,7 +1096,6 @@ "src/main/daemon/permissions/testing/daemon-folder-access-mismatch.test.ts": 220, "src/main/daemon/permissions/testing/daemon-folder-access-probe-script.test.ts": 198, "src/main/daemon/permissions/testing/daemon-folder-access-reset.test.ts": 226, - "src/main/daemon/launch/testing/daemon-generation-liveness.test.ts": 127, "src/main/daemon/health/testing/daemon-health-socket-cleanup.test.ts": 135, "src/main/daemon/health/testing/daemon-health.test.ts": 4438, "src/main/daemon/executable-host/windows/testing/daemon-host-current-version-reclaim.test.ts": 350, @@ -1230,7 +1224,6 @@ "src/main/daemon/history/storage/testing/terminal-history-log.test.ts": 49, "src/main/daemon/history/storage/testing/terminal-history-permissions.test.ts": 283, "src/main/daemon/history/seed-transfer/testing/terminal-history-seed-segments.test.ts": 141, - "src/main/daemon/history/seed-transfer/testing/terminal-history-seed-transfer-registry.test.ts": 49, "src/main/daemon/terminal-host/testing/terminal-host-agent-session.test.ts": 467, "src/main/daemon/terminal-host/testing/terminal-host-closing-session-listing.test.ts": 788, "src/main/daemon/terminal-host/testing/terminal-host-concurrent-create.test.ts": 665, @@ -1715,7 +1708,6 @@ "src/main/managed-server/activation/orcad-activation-fence-generation.test.ts": 702, "src/main/managed-server/activation/orcad-activation-transaction.test.ts": 351, "src/main/managed-server/host-state/orcad-machine-home.test.ts": 2218, - "src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts": 2120, "src/main/managed-server/host-state/orcad-state-snapshot-shell.test.ts": 1009, "src/main/managed-server/host-state/orcad-state-snapshot-space.test.ts": 366, "src/main/managed-server/host-state/orcad-windows-host-fence-ops.test.ts": 852, @@ -1896,7 +1888,6 @@ "src/main/orcad/host-runtime/orcad-app-paths.test.ts": 45, "src/main/orcad/artifact-slots/orcad-artifact-cache-retention.test.ts": 301, "src/main/orcad/artifact-slots/orcad-artifact-materializer.test.ts": 1129, - "src/main/orcad/orcad-bind-address.test.ts": 41, "src/main/orcad/native-runtime/orcad-bundle-native-load-order.test.ts": 3555, "src/main/orcad/serve-startup/orcad-cli-launcher.integration.test.ts": 390, "src/main/orcad/serve-startup/orcad-cli-launcher.test.ts": 232, @@ -2058,7 +2049,6 @@ "src/main/plugins/catalog/plugin-marketplace-store.test.ts": 250, "src/main/plugins/catalog/plugin-private-marketplace.integration.test.ts": 978, "src/main/plugins/catalog/plugin-update-approval.test.ts": 298, - "src/main/plugins/catalog/plugin-update-review-notices.test.ts": 175, "src/main/plugins/contributions/plugin-content-pack-registry.test.ts": 589, "src/main/plugins/contributions/plugin-icon-theme-registry.test.ts": 268, "src/main/plugins/contributions/plugin-syntax-registry.test.ts": 221, @@ -2319,7 +2309,6 @@ "src/main/runtime/mobile-desktop-relay/relayed-phone-frames.test.ts": 1022, "src/main/runtime/push/notifications/mobile-notification-dismissal-read-failure.test.ts": 181, "src/main/runtime/push/notifications/mobile-notification-dismissal-store.test.ts": 214, - "src/main/runtime/push/notifications/mobile-notification-replay.test.ts": 43, "src/main/runtime/rpc/server/pairing/mobile-pairing-userdata-path.test.ts": 171, "src/main/runtime/terminal/layout/mobile-presence-lock.test.ts": 25928, "src/main/runtime/session-tabs/headless-editor-tabs.test.ts": 57, @@ -2797,7 +2786,6 @@ "src/main/runtime/sidebar-inputs/catalog/desktop-sidebar-facts.test.ts": 378, "src/main/runtime/sidebar-inputs/temporal/orca-runtime-closed-tab-retention.test.ts": 5233, "src/main/runtime/sidebar-inputs/catalog/orca-runtime-project-catalog.test.ts": 4975, - "src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts": 3968, "src/main/runtime/sidebar-inputs/temporal/orca-runtime-sort-stamps.test.ts": 3799, "src/main/runtime/sidebar-inputs/temporal/orca-runtime-terminal-use.test.ts": 4460, "src/main/runtime/sidebar-inputs/workspace-facts/orca-runtime-workspace-activity-facts.test.ts": 3633, @@ -2880,7 +2868,6 @@ "src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts": 7702, "src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts": 39042, "src/main/runtime/rpc/server/pairing/unreadable-secret-store-preservation.win32.test.ts": 51, - "src/main/runtime/session-tabs/windowless-main-layout-commands-layout-owner.test.ts": 4237, "src/main/runtime/terminal/input/windows-codex-held-prompt-resubmit.test.ts": 4446, "src/main/runtime/orchestration/workers/archives/worker-terminal-archive-release.test.ts": 6267, "src/main/runtime/orchestration/workers/archives/worker-terminal-archive-screen.test.ts": 5616, @@ -3013,7 +3000,6 @@ "src/main/ssh/protocol/ssh-channel-multiplexer-settlement.test.ts": 56, "src/main/ssh/protocol/ssh-channel-multiplexer.test.ts": 120, "src/main/ssh/connection/reconnect/ssh-connect-attempt-cancellation.test.ts": 45, - "src/main/ssh/remote-exec/ssh-exec-command-decoder-fallback.test.ts": 290, "src/main/ssh/remote-exec/ssh-exec-rc-stdout-noise.test.ts": 262, "src/main/ssh/file-transfer/ssh-exec-stdin-file-transfer.test.ts": 324, "src/main/ssh/host-keys/ssh-host-key-store.test.ts": 238, @@ -3084,7 +3070,6 @@ "src/main/stats/agent-session-transition-recorder.test.ts": 722, "src/main/stats/collector-async-save.test.ts": 497, "src/main/power/system-resume-broadcast.test.ts": 67, - "src/main/telemetry/client-agent-dashboard-snapshot.test.ts": 201, "src/main/telemetry/client-deferred-start.test.ts": 8659, "src/main/telemetry/client-lifecycle.test.ts": 206, "src/main/telemetry/consent.test.ts": 48, @@ -3321,7 +3306,6 @@ "src/renderer/src/components/automations/automation-host-invalidation-window-events.test.ts": 83, "src/renderer/src/components/automations/automation-host-invalidation.test.ts": 85, "src/renderer/src/components/automations/automation-host-scale-gates.test.ts": 638, - "src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts": 439, "src/renderer/src/components/automations/automation-list-view.test.ts": 257, "src/renderer/src/components/automations/automation-run-output-snapshot-equivalence.test.ts": 158, "src/renderer/src/components/automations/automation-run-output-snapshot.test.ts": 96, @@ -3354,7 +3338,6 @@ "src/renderer/src/components/browser-pane/host-guest/use-browser-page-keyboard-shortcuts.split.test.tsx": 2098, "src/renderer/src/components/browser-pane/host-guest/use-browser-page-webview-partition.test.ts": 1985, "src/renderer/src/components/browser-pane/navigate/chromium-error-page-poll-visibility.test.ts": 1956, - "src/renderer/src/components/browser-pane/restored-client-hosted-recovery-window.test.tsx": 6205, "src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-input-model.test.ts": 45, "src/renderer/src/components/browser-pane/stream-remote/remote-browser-page-pane.address-bar.test.tsx": 2987, "src/renderer/src/components/browser-pane/stream-remote/remote-browser-service-failure.test.ts": 465, @@ -3613,7 +3596,6 @@ "src/renderer/src/components/native-chat/session/structured/delivery/structured-agent-session-message-sender.test.ts": 687, "src/renderer/src/components/native-chat/viewport/rail/structured-agent-session-rail-outline.test.ts": 48, "src/renderer/src/components/native-chat/session/structured/read/structured-agent-session-read-transport.test.ts": 243, - "src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts": 294, "src/renderer/src/components/native-chat/session/attention/structured-attention-dispatch.test.ts": 1974, "src/renderer/src/components/native-chat/session/status/structured-chat-sleep-startup.test.tsx": 2285, "src/renderer/src/components/native-chat/attachments/chips/use-native-chat-composer-attachments.test.tsx": 2467, @@ -3651,7 +3633,6 @@ "src/renderer/src/components/pull-request-page/page/use-details.test.tsx": 745, "src/renderer/src/components/quick-open-file-list-host-name-filter.react.test.tsx": 1941, "src/renderer/src/components/quick-open-file-list.test.ts": 54, - "src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionHistoryDialog.test.tsx": 2796, "src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionVirtualList.measurement.test.tsx": 3117, "src/renderer/src/components/right-sidebar/FolderWorkspaceWorktreesPanel.test.tsx": 461, "src/renderer/src/components/right-sidebar/plugin-panels/PluginPanel.test.tsx": 2710, @@ -3669,7 +3650,6 @@ "src/renderer/src/components/right-sidebar/file-explorer/mutations/file-explorer-inline-input-ime-enter.test.tsx": 479, "src/renderer/src/components/right-sidebar/file-explorer/watching/file-explorer-linked-watch.test.ts": 1831, "src/renderer/src/components/right-sidebar/folder-workspace-attached-worktrees.test.ts": 70, - "src/renderer/src/components/right-sidebar/hosted-review/folder-checks/parent-pr-checks-rows.test.ts": 374, "src/renderer/src/components/plugins/frames/plugin-frame-host-declarative.test.ts": 439, "src/renderer/src/components/right-sidebar/checks-panel/comments/pr-comments-ai-launch-ack.test.ts": 118, "src/renderer/src/components/right-sidebar/checks-panel/comments/pr-comments-list-selection.test.tsx": 3290, @@ -3678,7 +3658,6 @@ "src/renderer/src/components/right-sidebar/source-control/commit/source-control-entry-failure-toast.test.ts": 486, "src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts": 900, "src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-operation-target.test.ts": 1735, - "src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-terminal-worktree.test.ts": 2116, "src/renderer/src/components/right-sidebar/source-control/sync/use-source-control-git-history.test.tsx": 1951, "src/renderer/src/components/right-sidebar/file-explorer/mutations/useFileDeletion.save-refusal.test.tsx": 840, "src/renderer/src/components/right-sidebar/file-explorer/mutations/useFileDeletion.trash-failure.test.tsx": 774, @@ -3765,7 +3744,6 @@ "src/renderer/src/components/status-bar/use-resource-memory-snapshot.test.tsx": 321, "src/renderer/src/components/status-bar/use-resource-pty-actions.test.tsx": 879, "src/renderer/src/components/tab-bar/CopyTabIdMenuItem.test.tsx": 428, - "src/renderer/src/components/tab-bar/TabBarCreateEntry.search.test.tsx": 3224, "src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.virtualization.test.tsx": 1644, "src/renderer/src/components/tab-bar/cli-chat-resume-close-terminal.test.ts": 598, "src/renderer/src/components/tab-bar/cli-chat-resume-run-close.test.ts": 3079, @@ -3815,7 +3793,6 @@ "src/renderer/src/components/terminal-pane/pty-connection/output-restore/direct-ssh-hidden-output-restore-unavailable-banner.test.ts": 1975, "src/renderer/src/components/terminal-pane/links/http/edge-wrapped-terminal-http-links.test.ts": 529, "src/renderer/src/components/terminal-pane/links/http/framed-overlay-terminal-http-links.test.ts": 508, - "src/shared/git-bash-console-capacity.test.ts": 56, "src/renderer/src/components/terminal-pane/pty-connection/output-restore/hidden-query-carry-osc-introducer-leak.repro.test.ts": 1154, "src/renderer/src/components/terminal-pane/emulation/issue-12112-agent-pane-startup-color-reply-leak.repro.test.ts": 564, "src/renderer/src/components/terminal-pane/input/keyboard-handlers-ime-composing-chord.test.tsx": 2223, @@ -3922,7 +3899,6 @@ "src/renderer/src/components/terminal-pane/links/gestures/terminal-link-pty-mouse-suppression.test.ts": 574, "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/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, "src/renderer/src/components/terminal-pane/parking/output-watchers/terminal-parked-tab-watchers.test.ts": 473, @@ -3972,7 +3948,6 @@ "src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx": 4445, "src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx": 4442, "src/renderer/src/components/worktree-jump/worktree-jump-palette-browser-navigation.test.tsx": 4470, - "src/renderer/src/components/wsl-move/wsl-move-scope-rows.test.ts": 156, "src/renderer/src/hooks/agent-hook-completion-grok-notifications.test.ts": 679, "src/renderer/src/hooks/agent-hook-completion-notifications.test.ts": 1131, "src/renderer/src/hooks/automation-dispatch-folder-loss.test.ts": 575, @@ -3999,7 +3974,6 @@ "src/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.ts": 2200, "src/renderer/src/hooks/ipc-events/quit-and-stop-all-sessions-ipc-bridge.test.ts": 398, "src/renderer/src/hooks/ipc-events/runtime-client-ipc-bridge-ownership.test.ts": 2068, - "src/renderer/src/hooks/ipc-events/runtime-reconnect-host-status.test.ts": 1782, "src/renderer/src/hooks/ipc-events/ssh-managed-server-converted-catalogs.test.ts": 2922, "src/renderer/src/hooks/ipc-events/ssh-managed-server-state-effects.test.ts": 839, "src/renderer/src/hooks/ipc-events/terminal-presentation-frame-drawn-tab.test.ts": 1896, @@ -4354,7 +4328,6 @@ "src/shared/agent-launch/choices/agent-launch-settings-permissions.test.ts": 199, "src/shared/agent-status/process/agent-process-presence-platform.test.ts": 64, "src/shared/agent-launch/startup/agent-prompt-injection.test.ts": 88, - "src/shared/agent-scratch-worktrees.test.ts": 61, "src/shared/agent-session/agent-session-attachments.test.ts": 46, "src/shared/agent-session/agent-session-context-clear.test.ts": 222, "src/shared/agent-session/agent-session-conversation-name.test.ts": 71, @@ -4431,7 +4404,6 @@ "src/shared/browser/extensions/browser-extension-url.test.ts": 278, "src/shared/browser-load-failure.test.ts": 238, "src/shared/browser/network/tunnels/browser-network-tunnel-stream-framing.test.ts": 1645, - "src/shared/bundled-web-client-manifest.test.ts": 66, "src/shared/source-control/checks/logs/check-job-log-retention.test.ts": 451, "src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts": 132, "src/shared/claimed-agent-pty-owner.test.ts": 72, @@ -4467,7 +4439,6 @@ "src/shared/execution-host-registry-shared-control-connect.test.ts": 160, "src/shared/execution-host-registry.test.ts": 169, "src/shared/execution-host.test.ts": 56, - "src/shared/external-worktree-inbox.test.ts": 69, "src/shared/feature-education-telemetry.test.ts": 36, "src/shared/feature-tips.test.ts": 54, "src/shared/file-inventory-budget.test.ts": 44, @@ -4594,8 +4565,6 @@ "src/shared/agent-launch/startup/omp-draft-launch-windows.test.ts": 270, "src/shared/agent-launch/startup/omp-fresh-launch-cmd.win32.test.ts": 286, "src/shared/agent-launch/startup/omp-fresh-launch-shell.test.ts": 301, - "src/shared/opencode-generation-command.test.ts": 138, - "src/shared/opencode-generation-output.test.ts": 103, "src/shared/agent-status/process/opencode-headless-command.test.ts": 68, "src/shared/opencode-plugin-atomic-write.test.ts": 70, "src/shared/opencode-plugin-permissions.test.ts": 121, @@ -4615,7 +4584,6 @@ "src/shared/orchestration-compatibility-evidence.test.ts": 41, "src/shared/orchestration-fleet-projection.test.ts": 106, "src/shared/orchestration-task-summary.test.ts": 40, - "src/shared/osc52-clipboard-settings.test.ts": 49, "src/shared/own-retained-string.test.ts": 236, "src/shared/remote-runtime/e2ee/paired-e2ee-client-handshake.test.ts": 139, "src/shared/remote-runtime/e2ee/paired-e2ee-device-key-auth.test.ts": 119, @@ -4652,11 +4620,9 @@ "src/shared/plugins/manifest/plugin-display-text.test.ts": 285, "src/shared/plugins/manifest/plugin-manifest-v2-rules.test.ts": 239, "src/shared/plugins/workers/plugin-hook-chain.test.ts": 182, - "src/shared/powershell-native-argument.test.ts": 34, "src/shared/powershell-native-argument.windows.test.ts": 67, "src/shared/source-control/checks/pr-checks-fix-prompt.test.ts": 93, "src/shared/process-growth-breaker.test.ts": 47, - "src/shared/profile-state-build-compatibility.test.ts": 47, "src/shared/program-status/osc-scanner.test.ts": 57, "src/shared/program-status/protocol.test.ts": 58, "src/shared/program-status/query-responder.test.ts": 55, @@ -4679,7 +4645,6 @@ "src/shared/raster-image-dimensions.test.ts": 50, "src/shared/raster-image-preview-limits.test.ts": 44, "src/shared/relay-version-marker.test.ts": 52, - "src/shared/release-channel.test.ts": 63, "src/shared/remote-execution-host-pty-id.test.ts": 49, "src/shared/remote-file-preview-address.test.ts": 51, "src/shared/remote-foreground-evidence.test.ts": 53, @@ -4708,7 +4673,6 @@ "src/shared/remote-runtime/requests/remote-runtime-subscription-frame-router.test.ts": 143, "src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts": 646, "src/shared/renderer-restart-preparation.test.ts": 197, - "src/shared/repo-host-identity.test.ts": 45, "src/shared/repo-icon.test.ts": 82, "src/shared/repo-pack-index-scheduling.test.ts": 67, "src/shared/repo-ref-maintenance.test.ts": 497, @@ -4758,8 +4722,6 @@ "src/shared/sidebar-list/sidebar-feed-rows.test.ts": 377, "src/shared/sidebar-list/sidebar-inputs-feed-installer.test.ts": 100, "src/shared/sidebar-list/smart-sort.test.ts": 131, - "src/shared/skill-package-manifest.test.ts": 188, - "src/shared/skill-path-containment.test.ts": 49, "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-scan/source-tree-scan.test.ts": 50, @@ -4767,7 +4729,6 @@ "src/shared/ssh-pty-id.test.ts": 51, "src/shared/ssh-retained-payload-admission.test.ts": 69, "src/shared/startup-command-staging.node-pty.test.ts": 2207, - "src/shared/startup-command-staging.test.ts": 302, "src/shared/structured-session-message-contracts.test.ts": 411, "src/shared/task-query.test.ts": 55, "src/shared/program-status/terminal-agent-status-processor.test.ts": 74, @@ -4821,7 +4782,6 @@ "src/shared/windows-interactive-login-spawn.test.ts": 54, "src/shared/windows-private-credential-file.test.ts": 77, "src/shared/windows-secure-dacl.test.ts": 65, - "src/shared/windows-security-addon.test.ts": 51, "src/shared/windows-security-addon.win32.test.ts": 73, "src/shared/windows-transient-lock-removal.test.ts": 198, "src/shared/worker-auto-close.test.ts": 60, @@ -4881,7 +4841,6 @@ "src/shared/ws-outbound-backpressure-queue.test.ts": 67, "src/shared/remote-runtime/host-store/wsl-host-deployment-store.test.ts": 371, "src/shared/wsl-login-shell-command.test.ts": 87, - "src/shared/zod-salvage-absence.test.ts": 96, "src/wsl-guest/agent-hooks/status/agent-hook-canonical-status.test.ts": 2770, "src/wsl-guest/agent-hooks/publication/agent-hook-envelope-publication.test.ts": 348, "src/wsl-guest/agent-hooks/publication/agent-hook-integration.test.ts": 1827, @@ -4996,7 +4955,6 @@ "src/main/skills/bundled-skill-install/bundled-skill-local-host.test.ts": 103, "src/main/skills/bundled-skill-install/bundled-skill-plan-selection.test.ts": 392, "src/main/skills/bundled-skill-install/bundled-skill-plan.test.ts": 297, - "src/main/skills/bundled-skill-install/bundled-skill-workspace-targets.test.ts": 248, "src/main/skills/discovery/skill-native-discovery.test.ts": 254, "src/main/skills/bundle-archive/skill-bundle-creation.test.ts": 542, "src/main/skills/install/skill-bundle-installation.test.ts": 447, diff --git a/config/scripts/static-analysis/ratchets/renderer-state/check-agent-status-map-ratchet.test.mjs b/config/scripts/static-analysis/ratchets/renderer-state/check-agent-status-map-ratchet.test.mjs deleted file mode 100644 index ffdba7abc12..00000000000 --- a/config/scripts/static-analysis/ratchets/renderer-state/check-agent-status-map-ratchet.test.mjs +++ /dev/null @@ -1,68 +0,0 @@ -import fs from 'node:fs' -import os from 'node:os' -import path from 'node:path' -import { execFileSync } from 'node:child_process' -import { describe, expect, it } from 'vitest' -import { collect, violations } from './check-agent-status-map-ratchet.mjs' - -describe('accepted agent status Map contract', () => { - it('rejects Record operations through aliases and destructuring', () => { - const failures = violations( - 'reader.ts', - ` - const { agentStatusByPaneKey: owner } = state - const rows = owner - Object.keys(rows) - Object.values(rows) - Object.entries(rows) - JSON.stringify(rows) - const copy = { ...rows } - rows[key] - key in rows - for (const key in rows) consume(key) - ` - ) - expect(failures.length).toBe(8) - }) - it('rejects Map aliases in parameters, bindings and a contextually typed returned factory', () => { - const text = ` - type Rows = ReadonlyMap - type Alias = Rows - function direct(rows: Alias) { return Object.values(rows) } - function factory(): (rows: Alias) => unknown { - return (rows) => Object.entries(rows) - } - const annotated: Alias = input - annotated[key] - function record(rows: Record) { return Object.entries(rows) } - ` - expect(violations('reader.ts', text).map((failure) => failure.split(' ')[1])).toEqual([ - 'Object.values', - 'Object.entries', - 'bracket' - ]) - const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pr41793-map-guard-')) - try { - execFileSync('git', ['init', '-q', root]) - fs.mkdirSync(path.join(root, 'src/renderer/src'), { recursive: true }) - fs.writeFileSync(path.join(root, 'src/renderer/src/reader.ts'), text) - expect(collect(root)).toHaveLength(3) - } finally { - fs.rmSync(root, { recursive: true, force: true }) - } - }) - it('allows keyed reads, explicit full-output iteration and independent Record bindings', () => { - expect( - violations( - 'reader.ts', - ` - const rows = state.agentStatusByPaneKey - rows.get(key) - rows.has(key) - const output = [...rows.values()] - function fixture() { const rows = {}; rows[key] = entry; return Object.entries(rows) } - ` - ) - ).toEqual([]) - }) -}) diff --git a/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SyntheticMouseClickDeliveryTests.swift b/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SyntheticMouseClickDeliveryTests.swift deleted file mode 100644 index eb4f21a4a94..00000000000 --- a/native/computer-use-macos/Tests/OrcaComputerUseMacOSTests/SyntheticMouseClickDeliveryTests.swift +++ /dev/null @@ -1,40 +0,0 @@ -import XCTest -@testable import OrcaComputerUseMacOSCore - -final class SyntheticMouseClickDeliveryTests: XCTestCase { - private let target = SyntheticMouseClickDelivery.Recipient(ownerPID: 41, windowID: 101) - private let beneath = SyntheticMouseClickDelivery.Recipient(ownerPID: 52, windowID: 202) - - private func clickUnfocusedTarget(afterUp: SyntheticMouseClickDelivery.RecipientObservation, targetOnScreenAfterUp: Bool) throws -> [SyntheticMouseClickDelivery.Step] { - var observations = [(SyntheticMouseClickDelivery.RecipientObservation.focused(target), true), (afterUp, targetOnScreenAfterUp)] - var posted: [SyntheticMouseClickDelivery.Step] = [] - try SyntheticMouseClickDelivery.deliver( - clickCount: 1, - target: target, - currentObservation: { - let (hit, onScreen) = observations.removeFirst() - return SyntheticMouseClickDelivery.topmostObservation(hit: hit, target: target, targetOnScreen: onScreen) - }, - makeEvent: { $0 }, - post: { posted.append($0) }, - pause: { _ in } - ) - return posted - } - - func testAClickThatClosesAnUnfocusedTargetSucceeds() throws { - XCTAssertEqual( - try clickUnfocusedTarget(afterUp: .focused(beneath), targetOnScreenAfterUp: false), - [.move, .buttonDown(pressIndex: 1), .buttonUp(pressIndex: 1)] - ) - } - - func testAnotherWindowOverAnUnfocusedTargetStillFailsTheFence() { - XCTAssertThrowsError(try clickUnfocusedTarget(afterUp: .focused(beneath), targetOnScreenAfterUp: true)) { error in - XCTAssertEqual( - error as? SyntheticMouseClickDelivery.FenceFailure, - .recipientChanged(expected: target, actual: beneath, deliveredPresses: 1) - ) - } - } -} diff --git a/package.json b/package.json index 6e912344364..983b0a0e1e5 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "test:changed": "node config/scripts/workspace-package-build/build-workspace-packages.mjs && node config/scripts/native-build/node-addons/ensure-native-runtime.mjs --runtime=node && node config/scripts/test-runtime/execution-policy/run-vitest.mjs run --config config/vitest.config.ts --changed=HEAD", "test:node": "pnpm run build:packages && node config/scripts/native-build/node-addons/ensure-native-runtime.mjs --runtime=node && vitest run --config config/vitest.config.ts", "test:node-server": "node config/scripts/ci/unit-selection/run-node-server-tests.mjs", - "test:skill-sharing:release": "vitest run --config config/vitest.config.ts src/main/skills src/shared/skills/packages/skill-package-manifest.test.ts", + "test:skill-sharing:release": "vitest run --config config/vitest.config.ts src/main/skills", "test:repro:remote-agent-session": "pnpm run build:cli && pnpm run build:electron-vite && node config/scripts/diagnostics/remote-agent-authority/remote-agent-session-authority-repro.mjs", "capture:agent-transcript": "node config/scripts/native-build/node-addons/ensure-native-runtime.mjs --runtime=node && node config/scripts/diagnostics/terminal-transcripts/capture-agent-pty-transcript.mjs", "check:reliability-gates": "node config/scripts/static-analysis/reliability-policy/check-reliability-gates.mjs", diff --git a/src/main/amp/hook-service.test.ts b/src/main/amp/hook-service.test.ts deleted file mode 100644 index 3949890224e..00000000000 --- a/src/main/amp/hook-service.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { dirname, join } from 'node:path' - -const { homedirMock } = vi.hoisted(() => ({ - homedirMock: vi.fn<() => string>() -})) - -vi.mock('os', async () => { - const actual = (await vi.importActual('os')) as Record - return { - ...actual, - homedir: homedirMock - } -}) - -import { AmpHookService, _internals } from './hook-service' - -describe('AmpHookService', () => { - let homeDir: string - - beforeEach(() => { - homeDir = mkdtempSync(join(tmpdir(), 'orca-amp-home-')) - homedirMock.mockReturnValue(homeDir) - }) - - afterEach(() => { - vi.clearAllMocks() - rmSync(homeDir, { recursive: true, force: true }) - }) - - it('does not overwrite an existing user-authored Amp plugin file', () => { - const pluginPath = _internals.getPluginPath() - mkdirSync(dirname(pluginPath), { recursive: true }) - writeFileSync(pluginPath, 'export default function userPlugin() {}\n', 'utf-8') - - const status = new AmpHookService().install() - - expect(status).toMatchObject({ - agent: 'amp', - state: 'partial', - managedHooksPresent: false - }) - expect(readFileSync(pluginPath, 'utf-8')).toBe('export default function userPlugin() {}\n') - }) - - it('removes only Orca-managed Amp plugin files', () => { - const service = new AmpHookService() - const installed = service.install() - expect(existsSync(installed.configPath)).toBe(true) - - const removed = service.remove() - - expect(removed.state).toBe('not_installed') - expect(existsSync(installed.configPath)).toBe(false) - - const pluginPath = _internals.getPluginPath() - mkdirSync(dirname(pluginPath), { recursive: true }) - writeFileSync(pluginPath, 'export default function userPlugin() {}\n', 'utf-8') - - const skipped = service.remove() - - expect(skipped.state).toBe('partial') - expect(existsSync(pluginPath)).toBe(true) - }) -}) diff --git a/src/main/antigravity/native-account-usage-read.test.ts b/src/main/antigravity/native-account-usage-read.test.ts deleted file mode 100644 index 32de0141148..00000000000 --- a/src/main/antigravity/native-account-usage-read.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { expect, it } from 'vitest' -import type { ProviderRateLimits } from '../../shared/agent-usage/rate-limits/rate-limit-types' -import { credential, harness, refreshedWithoutIdToken } from './native-account-test-fixtures' - -function reading(usedPercent: number, updatedAt: number): ProviderRateLimits { - return { - provider: 'antigravity', - session: null, - weekly: { usedPercent, windowMinutes: 10080, resetsAt: null, resetDescription: null }, - updatedAt, - error: null, - status: 'ok' - } -} - -it('keeps each saved account’s last reading with its read time after agy switches', async () => { - const h = harness() - const a = (await h.service.addCurrentAccount()).activeAccountId! - h.setNative(credential('b', 2)) - const b = (await h.service.addCurrentAccount()).activeAccountId! - await h.service.selectAccount(a) - - const start = await h.service.beginUsageRead() - expect(start?.accounts.map((entry) => [entry.accountId, entry.rateLimits])).toEqual([ - [a, null], - [b, null] - ]) - // agy refreshes its token mid-read, dropping the id_token; the login is unchanged. - h.setNative(refreshedWithoutIdToken(2)) - const finish = await h.service.finishUsageRead(start!.login!, reading(40, 1_000)) - expect(finish).toMatchObject({ switched: false, account: { id: a } }) - - await h.service.selectAccount(b) - const state = await h.service.listAccounts() - expect(state.accounts.map((account) => [account.id, account.usage?.updatedAt ?? null])).toEqual([ - [a, 1_000], - [b, null] - ]) -}) - -it('drops a reading when agy switched accounts during the read', async () => { - const h = harness() - const a = (await h.service.addCurrentAccount()).activeAccountId! - h.setNative(credential('b', 2)) - await h.service.addCurrentAccount() - await h.service.selectAccount(a) - - const start = await h.service.beginUsageRead() - h.setNative(credential('b', 2)) - expect(await h.service.finishUsageRead(start!.login!, reading(40, 1_000))).toEqual({ - switched: true - }) - expect(h.getVault().accounts.every((account) => !account.usage)).toBe(true) -}) diff --git a/src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts deleted file mode 100644 index cdd9aabd086..00000000000 --- a/src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { sshExecutionHostStorageIdentity } from '../identity/browser-execution-host-storage-identity' -import { - deriveBrowserRoutePartition, - deriveBrowserRoutePartitionStorageScope, - deriveLocalSshBrowserRoutePartitionStorageScope -} from '../partitions/browser-route-identity' -import { localSshBrowserAuthorityConnectionIdentity } from './local-ssh-browser-partitions' - -function derive(orcaProfileId: string, browserProfileId: string, targetId: string) { - return deriveBrowserRoutePartition({ - orcaProfileId, - browserProfileId, - authorityConnectionIdentity: localSshBrowserAuthorityConnectionIdentity(orcaProfileId), - executionHostIdentity: sshExecutionHostStorageIdentity(targetId) - }) -} - -describe('local ssh browser partition identity', () => { - it('pins the golden partition so no per-boot value can sneak into the name', () => { - // Changing this cookie-storage identity requires a migration. - expect(derive('local-default', 'default', 'ssh-target-1').partition).toBe( - 'persist:orca-browser-v1-5bd50510715cb753c62637e02be1e3e480ce8a5b1d8fc5d8b71205a2ff6181a4' - ) - }) - - it('derives one stable partition per (profile, target) and separates each axis', () => { - const base = derive('local-default', 'default', 'ssh-target-1') - expect(derive('local-default', 'default', 'ssh-target-1')).toEqual(base) - expect(derive('local-default', 'default', 'ssh-target-2').partition).not.toBe(base.partition) - expect(derive('local-default', 'session-a', 'ssh-target-1').partition).not.toBe(base.partition) - expect(derive('profile-b', 'default', 'ssh-target-1').partition).not.toBe(base.partition) - }) - - it('separates the local-ssh storage scope domain from environment scopes', () => { - expect( - deriveLocalSshBrowserRoutePartitionStorageScope({ - orcaProfileId: 'local-default', - targetId: 'same-id' - }) - ).not.toBe( - deriveBrowserRoutePartitionStorageScope({ - orcaProfileId: 'local-default', - environmentId: 'same-id' - }) - ) - }) -}) diff --git a/src/main/codex/history/bridges/codex-account-session-bridge-hardlink-only.test.ts b/src/main/codex/history/bridges/codex-account-session-bridge-hardlink-only.test.ts deleted file mode 100644 index e8a3a615fca..00000000000 --- a/src/main/codex/history/bridges/codex-account-session-bridge-hardlink-only.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs' -import type * as NodeFsPromises from 'node:fs/promises' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, beforeEach, expect, it, vi } from 'vitest' - -const crossVolume = vi.hoisted(() => { - const state: { on: boolean; beforeLink?: (targetPath: string) => void } = { on: false } - return state -}) - -vi.mock('node:fs/promises', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - link: async (...args: Parameters) => { - crossVolume.beforeLink?.(String(args[1])) - if (crossVolume.on) { - throw Object.assign(new Error('cross-device link not permitted'), { code: 'EXDEV' }) - } - return actual.link(...args) - } - } -}) - -import { bridgeCodexSessionsIntoAccountHome } from './codex-account-session-bridge' - -const ROLLOUT = join( - '2026', - '10', - '28', - 'rollout-2026-10-28T10-00-00-019a0000-0000-7000-8000-00000000000a.jsonl' -) -let root = '' - -beforeEach(() => { - root = mkdtempSync(join(tmpdir(), 'orca-hardlink-only-')) - mkdirSync(join(root, 'account', 'sessions', '2026', '10', '28'), { recursive: true }) - writeFileSync(join(root, 'account', 'sessions', ROLLOUT), '{"type":"session_meta"}\n') - mkdirSync(join(root, 'codex')) - crossVolume.on = true -}) - -afterEach(() => { - crossVolume.on = false - crossVolume.beforeLink = undefined - rmSync(root, { recursive: true, force: true }) -}) - -it('does not count a dangling link another writer made after the listing as bridged', async () => { - crossVolume.on = false - crossVolume.beforeLink = (targetPath) => symlinkSync(join(root, 'missing.jsonl'), targetPath) - - const summary = await bridgeCodexSessionsIntoAccountHome({ - targetCodexHomePath: join(root, 'codex'), - sourceCodexHomePaths: [join(root, 'account')] - }) - - expect(summary).toMatchObject({ scannedFiles: 1, linkedFiles: 0 }) - expect(summary.bridgedThreads.size).toBe(0) -}) diff --git a/src/main/crash-reporting/breadcrumbs/crash-breadcrumb-renderer-attribution.test.ts b/src/main/crash-reporting/breadcrumbs/crash-breadcrumb-renderer-attribution.test.ts deleted file mode 100644 index 52b2aefe996..00000000000 --- a/src/main/crash-reporting/breadcrumbs/crash-breadcrumb-renderer-attribution.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { beforeEach, describe, expect, it } from 'vitest' - -import { - clearCrashBreadcrumbsForTest, - getCrashBreadcrumbSnapshot, - recordCoalescedCrashBreadcrumb, - recordCrashBreadcrumb -} from './crash-breadcrumb-store' - -describe('renderer crash breadcrumb attribution', () => { - beforeEach(() => { - clearCrashBreadcrumbsForTest() - }) - - it('folds pending repeats using the reporter-specific evidence window', () => { - recordCoalescedCrashBreadcrumb({ - name: 'renderer_error', - data: { message: 'boom' }, - coalesceKey: 'renderer:11\u0000renderer_error:boom', - minIntervalMs: 30_000, - origin: 'renderer:11' - }) - recordCoalescedCrashBreadcrumb({ - name: 'renderer_error', - data: { message: 'boom' }, - coalesceKey: 'renderer:22\u0000renderer_error:boom', - minIntervalMs: 30_000, - origin: 'renderer:22' - }) - recordCoalescedCrashBreadcrumb({ - name: 'renderer_error', - data: { message: 'boom' }, - coalesceKey: 'renderer:22\u0000renderer_error:boom', - minIntervalMs: 30_000, - origin: 'renderer:22' - }) - recordCoalescedCrashBreadcrumb({ - name: 'renderer_error', - data: { message: 'boom' }, - coalesceKey: 'renderer:11\u0000renderer_error:boom', - minIntervalMs: 30_000, - origin: 'renderer:11' - }) - for (let index = 0; index < 4; index += 1) { - recordCrashBreadcrumb( - 'renderer_memory_highwater', - { rendererSurface: `surface-${index}`, thresholdPct: 80 }, - 'renderer:22' - ) - } - for (let index = 0; index < 25; index += 1) { - recordCrashBreadcrumb(`renderer_b_event_${index}`, undefined, 'renderer:22') - } - - const snapshot = getCrashBreadcrumbSnapshot('renderer:11') - - expect(snapshot).toHaveLength(1) - expect(snapshot[0]?.data).toEqual({ message: 'boom', suppressedSinceLast: 1 }) - - const siblingSnapshot = getCrashBreadcrumbSnapshot('renderer:22') - expect(siblingSnapshot.find((entry) => entry.name === 'renderer_error')?.data).toEqual({ - message: 'boom', - suppressedSinceLast: 1 - }) - }) -}) diff --git a/src/main/daemon/executable-host/linux/testing/daemon-appimage-launch.test.ts b/src/main/daemon/executable-host/linux/testing/daemon-appimage-launch.test.ts deleted file mode 100644 index b3916f1b89a..00000000000 --- a/src/main/daemon/executable-host/linux/testing/daemon-appimage-launch.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, describe, expect, it } from 'vitest' -import { runProcessSync } from '@orca/process-host' -import { buildAppImageDaemonCommand } from '../daemon-appimage-launch' - -describe('buildAppImageDaemonCommand', () => { - const launch = { - appImagePath: '/apps/Orca.AppImage', - entryPathInAppDir: 'resources/entry.js', - appPathInAppDir: 'resources/app.asar', - appVersion: '1.4.215' - } - let root: string | undefined - - afterEach(() => { - if (root) { - rmSync(root, { recursive: true, force: true }) - root = undefined - } - }) - - function runBootstrap(packagedVersion: string): { - result: ReturnType - appDir: string - } { - const appDir = mkdtempSync(join(tmpdir(), 'orca-appimage-boot-')) - root = appDir - mkdirSync(join(appDir, 'resources', 'app.asar'), { recursive: true }) - writeFileSync( - join(appDir, 'resources', 'app.asar', 'package.json'), - JSON.stringify({ version: packagedVersion }) - ) - writeFileSync( - join(appDir, 'resources', 'entry.js'), - 'console.log(JSON.stringify(process.argv.slice(1)))' - ) - const { args } = buildAppImageDaemonCommand(launch, ['--socket', '/s'], {}) - const result = runProcessSync({ - program: process.execPath, - args, - env: { ...process.env, APPDIR: appDir, ELECTRON_RUN_AS_NODE: '1' } - }) - return { result, appDir } - } - - it('runs the entry from the child APPDIR with the daemon argv', () => { - const { result, appDir } = runBootstrap('1.4.215') - expect(result.code).toBe(0) - expect(JSON.parse(result.stdout)).toEqual([ - join(appDir, 'resources', 'entry.js'), - '--socket', - '/s', - '--no-sandbox' - ]) - }) - - it('refuses an AppImage replaced by a different release', () => { - const { result } = runBootstrap('1.5.0') - expect(result.code).toBe(1) - expect(result.stderr).toContain('AppImage is 1.5.0, expected 1.4.215') - }) -}) diff --git a/src/main/daemon/history/seed-transfer/testing/terminal-history-seed-transfer-registry.test.ts b/src/main/daemon/history/seed-transfer/testing/terminal-history-seed-transfer-registry.test.ts deleted file mode 100644 index 40bda3aa30a..00000000000 --- a/src/main/daemon/history/seed-transfer/testing/terminal-history-seed-transfer-registry.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - iterateTerminalHistorySeedChunks, - measureTerminalHistorySeed -} from '../terminal-history-seed-chunks' -import { TerminalHistorySeedTransferRegistry } from '../terminal-history-seed-transfer-registry' - -describe('TerminalHistorySeedTransferRegistry', () => { - it('validates and consumes an owner-bound completed transfer', () => { - const registry = new TerminalHistorySeedTransferRegistry() - const segments = ['first', '😀', 'last'] - const manifest = measureTerminalHistorySeed(segments) - const transferId = registry.start('owner-a', manifest) - const chunks = [...iterateTerminalHistorySeedChunks(segments)] - chunks.forEach((data, index) => registry.append('owner-a', transferId, index, data)) - registry.finish('owner-a', transferId) - - expect(() => registry.take('owner-b', transferId)).toThrow('not found') - expect(registry.take('owner-a', transferId).join('')).toBe(segments.join('')) - expect(() => registry.take('owner-a', transferId)).toThrow('not found') - }) - - it('rejects out-of-order and over-budget chunks', () => { - const segments = ['😀', 'a'] - const manifest = measureTerminalHistorySeed(segments) - const registry = new TerminalHistorySeedTransferRegistry(4) - const transferId = registry.start('owner', manifest) - - expect(() => registry.append('owner', transferId, 1, 'a')).toThrow('sequence mismatch') - registry.append('owner', transferId, 0, '😀') - expect(() => registry.append('owner', transferId, 1, 'a')).toThrow('retained byte limit') - }) - - it('rejects a digest mismatch and releases the transfer', () => { - const registry = new TerminalHistorySeedTransferRegistry() - const transferId = registry.start('owner', { - chunkCount: 1, - codeUnits: 4, - sha256: '0'.repeat(64) - }) - registry.append('owner', transferId, 0, 'test') - - expect(() => registry.finish('owner', transferId)).toThrow('digest mismatch') - expect(() => registry.take('owner', transferId)).toThrow('not found') - }) -}) diff --git a/src/main/daemon/launch/testing/daemon-exit-record.test.ts b/src/main/daemon/launch/testing/daemon-exit-record.test.ts deleted file mode 100644 index fe7b4f78b49..00000000000 --- a/src/main/daemon/launch/testing/daemon-exit-record.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { EventEmitter } from 'node:events' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { - daemonDiedRespawnMessage, - takeLastDaemonExit, - watchLaunchedDaemonExit -} from '../daemon-exit-record' - -afterEach(() => { - takeLastDaemonExit() - vi.useRealTimers() - vi.restoreAllMocks() -}) - -describe('daemon exit record (#39166)', () => { - it('logs the exit signal and names it in the next respawn line', () => { - const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) - const child = new EventEmitter() - watchLaunchedDaemonExit(child, 4242) - - child.emit('exit', null, 'SIGABRT') - - expect(warn).toHaveBeenCalledWith('[daemon] Daemon process 4242 exited: signal SIGABRT') - expect(daemonDiedRespawnMessage()).toBe( - '[daemon] Daemon process died (pid 4242, signal SIGABRT) — respawning' - ) - // Consumed: a later death without an observed exit must not reuse it. - expect(daemonDiedRespawnMessage()).toBe( - '[daemon] Daemon process died (exit status not observed) — respawning' - ) - }) - - it('reports an exit code, and ignores an exit too old to explain this death', () => { - vi.spyOn(console, 'warn').mockImplementation(() => {}) - const child = new EventEmitter() - watchLaunchedDaemonExit(child, 7) - child.emit('exit', 134, null) - expect(daemonDiedRespawnMessage()).toContain('(pid 7, code 134)') - - vi.useFakeTimers({ now: 1_000_000 }) - const stale = new EventEmitter() - watchLaunchedDaemonExit(stale, 8) - stale.emit('exit', 0, null) - expect(daemonDiedRespawnMessage(1_000_000 + 120_000)).toContain('exit status not observed') - }) - - it('forgets a predecessor exit once a replacement daemon launches', () => { - vi.spyOn(console, 'warn').mockImplementation(() => {}) - const restarted = new EventEmitter() - watchLaunchedDaemonExit(restarted, 11) - restarted.emit('exit', null, 'SIGTERM') - - watchLaunchedDaemonExit(new EventEmitter(), 12) - - expect(daemonDiedRespawnMessage()).toContain('exit status not observed') - }) -}) diff --git a/src/main/daemon/launch/testing/daemon-generation-liveness.test.ts b/src/main/daemon/launch/testing/daemon-generation-liveness.test.ts deleted file mode 100644 index b94b4c56bac..00000000000 --- a/src/main/daemon/launch/testing/daemon-generation-liveness.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' -import { createServer, type Server } from 'node:net' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, describe, expect, it } from 'vitest' -import { listLiveDaemonProtocols } from '../daemon-generation-liveness' -import { getDaemonPidPath, getDaemonSocketPath, getDaemonTokenPath } from '../daemon-spawner' - -const servers: Server[] = [] -let runtimeDir = '' - -async function serveGeneration(protocolVersion: number): Promise { - const server = createServer() - servers.push(server) - await new Promise((resolve) => - server.listen(getDaemonSocketPath(runtimeDir, protocolVersion), resolve) - ) -} - -afterEach(async () => { - await Promise.all(servers.splice(0).map((s) => new Promise((resolve) => s.close(resolve)))) - rmSync(runtimeDir, { recursive: true, force: true }) -}) - -describe('live daemon generations', () => { - it('names every answering generation, including one newer than this build knows', async () => { - runtimeDir = mkdtempSync(join(tmpdir(), 'orca-generations-')) - await serveGeneration(50) - await serveGeneration(51) - await serveGeneration(99) - // A generation this build does not know is found by its token even while its pid record is absent. - writeFileSync(getDaemonTokenPath(runtimeDir, 99), 'token') - writeFileSync(getDaemonPidPath(runtimeDir, 49), JSON.stringify({ pid: 2 ** 22 + 1 })) - // An answering endpoint counts even when its pid record is unreadable. - writeFileSync(getDaemonPidPath(runtimeDir, 50), 'not a pid record') - - await expect(listLiveDaemonProtocols(runtimeDir, [49, 50, 51])).resolves.toEqual([50, 51, 99]) - }) - - it('cannot vouch for a runtime dir it cannot list', async () => { - runtimeDir = mkdtempSync(join(tmpdir(), 'orca-generations-')) - // A file where the dir belongs fails the listing without depending on permissions. - const notADir = join(runtimeDir, 'daemon') - writeFileSync(notADir, '') - - await expect(listLiveDaemonProtocols(notADir, [51])).resolves.toBeNull() - }) -}) diff --git a/src/main/ipc/telemetry-protected-milestone-admission.test.ts b/src/main/ipc/telemetry-protected-milestone-admission.test.ts deleted file mode 100644 index b592431459f..00000000000 --- a/src/main/ipc/telemetry-protected-milestone-admission.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import type { Store } from '../persistence/loading-store/store' - -const { handleMock, trackMock } = vi.hoisted(() => ({ - handleMock: vi.fn(), - trackMock: vi.fn(() => true) -})) - -vi.mock('electron', () => ({ - BrowserWindow: { fromWebContents: vi.fn() }, - ipcMain: { handle: handleMock } -})) -vi.mock('../telemetry/client', () => ({ - hasTrackedAgentDashboardActiveToday: vi.fn(() => false), - persistBannerAcknowledgeWithoutEmitting: vi.fn(), - setOptIn: vi.fn(), - track: trackMock -})) -vi.mock('../telemetry/cohort-classifier', () => ({ getCohortAtEmit: () => ({}) })) -vi.mock('../telemetry/onboarding-cohort-classifier', () => ({ - getOnboardingCohortAtEmit: () => ({}) -})) - -import { registerTelemetryHandlers } from './telemetry' - -describe('renderer telemetry admission', () => { - it('cannot forge protected milestones but still forwards their source events', () => { - const store: Partial = {} - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the track handler never reads the store. - registerTelemetryHandlers(store as Store) - const [, trackHandler] = handleMock.mock.calls.find( - ([channel]) => channel === 'telemetry:track' - )! - const sender = { sender: {} } - - expect( - trackHandler(sender, 'first_agent_interaction', { - source: 'orca_send', - agent_kind: 'codex', - install_cohort: 'fresh' - }) - ).toBe(false) - expect( - trackHandler(sender, 'meaningful_activity_day', { - trigger: 'orca_send', - install_cohort: 'fresh' - }) - ).toBe(false) - expect( - trackHandler(sender, 'native_chat_prompt_submitted', { - agent_kind: 'codex', - runtime: 'local', - client: 'desktop' - }) - ).toBe(false) - expect(trackMock).not.toHaveBeenCalled() - - const send = { agent_kind: 'codex', launch_source: 'sidebar', request_kind: 'followup' } - expect(trackHandler(sender, 'agent_prompt_sent', send)).toBe(true) - expect(trackMock).toHaveBeenCalledWith('agent_prompt_sent', send) - }) -}) diff --git a/src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts b/src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts deleted file mode 100644 index 372dc99247b..00000000000 --- a/src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Exercise real heartbeats and steal commands so long mutations retain activation ownership. -import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { runProcess } from '@orca/process-host' -import { RELAY_INSTALL_LOCK_NAME } from '../../../shared/remote-runtime/relay/relay-install-lock-name' -import { ORCAD_ACTIVATION_TRANSACTION_DIRNAME } from '../activation/orcad-activation-transaction' -import { serializedStateMutationCommand } from './orcad-state-snapshot' -import { ORCAD_FENCE_OWNER_FILENAME } from '../activation/orcad-activation-fence-scope' -const HEARTBEAT_SECONDS = 0.1 - -async function sh(command: string): Promise { - return (await runProcess({ program: '/bin/sh', args: ['-c', command] })).stdout.trim() -} - -describe.skipIf(process.platform === 'win32')( - 'the fence heartbeat of a running state mutation', - () => { - let base = '' - let fence = '' - - beforeEach(async () => { - base = mkdtempSync(join(tmpdir(), 'orcad-fence-beat-')) - fence = join(base, ORCAD_ACTIVATION_TRANSACTION_DIRNAME, RELAY_INSTALL_LOCK_NAME) - mkdirSync(fence, { recursive: true }) - writeFileSync(join(fence, ORCAD_FENCE_OWNER_FILENAME), 'holder-1') - }) - const mutation = (script: string): string => - serializedStateMutationCommand(base, script, HEARTBEAT_SECONDS, { - lockDir: fence, - token: 'holder-1' - }) - afterEach(() => { - rmSync(base, { recursive: true, force: true }) - }) - - it('never starts a mutation once its run no longer owns the fence', async () => { - writeFileSync(join(fence, ORCAD_FENCE_OWNER_FILENAME), 'successor') - const marker = join(base, 'mutated') - expect(await sh(mutation(`touch '${marker}'`))).toBe('__ORCAD_FENCE_LOST__') - expect(existsSync(marker)).toBe(false) - expect(existsSync(join(base, 'orcad-state-mutation.lock'))).toBe(false) - }, 20_000) - } -) diff --git a/src/main/plugins/catalog/plugin-update-review-notices.test.ts b/src/main/plugins/catalog/plugin-update-review-notices.test.ts deleted file mode 100644 index 6155563f9c3..00000000000 --- a/src/main/plugins/catalog/plugin-update-review-notices.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { mkdtemp, rm } from 'node:fs/promises' - -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import type { PluginUpdateHold } from '../../../shared/plugins/catalog/plugin-update-policy' -import { PluginUpdateReviewNotices } from './plugin-update-review-notices' - -const KEY = 'octo.demo' -let dir: string - -beforeEach(async () => { - dir = await mkdtemp(join(tmpdir(), 'plugin-review-notices-')) -}) -afterEach(async () => { - await rm(dir, { recursive: true, force: true }) -}) - -function notices( - held: Record, - options: { killListed?: string[]; names?: Record } = {} -) { - return new PluginUpdateReviewNotices({ - pluginsDataDir: dir, - getHeld: () => held, - findName: (key) => (options.names && key in options.names ? options.names[key] : 'Demo'), - isKillListed: (key) => options.killListed?.includes(key) ?? false - }) -} - -describe('PluginUpdateReviewNotices', () => { - it('stays quiet for a told version after a restart, and tells a newer one', async () => { - const held: Record = { [KEY]: { version: '2.0.0', reason: 'access' } } - await notices(held).take() - await expect(notices(held).take()).resolves.toEqual([]) - held[KEY] = { version: '2.1.0', reason: 'access' } - await expect(notices(held).take()).resolves.toMatchObject([ - { pluginKey: KEY, version: '2.1.0' } - ]) - }) - - it('never tells a kill-listed plugin, and keeps it untold in case it is lifted', async () => { - const held = { [KEY]: { version: '2.0.0', reason: 'access' as const } } - await expect(notices(held, { killListed: [KEY] }).take()).resolves.toEqual([]) - await expect(notices(held).take()).resolves.toHaveLength(1) - }) - - it('gives concurrent windows the notice only once', async () => { - const store = notices({ [KEY]: { version: '2.0.0', reason: 'access' } }) - const [first, second] = await Promise.all([store.take(), store.take()]) - expect(first.length + second.length).toBe(1) - }) -}) diff --git a/src/main/runtime/push/notifications/mobile-notification-replay.test.ts b/src/main/runtime/push/notifications/mobile-notification-replay.test.ts deleted file mode 100644 index 377a96d3f00..00000000000 --- a/src/main/runtime/push/notifications/mobile-notification-replay.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - MobileNotificationReplayBuffer, - type ReplayableMobileNotification -} from './mobile-notification-replay' -import type { MobileNotificationDispatchEvent } from './runtime-mobile-notification-controller' - -function dispatch( - buffer: MobileNotificationReplayBuffer, - partial: Partial = {} -): ReplayableMobileNotification { - const event: MobileNotificationDispatchEvent = { - type: 'notification', - source: 'agent-task-complete', - title: 'Done', - body: 'Finished.', - ...partial - } - buffer.record(event) - return buffer.getMissedSince(0).at(-1) as ReplayableMobileNotification -} - -describe('MobileNotificationReplayBuffer', () => { - it('returns the retained buffer when the watermark came from a previous desktop run', () => { - // #8591: persisted seq 57 against a restarted seq 2 suppresses catch-up unless epochs invalidate the watermark. - const previousRun = new MobileNotificationReplayBuffer() - for (let i = 0; i < 57; i++) { - dispatch(previousRun, { notificationId: `old:${i}` }) - } - const staleWatermark = 57 - const staleEpoch = previousRun.epoch - - const afterRestart = new MobileNotificationReplayBuffer() - dispatch(afterRestart, { notificationId: 'agent:one' }) - dispatch(afterRestart, { notificationId: 'agent:two' }) - - expect(afterRestart.getMissedSince(staleWatermark)).toEqual([]) - expect( - afterRestart.getMissedSince(staleWatermark, staleEpoch).map((e) => e.notificationId) - ).toEqual(['agent:one', 'agent:two']) - }) - - it('evicts oldest entries once the capacity is exceeded', () => { - const buffer = new MobileNotificationReplayBuffer(2) - dispatch(buffer, { notificationId: 'agent:one' }) - dispatch(buffer, { notificationId: 'agent:two' }) - dispatch(buffer, { notificationId: 'agent:three' }) - - const retained = buffer.getMissedSince(0).map((e) => e.notificationId) - expect(retained).toEqual(['agent:two', 'agent:three']) - expect(buffer.size).toBe(2) - }) -}) diff --git a/src/main/runtime/session-tabs/windowless-main-layout-commands-layout-owner.test.ts b/src/main/runtime/session-tabs/windowless-main-layout-commands-layout-owner.test.ts deleted file mode 100644 index cc678682423..00000000000 --- a/src/main/runtime/session-tabs/windowless-main-layout-commands-layout-owner.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Layout-owner build, no window: a CLI close, rename or pane title, and a phone's tab props or pane -// names, of a workspace main owns are each main's own layout command, published as one frame. -import { describe, expect, it, vi } from 'vitest' -import { - LEAF_A, - LEAF_B, - PTY_A, - TAB_ID, - WORKTREE_ID, - setupMainOwnedWorkspace -} from '../terminal/layout/main-owned-workspace-runtime-fixture' - -vi.mock('../../../shared/layout-owner-switch', () => ({ ORCA_LAYOUT_OWNER_IS_MAIN: true })) - -/** Runs one operation and counts the layout frames it published. */ -async function framesOf( - fixture: Awaited>, - operation: () => Promise -): Promise { - const before = fixture.frames() - await operation() - await Promise.resolve() - return fixture.frames() - before -} - -const tabRow = (fixture: Awaited>) => - fixture.session().tabsByWorktree[WORKTREE_ID]?.find((tab) => tab.id === TAB_ID) - -describe('CLI terminal commands on a workspace main owns, with no window', () => { - it('closes the tab in one frame', async () => { - const fixture = await setupMainOwnedWorkspace() - const handle = fixture.handleOf(PTY_A) - - expect(await framesOf(fixture, () => fixture.runtime.closeTerminalTab(handle))).toBe(1) - - expect(tabRow(fixture)).toBeUndefined() - expect(fixture.stopped).toEqual([PTY_A]) - }) -}) - -describe("a phone's tab props and pane names on a workspace main owns, with no window", () => { - it('names only the panes the phone says it renamed', async () => { - const fixture = await setupMainOwnedWorkspace({ split: true }) - const root = fixture.session().terminalLayoutsByTabId[TAB_ID]!.root - - await fixture.runtime.updateMobileSessionPaneLayout(`id:${WORKTREE_ID}`, { - tabId: TAB_ID, - root, - expandedLeafId: null, - titlesByLeafId: { [LEAF_A]: 'Stale', [LEAF_B]: 'Server' }, - renamedLeafIds: [LEAF_B] - }) - - expect(fixture.session().terminalLayoutsByTabId[TAB_ID]?.titlesByLeafId).toEqual({ - [LEAF_B]: 'Server' - }) - }) -}) diff --git a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts b/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts deleted file mode 100644 index 3cb0e106afd..00000000000 --- a/src/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -// Runs on plain Node, as orcad does: the feed reads the runtime's own producers. -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { RuntimeClientEvent } from '../../../shared/remote-runtime/session-graph/runtime-client-events' -import { OrcaRuntimeService } from '../orca-runtime' -import { requireSwitchedOn } from '../construction/require-sidebar-inputs-enabled' -import { TestPhone } from './feed/testing/sidebar-inputs-feed.test-fixture' - -vi.mock('../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true })) - -beforeEach(() => { - vi.useFakeTimers() - vi.spyOn(console, 'warn').mockImplementation(() => {}) -}) - -afterEach(() => { - vi.useRealTimers() - vi.restoreAllMocks() -}) - -describe('the runtime sidebar inputs feed', () => { - it('publishes the producers’ snapshots and announces a change on the client-event bus', async () => { - const runtime = new OrcaRuntimeService(null) - const feed = requireSwitchedOn(runtime.sidebarInputsFeed) - const events: RuntimeClientEvent[] = [] - runtime.onClientEvent((event) => events.push(event)) - const phone = new TestPhone(feed, 'conn-1') - phone.refresh() - await phone.settle() - expect(phone.view().temporal).toEqual({ sessionId: null, retention: null }) - - const creation = requireSwitchedOn(runtime.workspaceLifecycle).openCreate({ - creationId: 'c1', - repoId: 'repo-1' - }) - await vi.advanceTimersByTimeAsync(60) - const notice = events.findLast((event) => event.type === 'sidebarInputsChanged') - expect(notice).toEqual({ - type: 'sidebarInputsChanged', - generation: feed.generation, - revision: expect.any(Number) - }) - if (notice?.type !== 'sidebarInputsChanged') { - throw new Error('no change notice') - } - phone.notice(notice) - await phone.settle() - expect(phone.replies.at(-1)).toMatchObject({ - kind: 'delta', - domains: { creations: { upserts: { c1: { repoId: 'repo-1' } } } } - }) - creation.close() - phone.disconnect() - }) -}) diff --git a/src/main/skills/bundled-skill-install/bundled-skill-workspace-targets.test.ts b/src/main/skills/bundled-skill-install/bundled-skill-workspace-targets.test.ts deleted file mode 100644 index 45bf256c421..00000000000 --- a/src/main/skills/bundled-skill-install/bundled-skill-workspace-targets.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { mkdir, readFile } from 'node:fs/promises' -import { dirname, join } from 'node:path' -import { afterEach, describe, expect, it } from 'vitest' -import { - linkDirectory, - makeSkillHome, - NAME, - NEW_TEXT, - previewAndInstall, - removeSkillHomes, - serviceInput, - snapshot -} from './testing/bundled-skill-home' - -afterEach(removeSkillHomes) - -describe('workspace bundled skill targets', () => { - it('accepts an internal root through a symlinked workspace', async () => { - const home = await makeSkillHome() - const project = join(home.root, 'project') - const workspace = join(home.root, 'workspace-link') - const internal = join(project, 'internal-skills') - await mkdir(internal, { recursive: true }) - await mkdir(join(project, '.claude')) - await linkDirectory(internal, join(project, '.claude', 'skills')) - await linkDirectory(project, workspace) - - const { plan } = await previewAndInstall(serviceInput(home, { workspaceDirectory: workspace })) - - expect(plan.skills[0].ops.map((op) => op.kind)).toEqual(['write', 'link']) - expect(await readFile(join(internal, NAME, 'SKILL.md'), 'utf8')).toBe(NEW_TEXT) - expect(await snapshot(home.claude)).toBe('missing') - }) - - it('installs into a safe agent root when the shared root escapes', async () => { - const home = await makeSkillHome() - const project = join(home.root, 'project') - await mkdir(dirname(home.shared), { recursive: true }) - await mkdir(join(project, '.agents'), { recursive: true }) - await mkdir(join(project, '.claude', 'skills'), { recursive: true }) - await linkDirectory(dirname(home.shared), join(project, '.agents', 'skills')) - - const { plan } = await previewAndInstall(serviceInput(home, { workspaceDirectory: project })) - - expect(plan.skills[0].ops.map((op) => [op.path, op.kind])).toEqual([ - [join(project, '.claude', 'skills', NAME), 'write'] - ]) - expect(await snapshot(join(project, '.claude', 'skills', NAME))).toContain(NEW_TEXT) - expect(await snapshot(home.shared)).toBe('missing') - }) -}) diff --git a/src/main/speech/stt-live-decode.test.ts b/src/main/speech/stt-live-decode.test.ts deleted file mode 100644 index dcd8d97c00d..00000000000 --- a/src/main/speech/stt-live-decode.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type * as TranscribeCpp from 'transcribe-cpp' -import { LiveDecode } from './stt-live-decode' - -// One scripted decode step per feed: the text so far and how much audio (ms) the stream has decoded. -function fakeSession(steps: { text: string; decodedMs: number }[]) { - let step = -1 - const stream = { - feed: async () => { - step += 1 - return { resultChanged: true, audioCommittedMs: steps[step].decodedMs } - }, - finalize: async () => ({}), - get text() { - return { full: steps[step].text } - }, - reset: () => {} - } - const session = { - stream: async () => stream - } - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: LiveDecode calls only stream(), feed(), finalize(), text and reset(). - return session as unknown as TranscribeCpp.Session -} - -describe('LiveDecode', () => { - it('shows text as it grows and commits it once quiet, covering up to a second before the decode', async () => { - const session = fakeSession([ - { text: 'I have', decodedMs: 1120 }, - { text: 'I have two questions', decodedMs: 2240 }, - { text: 'I have two questions', decodedMs: 3360 }, - { text: 'I have two questions', decodedMs: 4480 }, - { text: 'I have two questions. First', decodedMs: 5600 } - ]) - const live = new LiveDecode(session, {}, 16000, null) - const feed = (index: number) => live.feed(new Float32Array(17920), 32000 + 17920 * (index + 1)) - - expect(await feed(0)).toEqual({ type: 'partial', text: 'I have' }) - expect(await feed(1)).toEqual({ type: 'partial', text: 'I have two questions' }) - expect(await feed(2)).toBeNull() - // Started at 32000 samples (2 s in); quiet from 2.24 s decoded, committed up to 3.48 s decoded. - expect(await feed(3)).toEqual({ - type: 'quiet', - text: 'I have two questions', - covered: 32000 + 55680 - }) - expect(await feed(4)).toEqual({ type: 'partial', text: '. First' }) - expect(await live.end(true)).toBe('. First') - }) -}) diff --git a/src/main/ssh/remote-exec/ssh-exec-command-decoder-fallback.test.ts b/src/main/ssh/remote-exec/ssh-exec-command-decoder-fallback.test.ts deleted file mode 100644 index 9ed7eded54f..00000000000 --- a/src/main/ssh/remote-exec/ssh-exec-command-decoder-fallback.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { EventEmitter } from 'node:events' -import { PassThrough } from 'node:stream' -import { describe, expect, it, vi } from 'vitest' -import { runProcess } from '@orca/process-host' -import { wrapRemoteCommandForPosixShell } from './ssh-posix-command-wrapper' -import type { SshExecOptions } from '../connection/ssh-exec-options' -import { execCommand } from './remote-exec-command' - -type HostOptions = { - /** PATH on the host; '' leaves only shell builtins, so no base64 or gzip. */ - path?: string -} - -/** Exercise the actual transport wrapper through real /bin/sh. */ -function host(options: HostOptions = {}) { - const exec = vi.fn() - exec.mockImplementation(async (command: string, execOptions?: SshExecOptions) => { - const remote = wrapRemoteCommandForPosixShell(command, { - compress: execOptions?.compressCommand === true - }) - const result = await runProcess({ - program: '/bin/sh', - args: ['-c', remote], - env: { ...process.env, PATH: options.path ?? process.env.PATH ?? '' } - }) - const channel = Object.assign(new EventEmitter(), { - stdin: new PassThrough(), - stderr: new EventEmitter(), - close: () => {} - }) - setImmediate(() => { - channel.emit('data', Buffer.from(result.stdout)) - channel.stderr.emit('data', Buffer.from(result.stderr)) - channel.emit('close', result.code ?? 1) - }) - return channel - }) - return { exec, usesSystemSshTransport: () => false } -} - -const LONG = `printf '%s' ran # ${'padding '.repeat(2_000)}` - -describe.skipIf(process.platform === 'win32')( - 'a long command on hosts that cannot decode it (#30491)', - () => { - it('resends it uncompressed once, then sends that host every command plain', async () => { - const conn = host({ path: '' }) - - await expect(execCommand(conn, LONG)).resolves.toBe('ran') - await expect(execCommand(conn, LONG)).resolves.toBe('ran') - - expect(conn.exec.mock.calls.map(([, options]) => options?.compressCommand)).toEqual([ - true, - false, - false - ]) - }) - } -) diff --git a/src/main/telemetry/client-agent-dashboard-snapshot.test.ts b/src/main/telemetry/client-agent-dashboard-snapshot.test.ts deleted file mode 100644 index 1a4e1f75f63..00000000000 --- a/src/main/telemetry/client-agent-dashboard-snapshot.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it } from 'vitest' - -import { persistBannerAcknowledgeWithoutEmitting, track, trackAppOpenedOnce } from './client' -import { - cleanupTelemetryClientTest, - setupTelemetryClientTest, - type TelemetryClientTestState -} from './client-test-harness' - -describe('Agent Dashboard app-open snapshot', () => { - let state: TelemetryClientTestState - - beforeEach(() => { - state = setupTelemetryClientTest() - }) - - afterEach(() => { - cleanupTelemetryClientTest(state.envStash) - }) - - it.each([true, false, undefined])( - 'records the saved setting %s once without requiring a toggle or adding an event', - (enabled) => { - state.settings.experimentalAgentDashboardPopout = enabled - - trackAppOpenedOnce() - trackAppOpenedOnce() - - expect(state.mock.capture).toHaveBeenCalledTimes(1) - expect(state.mock.capture.mock.calls[0]?.[0]).toMatchObject({ - event: 'app_opened', - properties: { - agent_dashboard_enabled: enabled === true, - $process_person_profile: false - } - }) - } - ) - - it('overrides a caller-provided snapshot with main-owned settings', () => { - state.settings.experimentalAgentDashboardPopout = true - - track('app_opened', { agent_dashboard_enabled: false }) - - expect(state.mock.capture.mock.calls[0]?.[0].properties.agent_dashboard_enabled).toBe(true) - }) - - it('reads the latest setting when the pending banner is resolved', async () => { - state.settings.telemetry!.optedIn = null - state.settings.telemetry!.existedBeforeTelemetryRelease = true - state.settings.experimentalAgentDashboardPopout = false - trackAppOpenedOnce() - expect(state.mock.capture).not.toHaveBeenCalled() - - state.settings.experimentalAgentDashboardPopout = true - await persistBannerAcknowledgeWithoutEmitting() - trackAppOpenedOnce() - - expect(state.mock.capture).toHaveBeenCalledTimes(1) - expect(state.mock.capture.mock.calls[0]?.[0]).toMatchObject({ - event: 'app_opened', - properties: { agent_dashboard_enabled: true } - }) - }) -}) diff --git a/src/main/text-generation/execution/source-control-agent-hook-isolation.test.ts b/src/main/text-generation/execution/source-control-agent-hook-isolation.test.ts deleted file mode 100644 index 7043a4dc273..00000000000 --- a/src/main/text-generation/execution/source-control-agent-hook-isolation.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { afterAll, expect, it } from 'vitest' -import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { spawnSourceControlAgent } from './source-control-agent-launch' - -const folder = mkdtempSync(join(tmpdir(), 'orca-generation-hook-isolation-')) -afterAll(() => rmSync(folder, { recursive: true, force: true })) - -it('keeps background generation from reporting hooks against the launching terminal', async () => { - const agent = join(folder, 'report-environment.cjs') - writeFileSync( - agent, - `process.stdin.resume() -console.log(JSON.stringify({ - pane: process.env.ORCA_PANE_KEY ?? null, - fallbackPane: process.env.ORCA_AGENT_PANE ?? null, - launch: process.env.ORCA_AGENT_LAUNCH_TOKEN ?? null, - endpoint: process.env.ORCA_AGENT_HOOK_ENDPOINT ?? null, - port: process.env.ORCA_AGENT_HOOK_PORT ?? null, - disabled: process.env.ORCA_AGENT_HOOKS_DISABLED, - home: process.env.CODEX_HOME -})) -` - ) - const child = spawnSourceControlAgent({ - binary: process.execPath, - args: [agent], - cwd: folder, - env: { - ...process.env, - ORCA_PANE_KEY: 'dev-tab:dev-pane', - ORCA_AGENT_PANE: 'dev-tab:dev-pane', - ORCA_AGENT_LAUNCH_TOKEN: 'parent-launch', - ORCA_AGENT_HOOK_ENDPOINT: '/parent/hook.sock', - ORCA_AGENT_HOOK_PORT: '57279', - ORCA_AGENT_HOOKS_DISABLED: '0', - CODEX_HOME: join(folder, 'managed-home') - }, - stdinMode: 'pipe', - useCwdForNative: true - }) - let stdout = '' - let stderr = '' - child.stdout?.on('data', (chunk) => (stdout += chunk.toString())) - child.stderr?.on('data', (chunk) => (stderr += chunk.toString())) - const closed = new Promise((resolve, reject) => { - child.on('close', resolve) - child.on('error', reject) - }) - child.stdin?.end() - - expect(await closed, stderr).toBe(0) - expect(JSON.parse(stdout)).toEqual({ - pane: null, - fallbackPane: null, - launch: null, - endpoint: null, - port: null, - disabled: '1', - home: join(folder, 'managed-home') - }) -}) diff --git a/src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts b/src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts deleted file mode 100644 index a0856d22542..00000000000 --- a/src/renderer/src/components/automations/hosts/automation-host-scheduler.test.ts +++ /dev/null @@ -1,180 +0,0 @@ -/** Enforce four pooled calls, one legacy authority call per cycle and no run-history fetch to fill missing usage. */ - -import { describe, expect, it, vi } from 'vitest' -import type { Automation } from '../../../../../shared/automations/automation-definition' - -import type { - AutomationAuthorityRef, - StableAutomationAuthorityRef, - StableAutomationCatalogRef -} from '../../../../../shared/automations/ownership/automation-owner-ref' -import { createAutomationHostCache, type AutomationHostCache } from './automation-host-cache' -import type { AutomationHostQuerySupport } from './automation-host-catalog-types' -import { - createAutomationHostScheduler, - type AutomationHostFetchTarget -} from './automation-host-scheduler' -import type { ScopedAutomationList } from './automation-scoped-list-client' - -const RUNTIME_AUTHORITY: AutomationAuthorityRef = { - kind: 'runtime', - environmentId: 'env-1', - pairingRevision: 4 -} - -function stableAuthority(authority: AutomationAuthorityRef): StableAutomationAuthorityRef { - return authority.kind === 'desktop' - ? { kind: 'desktop' } - : { kind: 'runtime', environmentId: authority.environmentId } -} - -function selfRef(authority: AutomationAuthorityRef): StableAutomationCatalogRef { - return { authority: stableAuthority(authority), selector: { kind: 'self' } } -} - -function target( - ref: StableAutomationCatalogRef, - options: { - authority?: AutomationAuthorityRef - querySupport?: AutomationHostQuerySupport - targetGeneration?: number - priority?: boolean - } = {} -): AutomationHostFetchTarget { - const authority = options.authority ?? RUNTIME_AUTHORITY - return { - ref, - authority, - owner: - ref.selector.kind === 'ssh' - ? { - authority, - selector: { - kind: 'ssh', - targetId: ref.selector.targetId, - targetGeneration: options.targetGeneration ?? 2 - } - } - : { authority, selector: { kind: 'self' } }, - querySupport: options.querySupport ?? 'scoped', - priority: options.priority - } -} - -function automation(id: string, overrides: Partial = {}): Automation { - return { - id, - name: id, - projectId: 'repo-1', - executionTargetType: 'local', - ...overrides - } as Automation -} - -function scopedResult(ids: readonly string[]): ScopedAutomationList { - return { - automations: ids.map((id) => automation(id)), - items: ids.map((id) => ({ automationId: id, selector: { kind: 'self' as const } })), - orphanCount: 0, - invalidRows: 0 - } -} - -function deferred(): { promise: Promise; resolve: (value: T) => void } { - let resolve!: (value: T) => void - const promise = new Promise((res) => { - resolve = res - }) - return { promise, resolve } -} - -function createCache(now?: () => number): AutomationHostCache { - return createAutomationHostCache({ - now, - catalogGeneration: () => 0, - connectionGeneration: () => 0 - }) -} - -const LOCAL_REPO = { repoConnectionId: () => null, projectsAuthoritative: true } - -describe('automation host scheduler legacy path', () => { - it('leaves legacy rows unfenced and their usage unavailable', async () => { - const cache = createCache() - const scheduler = createAutomationHostScheduler({ - cache, - legacyPartitionContext: () => LOCAL_REPO, - isVisible: () => true, - transport: { listLegacy: () => Promise.resolve([automation('a')]) } - }) - await scheduler.refresh([ - target(selfRef(RUNTIME_AUTHORITY), { querySupport: 'legacy-unscoped' }) - ]) - const row = cache.get(selfRef(RUNTIME_AUTHORITY))?.data[0] - expect(row?.owner).toBeNull() - expect(row?.usageKnown).toBe(false) - expect(row?.usageSummary).toBeNull() - }) - - it('records an incompatible host without sending anything', async () => { - const cache = createCache() - const listScoped = vi.fn() - const scheduler = createAutomationHostScheduler({ - cache, - legacyPartitionContext: () => LOCAL_REPO, - isVisible: () => true, - transport: { listScoped } - }) - await scheduler.refresh([target(selfRef(RUNTIME_AUTHORITY), { querySupport: 'incompatible' })]) - expect(listScoped).not.toHaveBeenCalled() - expect(cache.get(selfRef(RUNTIME_AUTHORITY))?.error).toMatchObject({ - code: 'incompatible', - retryable: false - }) - }) -}) - -describe('automation host scheduler revalidation', () => { - // Manual All-hosts refresh bypasses TTL but leaves permanent failures to their own Retry. - - it('lets a forced refresh supersede the request it replaces', async () => { - const cache = createCache() - const gates = [deferred(), deferred()] - let started = 0 - const scheduler = createAutomationHostScheduler({ - cache, - legacyPartitionContext: () => LOCAL_REPO, - isVisible: () => true, - transport: { listScoped: () => gates[started++].promise } - }) - const only = target(selfRef(RUNTIME_AUTHORITY)) - const first = scheduler.refresh([only]) - await Promise.resolve() - const second = scheduler.refresh([only], { force: true }) - await Promise.resolve() - - gates[1].resolve(scopedResult(['fresh'])) - gates[0].resolve(scopedResult(['stale'])) - await Promise.all([first, second]) - - expect(cache.get(only.ref)?.data.map((row) => row.automation.id)).toEqual(['fresh']) - }) - - it('discards a response whose entry was invalidated while in flight', async () => { - const cache = createCache() - const gate = deferred() - const scheduler = createAutomationHostScheduler({ - cache, - legacyPartitionContext: () => LOCAL_REPO, - isVisible: () => true, - transport: { listScoped: () => gate.promise } - }) - const only = target(selfRef(RUNTIME_AUTHORITY)) - const done = scheduler.refresh([only]) - await Promise.resolve() - cache.invalidate(only.ref) - gate.resolve(scopedResult(['a'])) - await done - expect(cache.get(only.ref)?.data).toEqual([]) - }) -}) diff --git a/src/renderer/src/components/browser-pane/restored-client-hosted-recovery-window.test.tsx b/src/renderer/src/components/browser-pane/restored-client-hosted-recovery-window.test.tsx deleted file mode 100644 index e5966b84e04..00000000000 --- a/src/renderer/src/components/browser-pane/restored-client-hosted-recovery-window.test.tsx +++ /dev/null @@ -1,192 +0,0 @@ -// @vitest-environment happy-dom -import { - annotateBrowserPageHandles, - markHydratedBrowserPageHandles -} from '@/store/slices/browser/hosts/browser-initialization-presentation-ownership' -import { act, cleanup, render, screen } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -import type { BrowserPage } from '../../../../shared/browser/workspaces/browser-workspace-types' -import type { RuntimeStatus } from '../../../../shared/remote-runtime/session-graph/runtime-session-contracts' - -const mocks = vi.hoisted(() => ({ attach: vi.fn(), createBrowserTab: vi.fn(async () => true) })) - -vi.mock('./browser-client-page-renderer-installation', () => ({ - attachBrowserClientPageToViewport: mocks.attach -})) -vi.mock('@/runtime/browser/creation/web-runtime-browser-creation', () => ({ - createWebRuntimeSessionBrowserTab: mocks.createBrowserTab -})) -vi.mock('sonner', () => ({ - toast: { error: vi.fn(), success: vi.fn(), loading: vi.fn(), message: vi.fn() } -})) - -import { useAppStore } from '@/store' -import { TooltipProvider } from '@/components/ui/tooltip' -import { installClientHostedPaneApi } from './client-hosted-browser-pane-test-rig' -import { ClientHostedBrowserPagePane } from './ClientHostedBrowserPagePane' -import { RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS } from './restored-client-hosted-recovery-window' - -const PAGE_ID = 'page-a' -const ENVIRONMENT_ID = 'environment-a' - -function page(): BrowserPage { - return { - id: PAGE_ID, - workspaceId: 'workspace-a', - worktreeId: 'worktree-a', - url: 'https://remote.internal/saved', - title: 'Saved', - loading: false, - faviconUrl: null, - canGoBack: false, - canGoForward: false, - loadError: null, - createdAt: 1 - } -} - -// Cold relaunch mounts persisted panes before any environment status entry exists. -type EnvironmentReachability = 'reachable' | 'unreachable' | 'absent' - -function runtimeStatusMap( - reachability: EnvironmentReachability -): Map { - if (reachability === 'absent') { - return new Map() - } - return new Map([ - [ - ENVIRONMENT_ID, - { - status: reachability === 'reachable' ? ({ runtimeId: 'runtime-a' } as RuntimeStatus) : null, - checkedAt: 1 - } - ] - ]) -} - -function seedStore(options: { restored: boolean; environment: EnvironmentReachability }): void { - useAppStore.setState({ - remoteBrowserPageHandlesByPageId: markHydratedBrowserPageHandles( - options.restored - ? { - [PAGE_ID]: { - environmentId: ENVIRONMENT_ID, - remotePageId: 'remote-page-a', - restoredFromSession: true, - restoredClientHosted: true - } - } - : { - [PAGE_ID]: { - environmentId: ENVIRONMENT_ID, - remotePageId: 'remote-page-a', - staged: true, - stagedClientHosted: true - } - } - ), - runtimeStatusByEnvironmentId: runtimeStatusMap(options.environment) - }) -} - -function paneElement(): React.JSX.Element { - return ( - - - - ) -} - -function renderPane(): ReturnType { - return render(paneElement()) -} - -function noticeShown(): boolean { - return screen.queryByText('Client-hosted browser unavailable') !== null -} - -describe('restored client-hosted recovery window', () => { - beforeEach(() => { - vi.useFakeTimers() - mocks.attach.mockReset() - installClientHostedPaneApi() - }) - afterEach(() => { - cleanup() - vi.useRealTimers() - useAppStore.setState({ - remoteBrowserPageHandlesByPageId: markHydratedBrowserPageHandles({}), - runtimeStatusByEnvironmentId: new Map() - }) - }) - - // Seed no status to exercise cold-start reachability arming the clock after mount. - it('arms the window when the environment first becomes reachable', () => { - seedStore({ restored: true, environment: 'absent' }) - renderPane() - - act(() => vi.advanceTimersByTime(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS * 2)) - expect(noticeShown()).toBe(false) - - act(() => { - useAppStore.setState({ runtimeStatusByEnvironmentId: runtimeStatusMap('reachable') }) - }) - - act(() => vi.advanceTimersByTime(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS - 1)) - expect(noticeShown()).toBe(false) - act(() => vi.advanceTimersByTime(1)) - expect(noticeShown()).toBe(true) - }) - - it('waits again when a recovered page loses its placement', () => { - seedStore({ restored: true, environment: 'reachable' }) - const view = renderPane() - act(() => vi.advanceTimersByTime(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS)) - act(() => { - useAppStore.setState({ - remoteBrowserPageHandlesByPageId: annotateBrowserPageHandles( - { - [PAGE_ID]: { environmentId: ENVIRONMENT_ID, remotePageId: 'remote-page-a' } - }, - [PAGE_ID] - ) - }) - }) - expect(noticeShown()).toBe(false) - - act(() => { - useAppStore.setState({ - remoteBrowserPageHandlesByPageId: annotateBrowserPageHandles( - { - [PAGE_ID]: { - environmentId: ENVIRONMENT_ID, - remotePageId: 'remote-page-a', - restoredFromSession: true, - restoredClientHosted: true - } - }, - [PAGE_ID] - ) - }) - view.rerender(paneElement()) - }) - - expect(noticeShown()).toBe(false) - act(() => vi.advanceTimersByTime(RESTORED_CLIENT_HOSTED_RECOVERY_WINDOW_MS - 1)) - expect(noticeShown()).toBe(false) - act(() => vi.advanceTimersByTime(1)) - expect(noticeShown()).toBe(true) - }) -}) diff --git a/src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts b/src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts deleted file mode 100644 index 13f9c634b4c..00000000000 --- a/src/renderer/src/components/native-chat/conversation/projection/structured-agent-session-transcript-order.test.ts +++ /dev/null @@ -1,155 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { - AgentJournalItemBody, - AgentJournalRenderItem, - AgentJournalSubmission -} from '../../../../../../shared/agent-session/journal/agent-session-journal-types' -import { projectAgentSessionConversationOutline } from '../../../../../../shared/agent-session/agent-session-conversation-outline' -import { agentJournalSubmissionKey } from '../../../../../../shared/agent-session/journal/agent-session-journal-item-key' -import type { StructuredAgentSessionOptimisticMessage } from '../../../../../../shared/agent-session/view/structured-agent-session-message-projection' -import { structuredAgentSessionSendBody } from '../../../../../../shared/agent-session/requests/structured-agent-session-send-mutation' -import { createNativeChatMessageListProjection } from './native-chat-message-list-projection' -import { projectStructuredAgentSessionMessages } from './structured-agent-session-message-projection' - -function optimisticMessage(args: { - clientMessageId: string - sessionId?: string - text: string - attachments: readonly { path: string; previewUri: string }[] - queuedAt: number -}): StructuredAgentSessionOptimisticMessage { - return { - clientMessageId: args.clientMessageId, - body: structuredAgentSessionSendBody(args.text, args.attachments), - queuedAt: args.queuedAt - } -} - -function journalItem( - itemId: string, - sequence: number, - observedAt: number, - body: AgentJournalItemBody, - extra: Partial = {} -): AgentJournalRenderItem { - return { itemId, revision: 1, sequence, observedAt, body, ...extra } -} - -function said(role: 'user' | 'assistant', text: string): AgentJournalItemBody { - return { kind: 'message', role, blocks: [{ type: 'text', text }] } -} - -function answered(question: string): AgentJournalItemBody { - return { - kind: 'question', - question, - options: [{ id: 'yes', label: 'Yes' }], - resolution: { state: 'resolved', selectedOptionId: 'yes', resolvedBy: 'client', resolvedAt: 9 } - } -} - -function drawn( - items: AgentJournalRenderItem[], - outbox: StructuredAgentSessionOptimisticMessage[] = [], - submissions: AgentJournalSubmission[] = [] -): string[] { - return createNativeChatMessageListProjection()( - projectStructuredAgentSessionMessages(items, outbox, submissions) - ).conversation.map(({ id }) => id) -} - -function queued(clientMessageId: string, text: string, queuedAt: number) { - return optimisticMessage({ - clientMessageId, - sessionId: 'session', - text, - attachments: [], - queuedAt - }) -} - -describe('structured transcript order', () => { - it('draws a row recovered after a crash at its journal position, not its earlier clock', () => { - // The provider logged the last prompt before the crash; the host journalled it on recovery. - const items = [ - journalItem('ask', 1, 100, said('user', 'Fix the parser')), - journalItem('reply', 2, 300, said('assistant', 'Working on it')), - journalItem('steer', 3, 310, said('user', 'Keep the old API')), - journalItem('recovered', 4, 200, said('user', 'Also add a test'), { - recovered: true, - recoveredAt: 400 - }) - ] - expect(drawn(items)).toEqual(['ask', 'reply', 'steer', 'recovered']) - expect(projectAgentSessionConversationOutline(items, []).map(({ itemId }) => itemId)).toEqual([ - 'ask', - 'steer', - 'recovered' - ]) - }) - - it("draws one write's questions by their place in it, whatever order they arrive in", () => { - // Same-write questions share time/sequence; neither ids nor arrival order supplies their write index. - const scope = journalItem('q:scope', 5, 500, answered('Which files?')) - const priority = journalItem('q:priority', 5, 500, answered('What matters?'), { - sequenceIndex: 1 - }) - const deadline = journalItem('q:deadline', 5, 500, answered('When?'), { sequenceIndex: 2 }) - expect(drawn([priority, deadline, scope])).toEqual(['q:scope', 'q:priority', 'q:deadline']) - }) - - it('keeps a send the journal does not hold yet below every row it does', () => { - // The composer's clock can trail the host's; the unsent message still reads last. - const outbox = [queued('queued', 'One more thing', 150)] - const items = [ - journalItem('ask', 1, 100, said('user', 'Fix the parser')), - journalItem('reply', 2, 200, said('assistant', 'Working on it')) - ] - expect(drawn(items, outbox)).toEqual(['ask', 'reply', agentJournalSubmissionKey('queued')]) - }) - - it('keeps a retained ordinary send ahead of later host rows despite their earlier clocks', () => { - const first = { ...queued('first', 'Original', 150), afterSequence: 2 } - const second = { ...queued('second', 'Later', 151), afterSequence: 2 } - const items = [ - journalItem('ask', 1, 100, said('user', 'Start')), - journalItem('stopped', 2, 140, { kind: 'status', text: 'Interrupted' }), - journalItem('later-host-input', 3, 120, said('user', 'Newer input')) - ] - expect(drawn(items, [first, second])).toEqual([ - 'ask', - 'stopped', - agentJournalSubmissionKey('first'), - agentJournalSubmissionKey('second'), - 'later-host-input' - ]) - }) - - it('keeps a send the journal recorded and the provider refused at its journal place', () => { - const refused = agentJournalSubmissionKey('steer') - const items = [ - journalItem('ask', 1, 100, said('user', 'Fix the parser')), - journalItem(refused, 2, 200, said('user', 'Keep the old API')), - journalItem('reply', 3, 300, said('assistant', 'Done.')) - ] - const submissions: AgentJournalSubmission[] = [ - { - clientMessageId: 'steer', - fence: 1, - payloadFingerprint: 'fingerprint', - dispatchState: 'rejected', - providerItemId: null, - reason: 'provider_refused', - submittedAt: 200, - resolvedAt: 250 - } - ] - expect( - drawn( - items, - [queued('steer', 'Keep the old API', 190), queued('next', 'And docs', 400)], - submissions - ) - ).toEqual(['ask', refused, 'reply', agentJournalSubmissionKey('next')]) - }) -}) diff --git a/src/renderer/src/components/native-chat/session/structured/delivery/use-structured-agent-session-delivery-notices.test.tsx b/src/renderer/src/components/native-chat/session/structured/delivery/use-structured-agent-session-delivery-notices.test.tsx deleted file mode 100644 index 5860c20f593..00000000000 --- a/src/renderer/src/components/native-chat/session/structured/delivery/use-structured-agent-session-delivery-notices.test.tsx +++ /dev/null @@ -1,152 +0,0 @@ -// @vitest-environment happy-dom -import { memo } from 'react' -import { cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import type { AgentJournalSubmission } from '../../../../../../../shared/agent-session/journal/agent-session-journal-types' -import { agentJournalSubmissionKey } from '../../../../../../../shared/agent-session/journal/agent-session-journal-item-key' -import type { NativeChatDeliveryNotice } from '../../../messages/rows/NativeChatMessageRow' -import { useStructuredAgentSessionDeliveryNotices } from './use-structured-agent-session-delivery-notices' -import { NativeChatHostSetupContext } from '../../../host-access/native-chat-host-setup' -import { NativeChatSetupButton } from '../../../host-access/NativeChatSetupButton' -import { agentSessionFailureWords } from '../../../../../../../shared/agent-session/failures/agent-session-failure-words' -import type { SubmissionRejectionFact } from '../../../../../../../shared/agent-session/failures/agent-session-failure' - -afterEach(cleanup) -const EMPTY: readonly never[] = [] -const signInView = { signingIn: false, signIn: vi.fn() } -const setupView = { signIn: signInView, install: null } - -it('bounds submission work and renders only rows whose delivery notice changes at N and 10N', () => { - for (const size of [32, 320]) { - let stateReads = 0 - let fingerprintReads = 0 - const renders = new Map() - let latest: ReadonlyMap = new Map() - function submission( - index: number, - state: AgentJournalSubmission['dispatchState'], - at = 1 - ): AgentJournalSubmission { - const id = String(index) - return { - clientMessageId: id, - fence: 1, - get payloadFingerprint() { - fingerprintReads++ - return id - }, - get dispatchState() { - stateReads++ - return state - }, - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: state === 'pending' ? null : at - } - } - const Row = memo(function Row({ - id, - notice - }: { - id: string - notice: NativeChatDeliveryNotice | undefined - }) { - renders.set(id, (renders.get(id) ?? 0) + 1) - return {notice?.sending ? 'Sending' : 'Ordinary'} - }) - function Chat({ submissions }: { submissions: readonly AgentJournalSubmission[] }) { - latest = useStructuredAgentSessionDeliveryNotices({ - pending: EMPTY, - submissions, - journalItems: EMPTY, - startFailures: EMPTY, - agentName: 'Claude' - }) - return submissions.map(({ clientMessageId }) => ( - - )) - } - const initial = Array.from({ length: size }, (_, index) => - submission(index, index === size - 1 ? 'accepted' : 'pending') - ) - const view = render() - const before = latest - renders.clear() - stateReads = 0 - fingerprintReads = 0 - const unrelated = [...initial.slice(0, -1), submission(size - 1, 'accepted', 2)] - view.rerender() - expect(latest).toBe(before) - expect(renders.size).toBe(0) - expect(stateReads).toBeLessThanOrEqual(5 * size) - expect(stateReads).toBeGreaterThanOrEqual(size) - expect(fingerprintReads).toBe(0) - - stateReads = 0 - const accepted = [submission(0, 'accepted'), ...unrelated.slice(1)] - view.rerender() - expect(latest.has(agentJournalSubmissionKey('0'))).toBe(false) - expect(latest.get(agentJournalSubmissionKey('1'))).toBe( - before.get(agentJournalSubmissionKey('1')) - ) - expect(renders).toEqual(new Map([['0', 1]])) - expect(stateReads).toBeLessThanOrEqual(5 * size) - expect(fingerprintReads).toBe(0) - view.unmount() - } -}) - -it('keeps one usable sign-in owner as typed rejection and visible failure rows arrive', () => { - const failure: SubmissionRejectionFact = { kind: 'notSignedIn' } - const { signIn } = signInView - signIn.mockClear() - const words = agentSessionFailureWords(failure, { agentName: 'Pi', surface: 'rejection' }) - const submission: AgentJournalSubmission = { - clientMessageId: 'refused', - fence: 1, - payloadFingerprint: 'refused', - dispatchState: 'rejected', - providerItemId: null, - reason: words.reason, - submittedAt: 1, - resolvedAt: 2 - } - const observed: { notice?: NativeChatDeliveryNotice } = {} - function Chat({ typed, stated = false }: { typed: boolean; stated?: boolean }) { - const notices = useStructuredAgentSessionDeliveryNotices({ - pending: EMPTY, - submissions: [{ ...submission, ...(typed ? { rejection: failure } : {}) }], - journalItems: EMPTY, - startFailures: stated ? [failure] : EMPTY, - agentName: 'Pi' - }) - const notice = notices.get(agentJournalSubmissionKey('refused')) - observed.notice = notice - return ( - - - {stated ? : null} - - ) - } - const view = render() - const originalText = observed.notice?.text - expect(originalText).toEqual(expect.any(String)) - expect(screen.queryByRole('button', { name: 'Sign in' })).toBeNull() - // The typed fact adds the action while the existing host-authored sentence stays identical. - view.rerender() - expect(observed.notice?.text).toBe(originalText) - fireEvent.click(screen.getByRole('button', { name: 'Sign in' })) - expect(signIn).toHaveBeenCalledOnce() - view.rerender() - fireEvent.click(screen.getByRole('button', { name: 'Sign in' })) - expect(signIn).toHaveBeenCalledTimes(2) - view.rerender() - fireEvent.click(screen.getByRole('button', { name: 'Sign in' })) - expect(signIn).toHaveBeenCalledTimes(3) -}) diff --git a/src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionHistoryDialog.test.tsx b/src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionHistoryDialog.test.tsx deleted file mode 100644 index cd92abdcee8..00000000000 --- a/src/renderer/src/components/right-sidebar/ai-vault/session-list/AiVaultSessionHistoryDialog.test.tsx +++ /dev/null @@ -1,170 +0,0 @@ -// @vitest-environment happy-dom -import '@testing-library/jest-dom/vitest' -import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { TooltipProvider } from '@/components/ui/tooltip' -import { ConfirmationDialogProvider } from '@/components/confirmation-dialog' -import { useAppStore } from '@/store/index' -import { makeRepo, makeWorktree } from '../../../worktree-jump/worktree-jump-palette-test-fixtures' -import { openAgentSessionHistoryModal } from '../panel/agent-session-history-modal' - -import type { - AiVaultAgent, - AiVaultSession -} from '../../../../../../shared/ai-vault/contracts/ai-vault-types' -import type { AiVaultSessionListGroup } from './ai-vault-session-filters' - -const mocks = vi.hoisted(() => ({ - scopePaths: new Array(), - sessions: new Array(), - handleResumeInNewChat: vi.fn() -})) - -vi.mock('../scanning/ai-vault-session-refresh', () => ({ - useAiVaultSessionRefresh: (scopePaths: readonly string[]) => { - mocks.scopePaths.push(scopePaths) - return { - error: null, - loading: false, - refresh: vi.fn(), - scanResult: null, - sessions: mocks.sessions, - loadedSessionLimit: null - } - } -})) -vi.mock('../session-actions/ai-vault-session-launch-actions', () => ({ - useAiVaultSessionLaunchActions: () => ({ - continuationRequest: null, - handleResume: vi.fn(), - handleResumeInNewChat: mocks.handleResumeInNewChat, - handleResumeInNewCli: vi.fn() - }) -})) -vi.mock('../session-actions/ai-vault-original-pane-actions', () => ({ - useAiVaultOriginalPaneActions: () => ({ jumpToOriginalPane: vi.fn(), jumpToWorktree: vi.fn() }) -})) -vi.mock('../session-actions/ai-vault-session-delete-action', () => ({ - useAiVaultSessionDeleteAction: () => vi.fn() -})) -// The list's rows and keys have their own tests; this one stands in for a row's Resume button. -vi.mock('./AiVaultSessionVirtualList', () => ({ - AiVaultSessionVirtualList: (props: { - groups: AiVaultSessionListGroup[] - onResumeInNewChat: (session: null, id: string) => void - }) => ( - <> - - {props.groups.flatMap((group) => group.sessions.map(({ id }) =>

{id}

))} - - ) -})) - -import AiVaultSessionHistoryDialog from './AiVaultSessionHistoryDialog' -import AiVaultSidebarPanel from '../panel/AiVaultSidebarPanel' - -const CHAT_WORKTREE = 'repo-1::/repo/chat' -const OTHER_WORKTREE = 'repo-1::/repo/other' - -function Host({ withSidebar = false }: { withSidebar?: boolean }) { - const open = useAppStore((s) => s.activeModal === 'agent-session-history') - return ( - - -