refactor: group desktop integration and lifecycle owners (#37600)

* refactor: group desktop integration and lifecycle owners

* refactor: preserve runtime literals and mock owner boundaries

* refactor: link historical reliability evidence to current test paths

* refactor: retain the historical lid-sleep baseline path
This commit is contained in:
Neil
2026-11-02 17:08:59 -08:00
committed by GitHub
parent 7f0b513c64
commit b89cfbd09d
154 changed files with 296 additions and 245 deletions
+2 -2
View File
@@ -829,8 +829,8 @@
2 test-no-wall-clock:src/main/ipc/worktree-git-status-attribution-real-git.test.ts
5 test-no-wall-clock:src/main/ipc/worktrees-orphan-directory-cleanup.test.ts
2 test-no-wall-clock:src/main/local-worktree-removal-recovery-live.test.ts
1 test-no-wall-clock:src/main/macos-press-and-hold-default.defaults-domain.test.ts
2 test-no-wall-clock:src/main/macos-tcc-log-stream-orphans.test.ts
1 test-no-wall-clock:src/main/window/desktop-integration/macos-press-and-hold-default.defaults-domain.test.ts
2 test-no-wall-clock:src/main/macos-permissions/macos-tcc-log-stream-orphans.test.ts
1 test-no-wall-clock:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts
3 test-no-wall-clock:src/main/managed-server/host-state/orcad-state-snapshot-shell.test.ts
3 test-no-wall-clock:src/main/managed-server/host-state/orcad-windows-host-fence-ops.test.ts
+1 -1
View File
@@ -28,7 +28,7 @@
1 src/main/git/repo-detection-command.ts
1 src/main/git/runner.ts
1 src/main/ipc/worktree-logic.ts
2 src/main/macos-press-and-hold-default.ts
2 src/main/window/desktop-integration/macos-press-and-hold-default.ts
1 src/main/network/macos-tailscale-dns-diagnostic.ts
1 src/main/opencode/legacy-plugin-acl-retry.ts
2 src/main/orcad/node-pty-precondition.ts
+1
View File
@@ -11,6 +11,7 @@ config/scripts/pr-code-change-scope.mjs src/shared/agent-session-resume-marker
config/scripts/pr-code-change-scope.mjs src/shared/agent-session-turn-record
config/scripts/pr-layout-oracle-route.mjs src/main/runtime/old-session-tabs-stream/
config/scripts/pr-layout-oracle-route.mjs src/renderer/src/runtime/remote-workspace-frozen/
config/scripts/run-linux-lid-sleep-assertion-docker.mjs src/main/linux-lid-sleep-assertion.ts
config/scripts/run-ssh-staged-upload-reliability.mjs src/main/ssh/ssh-relay-install-namespace.test.ts
config/tsconfig.node.json src/renderer/src/components/native-chat/native-chat-composer-primary-action.ts
config/tsconfig.node.json src/renderer/src/components/native-chat/native-chat-resolution-receipt.ts
@@ -12,7 +12,7 @@ src/main/agent-hooks/wsl-hook-relay-sentinel.ts
src/main/ai-vault/session-scanner-service-client-state.ts
src/main/ai-vault/session-scanner-service-client.ts
src/main/ai-vault/session-scanner-service-spawn.ts
src/main/app-icon.ts
src/main/window/desktop-integration/app-icon.ts
src/main/automations/precheck-runner.ts
src/main/browser/agent-browser/agent-browser-bridge-execution.ts
src/main/browser/agent-browser/agent-browser-bridge-raw-process.ts
@@ -38,7 +38,7 @@ src/main/emulator/serve-sim-helper-processes.ts
src/main/emulator/serve-sim-runtime-materializer.ts
src/main/emulator/simctl-simulator-devices.ts
src/main/emulator/simulator-app-visibility.ts
src/main/external-editor-launch.ts
src/main/external-editors/external-editor-launch.ts
src/main/git/command-runner/exec-file-capture.ts
src/main/git/command-runner/git-exec-file-sync.ts
src/main/git/command-runner/git-spawn.ts
@@ -73,8 +73,8 @@ src/main/ipc/repos/repo-clone-lifecycle.ts
src/main/ipc/worktree-apfs-clone.ts
src/main/local-builds/local-build-candidate.ts
src/main/macos-keychain/generic-password.ts
src/main/macos-system-sleep-assertion.ts
src/main/macos-tcc-prompt-watch.ts
src/main/power/macos-system-sleep-assertion.ts
src/main/macos-permissions/macos-tcc-prompt-watch.ts
src/main/memory/collector.ts
src/main/native-chat/wsl-transcript-fs-process-slot.ts
src/main/native-chat/wsl-transcript-fs-process-spawn.ts
+6 -5
View File
@@ -4109,19 +4109,19 @@
"invariant": "A non-empty SSH file stream that produces no valid frame for 30 seconds must cancel at its authoritative stream reader and release all local lifecycle state. System suspend is sticky across metadata and subscription races, resume grants every still-live stream one fresh inactivity window, one failing consumer cannot block the others, and the sole Electron bridge survives a vetoed before-quit without retaining a per-stream Electron listener.",
"oracle": "Publish suspend before stream metadata resolves, jump wall time by one hour, and require the late-subscribing stream to remain pending until resume grants a fresh 30-second window. Deliver a valid final chunk and end frame, require exact content, then publish another resume and require zero timers, multiplexer listeners, or renewed work; separately require stalled cancellation at 30 seconds, atomic state replay, failure-isolated fanout, and bridge disposal only after the committed will-quit gate.",
"commands": [
"ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/system-resume-broadcast.test.ts src/main/system-power-lifecycle.test.ts --reporter=dot --maxWorkers=2"
"ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/power/system-resume-broadcast.test.ts src/main/power/system-power-lifecycle.test.ts --reporter=dot --maxWorkers=2"
],
"testFiles": [
"src/main/system-resume-broadcast.test.ts",
"src/main/system-power-lifecycle.test.ts"
"src/main/power/system-resume-broadcast.test.ts",
"src/main/power/system-power-lifecycle.test.ts"
],
"assertionRefs": [
{
"file": "src/main/system-resume-broadcast.test.ts",
"file": "src/main/power/system-resume-broadcast.test.ts",
"assertions": ["publishes suspend and resume to main-process lifecycle consumers"]
},
{
"file": "src/main/system-power-lifecycle.test.ts",
"file": "src/main/power/system-power-lifecycle.test.ts",
"assertions": [
"replays suspended state to a late subscriber",
"atomically replays a transition to a subscriber added during publication",
@@ -4136,6 +4136,7 @@
"platform": "macos",
"result": "passed",
"command": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/system-resume-broadcast.test.ts src/main/system-power-lifecycle.test.ts --reporter=dot --maxWorkers=2",
"currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/main/power/system-resume-broadcast.test.ts src/main/power/system-power-lifecycle.test.ts --reporter=dot --maxWorkers=2",
"durationSeconds": 8.141,
"summary": "The retained behavioral cohort passed 25 tests after removing source-only ordering tests. Historical pre-removal receipts are preserved verbatim with their originally executed commands: [{\"date\":\"2026-08-01\",\"runner\":\"local\",\"platform\":\"macos\",\"command\":\"pnpm exec vitest run --config config/vitest.config.ts src/main/system-resume-broadcast.test.ts src/main/system-power-lifecycle.test.ts src/main/startup/desktop-startup-ordering.test.ts --reporter=dot\",\"result\":\"passed\",\"durationSeconds\":1.6,\"summary\":\"Four focused files and 33 tests passed, including stalled cancellation, active progress, late metadata replay, failure isolation, committed-quit bridge lifetime, and post-settlement cleanup.\"}] No new native desktop or hosted run is claimed."
}
+27 -27
View File
@@ -789,12 +789,12 @@
"src/main/acp/history/acp-history-boundary.test.ts": 1966,
"src/main/acp/history/acp-history-catch-up.test.ts": 2140,
"src/main/acp/history/acp-history-scaling.test.ts": 24879,
"src/main/active-view-persistence-boundary.test.ts": 2119,
"src/main/active-view-preference-sync-flush-veto.test.ts": 781,
"src/main/active-view-preference.test.ts": 61,
"src/main/persistence/preferences/active-view-persistence-boundary.test.ts": 2119,
"src/main/persistence/preferences/active-view-preference-sync-flush-veto.test.ts": 781,
"src/main/persistence/preferences/active-view-preference.test.ts": 61,
"src/main/agent-auth-restart-preservation.test.ts": 55,
"src/main/agent-awake-service-platform-assertions.test.ts": 112,
"src/main/agent-awake-service.test.ts": 128,
"src/main/power/agent-awake-service-platform-assertions.test.ts": 112,
"src/main/power/agent-awake-service.test.ts": 128,
"src/main/agent-cli-version-probe.test.ts": 72,
"src/main/agent-hooks/agent-home-login-shell.test.ts": 81,
"src/main/agent-hooks/agent-tool-call-reader.test.ts": 631,
@@ -1218,8 +1218,8 @@
"src/main/antigravity/posix-hook-invocation.test.ts": 5267,
"src/main/antigravity/windows-hook-json-post.test.ts": 6873,
"src/main/antigravity/windows-hook-payload-delivery.test.ts": 105,
"src/main/app-icon.test.ts": 77,
"src/main/app-relaunch.test.ts": 93,
"src/main/window/desktop-integration/app-icon.test.ts": 77,
"src/main/startup/quit/app-relaunch.test.ts": 93,
"src/main/appimage-runtime-identity.test.ts": 104,
"src/main/artifacts/artifact-cloud-config.test.ts": 47,
"src/main/artifacts/artifact-cloud-recovery.test.ts": 495,
@@ -2534,8 +2534,8 @@
"src/main/external-conversations/external-conversation-reopen.test.ts": 1591,
"src/main/external-conversations/external-conversation-seam.test.ts": 2913,
"src/main/external-conversations/external-conversations-install.test.ts": 1687,
"src/main/external-editor-launch-process-host.test.ts": 215,
"src/main/external-editor-launch.test.ts": 151,
"src/main/external-editors/external-editor-launch-process-host.test.ts": 215,
"src/main/external-editors/external-editor-launch.test.ts": 151,
"src/main/file-transaction-lock.test.ts": 1047,
"src/main/fish-history-session.test.ts": 82,
"src/main/fish-xdg-data-dirs-handoff.test.ts": 76,
@@ -2935,7 +2935,7 @@
"src/main/i18n/main-i18n-lazy-locale.test.ts": 518,
"src/main/i18n/main-i18n-pre-init.test.ts": 50,
"src/main/i18n/system-language.test.ts": 358,
"src/main/image-file-signature.test.ts": 47,
"src/main/media/image-file-signature.test.ts": 47,
"src/main/integration-state-file-cache.test.ts": 47,
"src/main/integration-token-file-cache.test.ts": 152,
"src/main/ipc/account-sign-in-link-opener.test.ts": 128,
@@ -3561,7 +3561,7 @@
"src/main/link-preview/link-preview-address-guard.test.ts": 77,
"src/main/link-preview/link-preview-page-fetch.test.ts": 95,
"src/main/link-preview/link-preview-page-metadata.test.ts": 40,
"src/main/linux-lid-sleep-assertion.test.ts": 98,
"src/main/power/linux-lid-sleep-assertion.test.ts": 98,
"src/main/linux-package-install-command.test.ts": 104,
"src/main/linux-package-install-diagnostic.test.ts": 47,
"src/main/linux-package-update-recovery.test.ts": 261,
@@ -3577,13 +3577,13 @@
"src/main/local-worktree-removal-recovery-live.test.ts": 465,
"src/main/local-worktree-removal-recovery.test.ts": 351,
"src/main/ports/workspace-labels/localhost-worktree-label-proxy.test.ts": 120,
"src/main/macos-full-disk-access-status.test.ts": 42,
"src/main/macos-press-and-hold-default.defaults-domain.test.ts": 76,
"src/main/macos-press-and-hold-default.test.ts": 109,
"src/main/macos-system-sleep-assertion.test.ts": 55,
"src/main/macos-tcc-log-stream-orphans.test.ts": 110,
"src/main/macos-tcc-prompt-notice.test.ts": 82,
"src/main/macos-tcc-prompt-watch.test.ts": 77,
"src/main/macos-permissions/macos-full-disk-access-status.test.ts": 42,
"src/main/window/desktop-integration/macos-press-and-hold-default.defaults-domain.test.ts": 76,
"src/main/window/desktop-integration/macos-press-and-hold-default.test.ts": 109,
"src/main/power/macos-system-sleep-assertion.test.ts": 55,
"src/main/macos-permissions/macos-tcc-log-stream-orphans.test.ts": 110,
"src/main/macos-permissions/macos-tcc-prompt-notice.test.ts": 82,
"src/main/macos-permissions/macos-tcc-prompt-watch.test.ts": 77,
"src/main/macos-tree-clone.test.ts": 84,
"src/main/macos-update-running-instances.integration.test.ts": 59,
"src/main/managed-data-accounts/original-environment.test.ts": 209,
@@ -4314,7 +4314,7 @@
"src/main/orcad/serve-profile-ssh-targets.test.ts": 407,
"src/main/own-chromium-tree-kill-guard.test.ts": 135,
"src/main/persistence-local-only-worktree-meta.test.ts": 1948,
"src/main/persistence-onboarding-language-cohort.test.ts": 1760,
"src/main/persistence/preferences/persistence-onboarding-language-cohort.test.ts": 1760,
"src/main/persistence-orcad-migration-wsl-generation-reuse.test.ts": 1658,
"src/main/persistence/applying-settings/notification-settings-normalization.test.ts": 65,
"src/main/persistence/applying-settings/persistence-automation-extra-agent-args.test.ts": 2268,
@@ -4968,9 +4968,9 @@
"src/main/pwsh.test.ts": 69,
"src/main/qoder/hook-service.test.ts": 327,
"src/main/qoder/real-cli.test.ts": 602,
"src/main/quit-path-durable-write-blocking.test.ts": 3722,
"src/main/quit-teardown-deadline.test.ts": 48,
"src/main/quit-teardown-start-gate.test.ts": 38,
"src/main/startup/quit/quit-path-durable-write-blocking.test.ts": 3722,
"src/main/startup/quit/quit-teardown-deadline.test.ts": 48,
"src/main/startup/quit/quit-teardown-start-gate.test.ts": 38,
"src/main/rate-limits/account-runtime-target-sync.test.ts": 262,
"src/main/rate-limits/antigravity-usage-error.test.ts": 47,
"src/main/rate-limits/antigravity-usage-fetcher.test.ts": 188,
@@ -5042,8 +5042,8 @@
"src/main/repo-git-remote-identity.test.ts": 418,
"src/main/repo-git-username-enrichment-wsl-act.test.ts": 68,
"src/main/repo-git-username-enrichment.test.ts": 111,
"src/main/repo-icon-autodetect.test.ts": 806,
"src/main/repo-icon-file-detection.test.ts": 487,
"src/main/repository-icons/repo-icon-autodetect.test.ts": 806,
"src/main/repository-icons/repo-icon-file-detection.test.ts": 487,
"src/main/repo-worktrees.test.ts": 414,
"src/main/ripgrep/bundled-ripgrep-path.test.ts": 78,
"src/main/ripgrep/bundled-ripgrep-real.test.ts": 242,
@@ -6888,9 +6888,9 @@
"src/main/synthetic-title-frame-routing.test.ts": 40,
"src/main/synthetic-title-spinner.test.ts": 44,
"src/main/synthetic-title-visibility.test.ts": 51,
"src/main/system-fonts.test.ts": 77,
"src/main/system-power-lifecycle.test.ts": 42,
"src/main/system-resume-broadcast.test.ts": 67,
"src/main/window/desktop-integration/system-fonts.test.ts": 77,
"src/main/power/system-power-lifecycle.test.ts": 42,
"src/main/power/system-resume-broadcast.test.ts": 67,
"src/main/telemetry/burst-cap.test.ts": 177,
"src/main/telemetry/chat-ui-launch-tip-cohort.test.ts": 235,
"src/main/telemetry/classify-error.test.ts": 43,
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict'
import { performance } from 'node:perf_hooks'
import { extractIconHref } from '../../src/main/repo-icon-source-href.ts'
import { extractIconHref } from '../../src/main/repository-icons/repo-icon-source-href.ts'
// Regex comparator retained for the before/after measurement.
const html =
@@ -7,7 +7,7 @@ import { build } from 'esbuild'
const repo = resolve(fileURLToPath(new URL('../..', import.meta.url)))
const fixture = join(repo, 'config/docker/linux-lid-sleep-assertion')
const sourcePath = join(repo, 'src/main/linux-lid-sleep-assertion.ts')
const sourcePath = join(repo, 'src/main/power/linux-lid-sleep-assertion.ts')
const args = process.argv.slice(2)
const options = new Map()
for (let index = 0; index < args.length; index += 2) {
@@ -62,8 +62,19 @@ function runDocker(command, allowFailure = false) {
}
async function bundle(mode, ref) {
const baselinePaths = [
'src/main/power/linux-lid-sleep-assertion.ts',
'src/main/linux-lid-sleep-assertion.ts'
]
const availablePaths = ref
? execFileSync('git', ['ls-tree', '--name-only', ref, '--', ...baselinePaths], {
cwd: repo,
encoding: 'utf8'
}).split('\n')
: []
const baselinePath = baselinePaths.find((path) => availablePaths.includes(path))
const oldSource = ref
? execFileSync('git', ['show', `${ref}:src/main/linux-lid-sleep-assertion.ts`], {
? execFileSync('git', ['show', `${ref}:${baselinePath ?? baselinePaths[0]}`], {
cwd: repo,
encoding: 'utf8'
})
+1 -1
View File
@@ -100,7 +100,7 @@ const NODE_RUNTIME_INCLUDE = [
'src/main/sqlite/**/*.test.ts',
'src/main/orca-profiles/**/*.test.ts',
'src/main/managed-data-accounts/**/*.test.ts',
'src/main/quit-path-durable-write-blocking.test.ts',
'src/main/startup/quit/quit-path-durable-write-blocking.test.ts',
'src/main/automations/automation-worker-durability.test.ts',
'src/**/*.node-pty.test.ts',
'src/**/node-pty-*.test.ts',
@@ -20,7 +20,7 @@ vi.mock('./macos-computer-use-permission-status', () => ({
vi.mock('./macos-computer-use-permission-status-gate', () => ({
computerUsePermissionStatusGate: { peek: mocks.peek, read: mocks.peek, invalidate: () => {} }
}))
vi.mock('../macos-tcc-reset', () => ({
vi.mock('../macos-permissions/macos-tcc-reset', () => ({
readMacosBundleId: mocks.readBundleId,
resetMacosTccPermission: async () => ({ ok: true })
}))
@@ -58,7 +58,7 @@ async function loadModules(): Promise<{
markHostShuttingDown: () => void
}> {
const permissions = await import('./macos-computer-use-permissions')
const { markHostShuttingDown } = await import('../host-shutdown-state')
const { markHostShuttingDown } = await import('../startup/quit/host-shutdown-state')
return { permissions, markHostShuttingDown }
}
@@ -1,7 +1,7 @@
import { spawn, spawnSync } from 'node:child_process'
import { RuntimeClientError } from './runtime-client-error'
import { isHostShuttingDown } from '../host-shutdown-state'
import { readMacosBundleId, resetMacosTccPermission } from '../macos-tcc-reset'
import { isHostShuttingDown } from '../startup/quit/host-shutdown-state'
import { readMacosBundleId, resetMacosTccPermission } from '../macos-permissions/macos-tcc-reset'
import { resolveMacOSComputerUseAppPath } from './macos-native-provider-paths'
import { resolveComputerUseHelperUnavailableReason } from './macos-computer-use-permission-status'
import { computerUsePermissionStatusGate } from './macos-computer-use-permission-status-gate'
@@ -28,7 +28,7 @@ const {
vi.mock('electron', () => ({ app: { getPath: getPathMock } }))
vi.mock('node:fs/promises', () => ({ opendir: opendirMock }))
vi.mock('../telemetry/client', () => ({ track: trackMock }))
vi.mock('../macos-tcc-reset', () => ({
vi.mock('../macos-permissions/macos-tcc-reset', () => ({
readMacosBundleId: readMacosBundleIdMock,
resetMacosTccPermission: resetMacosTccPermissionMock
}))
@@ -8,7 +8,7 @@ import {
type MacTccFolderClass
} from '../../shared/daemon-adoption-telemetry'
import type { EventProps } from '../../shared/telemetry-events'
import { readMacosBundleId, resetMacosTccPermission } from '../macos-tcc-reset'
import { readMacosBundleId, resetMacosTccPermission } from '../macos-permissions/macos-tcc-reset'
import { enumerateDirectoryOnce } from './directory-enumeration-probe'
import { track } from '../telemetry/client'
import {
@@ -12,7 +12,9 @@ vi.mock('./daemon-provider-state', () => ({
getDaemonProvider: () => (state.installed ? (state.degraded ? new DegradedProvider() : {}) : null)
}))
vi.mock('./degraded-daemon-pty-provider', () => ({ DegradedDaemonPtyProvider: DegradedProvider }))
vi.mock('../macos-full-disk-access-status', () => ({ getMacosFullDiskAccessStatus: localStatus }))
vi.mock('../macos-permissions/macos-full-disk-access-status', () => ({
getMacosFullDiskAccessStatus: localStatus
}))
vi.mock('./daemon-provider-routing', () => ({
getCurrentDaemonAdapter: () => current,
getLegacyDaemonAdapters: () => [legacy]
@@ -2,7 +2,7 @@ import type { DeveloperPermissionStatus } from '../../shared/developer-permissio
import { getCurrentDaemonAdapter, getLegacyDaemonAdapters } from './daemon-provider-routing'
import { getDaemonProvider } from './daemon-provider-state'
import { DegradedDaemonPtyProvider } from './degraded-daemon-pty-provider'
import { getMacosFullDiskAccessStatus } from '../macos-full-disk-access-status'
import { getMacosFullDiskAccessStatus } from '../macos-permissions/macos-full-disk-access-status'
/** Caller gates macOS; all daemon generations must grant access, and any denial wins. */
export async function getTerminalHostsFullDiskAccessStatus(): Promise<DeveloperPermissionStatus> {
+1 -1
View File
@@ -1,5 +1,5 @@
import { readCurrentProcessMacSystemResolverHealth } from '../network/macos-system-resolver-health'
import { getMacosFullDiskAccessStatus } from '../macos-full-disk-access-status'
import { getMacosFullDiskAccessStatus } from '../macos-permissions/macos-full-disk-access-status'
import { ptySpawnHealthPlatformCoverage } from './daemon-health-identity'
import { checkDaemonAsyncIo } from './daemon-async-io-probe'
import type { DaemonFileLog } from './daemon-file-log'
@@ -4,12 +4,12 @@ const { resolveCliCommandMock } = vi.hoisted(() => ({
resolveCliCommandMock: vi.fn((command: string) => command)
}))
vi.mock('./codex-cli/command', () => ({
vi.mock('../../shared/node-cli-command-resolution', () => ({
resolveCliCommand: resolveCliCommandMock
}))
import type { SshTarget } from '../shared/ssh-types'
import { getCmdExePath } from './win32-utils'
import type { SshTarget } from '../../shared/ssh-types'
import { getCmdExePath } from '../../shared/windows-batch-spawn'
import { resolveExternalEditorLaunchSpec } from './external-editor-launch'
import { resolveRemoteSshEditorLaunchSpec } from './remote-ssh-editor-launch'
@@ -1,12 +1,12 @@
import { quotePosixShellUnlessPlain } from '../shared/shell-argument-quoting'
import { quotePosixShellUnlessPlain } from '../../shared/shell-argument-quoting'
import { spawn, type ChildProcess } from 'node:child_process'
import { spawnProcess } from '@orca/process-host'
import { existsSync } from 'node:fs'
import { posix, win32 } from 'node:path'
import { parseWslUncPath } from '../shared/wsl-paths'
import { isVsCodeLauncherExecutable } from '../shared/remote-ssh-editor-launcher'
import { resolveCliCommand } from './codex-cli/command'
import { envWithoutAppImageRuntime } from './pty/appimage-terminal-env'
import { parseWslUncPath } from '../../shared/wsl-paths'
import { isVsCodeLauncherExecutable } from '../../shared/remote-ssh-editor-launcher'
import { resolveCliCommand } from '../../shared/node-cli-command-resolution'
import { envWithoutAppImageRuntime } from '../pty/appimage-terminal-env'
import {
getLauncherBaseName,
hasMatchingOuterQuotes,
@@ -17,7 +17,7 @@ import {
resolveColocatedJetBrainsGuiExecutable
} from './jetbrains-windows-gui-launchers'
import { findInstalledVsCodeCli } from './vscode-cli-install-paths'
import { getCmdExePath, getSpawnArgsForWindows } from './win32-utils'
import { getCmdExePath, getSpawnArgsForWindows } from '../../shared/windows-batch-spawn'
export const EXTERNAL_EDITOR_CLI_COMMAND = 'code'
const WINDOWS_CONSOLE_EDITORS = new Set(['nvim', 'vim'])
@@ -1,13 +1,13 @@
import { getRemoteSshEditorKind } from '../shared/remote-ssh-editor-launcher'
import type { ShellOpenExternalEditorResult } from '../shared/shell-open-types'
import type { SshTarget } from '../shared/ssh-types'
import { getRemoteSshEditorKind } from '../../shared/remote-ssh-editor-launcher'
import type { ShellOpenExternalEditorResult } from '../../shared/shell-open-types'
import type { SshTarget } from '../../shared/ssh-types'
import { getLauncherBaseName } from './editor-launcher-name'
import {
resolveExternalEditorExecutable,
type ExternalEditorLaunchSpec
} from './external-editor-launch'
import { resolveVsCodeSshAuthority } from './ssh/config/vscode-ssh-authority'
import { resolveZedSshUrl } from './ssh/config/zed-ssh-url'
import { resolveVsCodeSshAuthority } from '../ssh/config/vscode-ssh-authority'
import { resolveZedSshUrl } from '../ssh/config/zed-ssh-url'
export function resolveRemoteSshEditorLaunchSpec(
command: string | undefined,
+2 -2
View File
@@ -1,6 +1,6 @@
import { EventEmitter } from 'node:events'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import type * as AppRelaunch from '../app-relaunch'
import type * as AppRelaunch from '../startup/quit/app-relaunch'
import { detectUiLanguage } from '../../shared/ui-locale'
const {
@@ -111,7 +111,7 @@ vi.mock('../i18n/system-language', () => ({
}))
vi.mock('../i18n/main-i18n', () => ({ setMainUiLanguage: setMainUiLanguageMock }))
vi.mock('../app-relaunch', async (importOriginal) => ({
vi.mock('../startup/quit/app-relaunch', async (importOriginal) => ({
...(await importOriginal<typeof AppRelaunch>()),
relaunchApp: relaunchAppMock
}))
+1 -1
View File
@@ -8,7 +8,7 @@ import { app, BrowserWindow, dialog, ipcMain, type IpcMainInvokeEvent } from 'el
import type { AppIdentity } from '../../shared/app-identity'
import type { MarkdownDocument } from '../../shared/filesystem-entry-types'
import type { FloatingTerminalCwdRequest } from '../../shared/ui-chrome-types'
import { relaunchApp, runBeforeRelaunchCleanup } from '../app-relaunch'
import { relaunchApp, runBeforeRelaunchCleanup } from '../startup/quit/app-relaunch'
import { setWindowMaterialSuppressed } from '../window/window-material-suppression'
import { isTrustedUIRenderer } from './ui'
import { prepareWindowsAdministratorRestart } from '../windows/windows-administrator-restart'
+1 -1
View File
@@ -64,7 +64,7 @@ vi.mock('node:child_process', () => ({
execFile: execFileMock
}))
vi.mock('../macos-full-disk-access-status', () => ({
vi.mock('../macos-permissions/macos-full-disk-access-status', () => ({
getMacosFullDiskAccessStatus: getMacosFullDiskAccessStatusMock
}))
vi.mock('../daemon/daemon-full-disk-access-status', () => ({
+1 -1
View File
@@ -1,7 +1,7 @@
import { execFile } from 'node:child_process'
import dgram from 'node:dgram'
import { ipcMain, shell, systemPreferences } from 'electron'
import { getMacosFullDiskAccessStatus } from '../macos-full-disk-access-status'
import { getMacosFullDiskAccessStatus } from '../macos-permissions/macos-full-disk-access-status'
import { getTerminalHostsFullDiskAccessStatus } from '../daemon/daemon-full-disk-access-status'
import { testLocalNetworkConnection } from './local-network-connection-test'
import type {
@@ -7,7 +7,7 @@ import { constants } from 'node:fs'
import { lstat, open, readdir, realpath, type FileHandle } from 'node:fs/promises'
import { basename, extname, isAbsolute, join, relative, resolve, sep } from 'node:path'
import { classifyImportSource } from './filesystem-import-source-stat'
import { detectImageFileSignature, IMAGE_SIGNATURE_BYTES } from '../../image-file-signature'
import { detectImageFileSignature, IMAGE_SIGNATURE_BYTES } from '../../media/image-file-signature'
import type {
StagedExternalImportEntry,
StagedExternalImportSource
@@ -19,7 +19,7 @@ vi.mock('electron', () => ({
}
}
}))
vi.mock('../app-relaunch', () => ({ relaunchApp: vi.fn() }))
vi.mock('../startup/quit/app-relaunch', () => ({ relaunchApp: vi.fn() }))
vi.mock('../orca-profiles/profile-index-store', () => ({
getOrcaProfileListState: () => ({ activeProfileId: 'source', profiles: [] }),
setActiveOrcaProfile: select,
+1 -1
View File
@@ -46,7 +46,7 @@ vi.mock('../tray/system-tray', () => ({
destroySystemTray: destroySystemTrayMock
}))
vi.mock('../app-relaunch', () => ({
vi.mock('../startup/quit/app-relaunch', () => ({
relaunchApp: relaunchAppMock
}))
+1 -1
View File
@@ -1,6 +1,6 @@
import { ipcMain, type WebContents } from 'electron'
import type { Store } from '../persistence/loading-store/store'
import { relaunchApp, type AppRelaunchReason } from '../app-relaunch'
import { relaunchApp, type AppRelaunchReason } from '../startup/quit/app-relaunch'
import { quitProcess } from '../startup/process-quit-request'
import type {
CreateLocalOrcaProfileArgs,
@@ -93,7 +93,7 @@ import type { RateLimitService } from '../../rate-limits/service'
import type { CodexAccountService } from '../../codex-accounts/service'
import type { ClaudeAccountService } from '../../claude-accounts/service'
import type { AutomationService } from '../../automations/service'
import type { AgentAwakeService } from '../../agent-awake-service'
import type { AgentAwakeService } from '../../power/agent-awake-service'
import type { CrashReportStore } from '../../crash-reporting/crash-report-store'
import type { KeybindingService } from '../../keybindings/keybinding-service'
import type {
@@ -113,7 +113,7 @@ import { ensureStructuredAgentSessionHostUnlessRefused } from '../../runtime/age
import { getAgentSessionAttachmentStore } from '../../native-chat/agent-session-attachments/agent-session-attachment-store-registry'
import type { PluginService } from '../../plugins/plugin-service'
import type { PluginMarketplaceHandlerServices } from '../plugin-marketplaces'
import { settleWithinMs } from '../../quit-teardown-deadline'
import { settleWithinMs } from '../../startup/quit/quit-teardown-deadline'
import { getRuntimeEnvironmentRegistryRoot } from '../runtime-environments/runtime-environment-registry-root'
let registered = false
@@ -51,7 +51,7 @@ vi.mock('../git/repo', () => ({
searchBaseRefs: vi.fn().mockResolvedValue([])
}))
vi.mock('../repo-icon-autodetect', () => ({
vi.mock('../repository-icons/repo-icon-autodetect', () => ({
detectRepoIconAndUpstream: detectRepoIconAndUpstreamMock
}))
@@ -6,7 +6,7 @@ import type { Repo } from '../../../shared/repo-types'
import type { Store } from '../../persistence/loading-store/store'
import { addLocalRepoFromPath } from './local-repo-registration'
vi.mock('../../repo-icon-autodetect', () => ({
vi.mock('../../repository-icons/repo-icon-autodetect', () => ({
detectRepoIconAndUpstream: vi.fn().mockResolvedValue({})
}))
vi.mock('../../worktree-root-preparation', () => ({
@@ -12,7 +12,7 @@ import {
} from '../../git/repo'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { findProjectAtSameRealPath } from '../../project-realpath-identity'
import { detectRepoIconAndUpstream } from '../../repo-icon-autodetect'
import { detectRepoIconAndUpstream } from '../../repository-icons/repo-icon-autodetect'
import { prepareLocalWorktreeRootForRepo } from '../../worktree-root-preparation'
import { describeWslUncAccessDenied } from '../../wsl/wsl-unc-access-denied'
@@ -14,7 +14,7 @@ import {
} from '../../project-groups/nested-repo-import'
import { createNestedRepoImportTargetResolver } from '../../project-groups/nested-repo-import-target'
import { LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { detectRepoIconAndUpstream } from '../../repo-icon-autodetect'
import { detectRepoIconAndUpstream } from '../../repository-icons/repo-icon-autodetect'
import { prepareLocalWorktreeRootForRepo } from '../../worktree-root-preparation'
import { invalidateAuthorizedRootsCache } from '../registered-worktree-roots-cache'
import { emitRepoAdded } from './repo-added-telemetry'
+1 -1
View File
@@ -19,7 +19,7 @@ import {
getClonePathComparisonKey
} from '../../git/repo-clone-path'
import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { detectRepoIconAndUpstream } from '../../repo-icon-autodetect'
import { detectRepoIconAndUpstream } from '../../repository-icons/repo-icon-autodetect'
import { prepareLocalWorktreeRootForRepo } from '../../worktree-root-preparation'
import { invalidateAuthorizedRootsCache } from '../registered-worktree-roots-cache'
import { emitRepoAdded } from './repo-added-telemetry'
+1 -1
View File
@@ -12,7 +12,7 @@ import { LOCAL_EXECUTION_HOST_ID } from '../../../shared/execution-host'
import { getEffectiveHostSetting } from '../../../shared/host-setting-overrides'
import { probeGitAvailability } from '../../git/git-availability'
import { gitExecFileAsync } from '../../git/runner'
import { detectRepoIconAndUpstream } from '../../repo-icon-autodetect'
import { detectRepoIconAndUpstream } from '../../repository-icons/repo-icon-autodetect'
import { prepareLocalWorktreeRootForRepo } from '../../worktree-root-preparation'
import { invalidateAuthorizedRootsCache } from '../registered-worktree-roots-cache'
import { repoCreateFailure, type RepoCreateFailure } from '../../../shared/repo-create-failure-copy'
@@ -43,7 +43,7 @@ vi.mock('../browser/browser-session-proxy', () => ({
vi.mock('../browser/browser-session-registry', () => ({
browserSessionRegistry: { listProfiles: vi.fn(() => []) }
}))
vi.mock('../app-icon', () => ({ applyAppIcon: vi.fn() }))
vi.mock('../window/desktop-integration/app-icon', () => ({ applyAppIcon: vi.fn() }))
vi.mock('../ai-vault-search/session-search-enablement', () => ({
applySessionSearchSettingsChange: vi.fn()
}))
+1 -1
View File
@@ -63,7 +63,7 @@ vi.mock('../browser/browser-session-registry', () => ({
browserSessionRegistry: { listProfiles: listProfilesMock }
}))
vi.mock('../app-icon', () => ({
vi.mock('../window/desktop-integration/app-icon', () => ({
applyAppIcon: applyAppIconMock
}))
+3 -3
View File
@@ -3,14 +3,14 @@ import { app, BrowserWindow, ipcMain, nativeTheme } from 'electron'
import type { Store } from '../persistence/loading-store/store'
import type { GlobalSettings } from '../../shared/global-settings-types'
import type { PersistedState } from '../../shared/persisted-state-types'
import { listSystemFontFamilies } from '../system-fonts'
import { listSystemFontFamilies } from '../window/desktop-integration/system-fonts'
import { registerSettingsImportHandlers } from './settings-import-handlers'
import { setMainUiLanguage } from '../i18n/main-i18n'
import { rebuildAppMenu } from '../menu/register-app-menu'
import { rebuildSystemTrayMenu } from '../tray/system-tray'
import { track } from '../telemetry/client'
import { SETTINGS_CHANGED_WHITELIST, type SettingsChangedKey } from '../../shared/telemetry-events'
import type { AgentAwakeService } from '../agent-awake-service'
import type { AgentAwakeService } from '../power/agent-awake-service'
import { sanitizeFloatingWorkspaceDirectorySetting } from './floating-workspace-directory'
import { applyAgentStatusHooksEnabled } from '../agent-hooks/managed-agent-hook-controls'
import { isAgentStatusHooksEnabledForAgent } from '../../shared/agent-status-hooks-setting'
@@ -22,7 +22,7 @@ import { browserSessionRegistry } from '../browser/browser-session-registry'
import { sanitizeNetworkSettings } from './network-settings-sanitization'
import { normalizeAppIconId } from '../../shared/app-icon'
import { normalizeUiLanguage } from '../../shared/ui-language'
import { applyAppIcon } from '../app-icon'
import { applyAppIcon } from '../window/desktop-integration/app-icon'
import { normalizeTerminalCustomThemes } from '../../shared/terminal-custom-themes'
import { normalizeDesktopTerminalScrollbackRows } from '../../shared/terminal-scrollback-policy'
import { normalizeTerminalLineHeight } from '../../shared/terminal-line-height-settings'
+3 -1
View File
@@ -15,7 +15,9 @@ vi.mock('electron', () => ({
vi.mock('node:child_process', () => ({ spawn: spawnMock }))
vi.mock('../codex-cli/command', () => ({ resolveCliCommand: resolveCliCommandMock }))
vi.mock('../../shared/node-cli-command-resolution', () => ({
resolveCliCommand: resolveCliCommandMock
}))
import { registerShellHandlers } from './shell'
import { fingerprintRuntimeSshTarget } from '../ssh/runtime-ssh-target-fingerprint'
+3 -3
View File
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type * as WindowsPathAccessHost from '../windows-path-access-host'
import type * as ExternalEditorLaunch from '../external-editor-launch'
import type * as ExternalEditorLaunch from '../external-editors/external-editor-launch'
const { handleMock, launchMock, showItemInFolderMock, statMock, recordForEnvironmentMock } =
vi.hoisted(() => ({
@@ -24,7 +24,7 @@ vi.mock('node:fs/promises', () => ({
stat: statMock
}))
vi.mock('../codex-cli/command', () => ({
vi.mock('../../shared/node-cli-command-resolution', () => ({
resolveCliCommand: (command: string) => command
}))
@@ -40,7 +40,7 @@ vi.mock('../windows-path-access-host', async (importOriginal) => {
}
})
vi.mock('../external-editor-launch', async (importOriginal) => {
vi.mock('../external-editors/external-editor-launch', async (importOriginal) => {
const actual = await importOriginal<typeof ExternalEditorLaunch>()
return {
...actual,
+2 -2
View File
@@ -46,11 +46,11 @@ vi.mock('node:child_process', () => ({
spawn: spawnMock
}))
vi.mock('../codex-cli/command', () => ({
vi.mock('../../shared/node-cli-command-resolution', () => ({
resolveCliCommand: resolveCliCommandMock
}))
vi.mock('../win32-utils', () => ({
vi.mock('../../shared/windows-batch-spawn', () => ({
getCmdExePath: () => 'C:\\Windows\\System32\\cmd.exe',
getSpawnArgsForWindows: getSpawnArgsForWindowsMock
}))
+2 -2
View File
@@ -18,8 +18,8 @@ import {
EXTERNAL_EDITOR_CLI_COMMAND,
launchExternalEditor,
resolveExternalEditorLaunchSpec
} from '../external-editor-launch'
import { resolveRemoteSshEditorLaunchSpec } from '../remote-ssh-editor-launch'
} from '../external-editors/external-editor-launch'
import { resolveRemoteSshEditorLaunchSpec } from '../external-editors/remote-ssh-editor-launch'
import { toSshExecutionHostId } from '../../shared/execution-host'
import {
isEditorSshHostForOwner,
+1 -1
View File
@@ -21,7 +21,7 @@ vi.mock('../../managed-server/lifecycle/orcad-managed-tunnel', async (importOrig
import { beginSshShutdown } from './ssh-shutdown-drain'
import type { SshTarget } from '../../../shared/ssh-types'
import { quitTeardownStartGate } from '../../quit-teardown-start-gate'
import { quitTeardownStartGate } from '../../startup/quit/quit-teardown-start-gate'
import { createSshIpcHarness } from './ssh-ipc-test-harness'
const { mockSshStore, mockConnectionManager, mockPortForwardManager } = mocks
@@ -1,5 +1,5 @@
import type { DirectSshAuthority, SshConnectionState } from '../../../shared/ssh-types'
import { quitTeardownStartGate } from '../../quit-teardown-start-gate'
import { quitTeardownStartGate } from '../../startup/quit/quit-teardown-start-gate'
import {
isCurrentSshProviderAuthority,
rotateSshProviderAuthority
+1 -1
View File
@@ -8,7 +8,7 @@ import {
} from './ssh-host-user-disconnect'
import { SshConnectionManager } from '../../ssh/connection/ssh-connection-manager'
import { SshPortForwardManager } from '../../ssh/port-forwarding/ssh-port-forward'
import { quitTeardownStartGate } from '../../quit-teardown-start-gate'
import { quitTeardownStartGate } from '../../startup/quit/quit-teardown-start-gate'
import {
getSshTargetRegistryStore,
setSshConnectionManagerResolver,
@@ -9,7 +9,7 @@ import type {
WslDriveUncConversionRequest,
WslDriveUncConversionResult
} from '../../shared/wsl-drive-unc-conversion-types'
import { relaunchApp } from '../app-relaunch'
import { relaunchApp } from '../startup/quit/app-relaunch'
import { gitExecFileAsync } from '../git/command-runner/git-exec-file'
import { readProfileProjectTransferState } from '../orca-profiles/profile-project-domain-state'
import { getOrcaProfileListState } from '../orca-profiles/profile-index-store'
@@ -3,7 +3,7 @@ import {
findIconHref,
htmlTagAttributes,
normalizeHtmlText
} from '../html-head-tags'
} from '../network/page-metadata/html-head-tags'
const MAX_TITLE_CHARS = 200
const MAX_DESCRIPTION_CHARS = 400
@@ -1,7 +1,7 @@
import { open } from 'node:fs/promises'
import { homedir } from 'node:os'
import { join } from 'node:path'
import type { DeveloperPermissionStatus } from '../shared/developer-permissions-types'
import type { DeveloperPermissionStatus } from '../../shared/developer-permissions-types'
type ReadProbe = (filePath: string) => Promise<void>
@@ -3,7 +3,7 @@ import {
findOrphanedTccLogStreams,
reclaimOrphanedTccLogStreams
} from './macos-tcc-log-stream-orphans'
import { parsePsArgsLine, type ProcessIdentityRow } from './opencode/opencode-client-sweep'
import { parsePsArgsLine, type ProcessIdentityRow } from '../opencode/opencode-client-sweep'
// Captured from `ps -eo pid=,ppid=,etime=,args=` on a Mac holding leaked watchers.
const LEGACY_ARGS =
@@ -4,7 +4,7 @@ import {
splitCommandLineArgv,
sweepProcessIdentities,
type ProcessIdentityRow
} from './opencode/opencode-client-sweep'
} from '../opencode/opencode-client-sweep'
import { LOG_PREDICATE } from './macos-tcc-prompt-watch'
// Match legacy builds that spawned log stream without a lifetime wrapper.
@@ -6,10 +6,10 @@ const readTallyFile = vi.fn()
const watchStart = vi.fn()
const watchStop = vi.fn()
const watchOptions: { onPrompt: () => void }[] = []
vi.mock('./codex-accounts/fs-utils', () => ({
vi.mock('../codex-accounts/fs-utils', () => ({
writeFileAtomically: (...args: unknown[]) => writeFileAtomically(...args)
}))
vi.mock('./persistence/loading-store/user-data-path', () => ({
vi.mock('../persistence/loading-store/user-data-path', () => ({
getCanonicalUserDataPath: () => '/tmp/orca-tcc-notice-test'
}))
vi.mock('./macos-tcc-log-stream-orphans', () => ({
@@ -1,8 +1,8 @@
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { BrowserWindow } from 'electron'
import { writeFileAtomically } from './codex-accounts/fs-utils'
import { getCanonicalUserDataPath } from './persistence/loading-store/user-data-path'
import { writeFileAtomically } from '../codex-accounts/fs-utils'
import { getCanonicalUserDataPath } from '../persistence/loading-store/user-data-path'
import { MacosTccPromptWatch } from './macos-tcc-prompt-watch'
import { reclaimOrphanedTccLogStreams } from './macos-tcc-log-stream-orphans'
+1 -1
View File
@@ -1,5 +1,5 @@
import { setRuntimeBrowserCommandsFactory } from '../runtime/runtime-browser-commands-factory'
import { markHostShuttingDown } from '../host-shutdown-state'
import { markHostShuttingDown } from '../startup/quit/host-shutdown-state'
import { setDesktopBrowserBridgeHostEnabled } from '../runtime/desktop-browser-bridge/desktop-browser-bridge-registry'
import { ORCAD_MANAGED_ACTIVATION_ROOT_ENV } from '../../shared/orcad-managed-launch-env'
import { startOrcadBrowserProvider } from './orcad-browser-startup'
@@ -1,7 +1,10 @@
import { ProfileStateSqliteAuthority } from '../profile-state/profile-state-sqlite-authority'
import { existsSync, readFileSync } from 'node:fs'
import { describe, expect, it, vi } from 'vitest'
import { ActiveViewPreference, getActiveViewPreferenceFile } from '../../active-view-preference'
import {
ActiveViewPreference,
getActiveViewPreferenceFile
} from '../preferences/active-view-preference'
import * as backupWorker from '../profile-state/profile-state-backup-worker'
import { profileStateDatabaseBackups } from '../profile-state/profile-state-backup-path'
import { profileStateJsonExportPaths } from '../profile-state/legacy-json/profile-state-export-path'
@@ -8,7 +8,7 @@ import type {
import type { ExecutionHostId } from '../../../shared/execution-host'
import type { StateWriteListener } from './write-scheduling'
import type { PartitionEditorViews } from './layout-editor-views'
import type { ActiveViewPreference } from '../../active-view-preference'
import type { ActiveViewPreference } from '../preferences/active-view-preference'
import {
getProfileTerminalScrollbackSnapshotRoot,
type TerminalScrollbackSnapshotStorage
+1 -1
View File
@@ -4,7 +4,7 @@ import {
setMigrationUnsupportedPtyPersistenceListener
} from '../../agent-hooks/migration-unsupported-pty-state'
import { agentHookServer } from '../../agent-hooks/server'
import { ActiveViewPreference } from '../../active-view-preference'
import { ActiveViewPreference } from '../preferences/active-view-preference'
import { registerPersistedPaneKeyAlias } from '../restoring-sessions/pane-alias-normalization'
import { normalizePersistedPaneIdentityState } from '../restoring-sessions/workspace-pane-normalization'
import { nameEmptyPersistedTerminalLayoutRoots } from '../restoring-sessions/empty-terminal-layout-root-repair'
@@ -2,7 +2,7 @@ import {
closeTestStores,
createSqliteTestStore,
readPersistedStateJson
} from './persistence/persistence-test-harness'
} from '../persistence-test-harness'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
@@ -20,9 +20,9 @@ vi.mock('electron', () => ({
}
}))
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
vi.mock('./telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn() }))
vi.mock('./ssh/config/ssh-config-parser', () => ({
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
vi.mock('../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn() }))
vi.mock('../../ssh/config/ssh-config-parser', () => ({
loadUserSshConfig: vi.fn(),
sshConfigHostsToTargets: vi.fn()
}))
@@ -41,7 +41,7 @@ describe('active-view persistence boundary', () => {
it('persists a view switch without changing the global durable snapshot', async () => {
vi.useFakeTimers()
vi.resetModules()
const { Store } = await import('./persistence/loading-store/store')
const { Store } = await import('../loading-store/store')
const dataFile = join(testState.dir, 'orca-data.json')
const store = createSqliteTestStore(Store, { dataFile })
store.flush()
@@ -1,8 +1,8 @@
import { mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs'
import { mkdir, rename, rm, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import type { TopLevelView } from '../shared/ui-chrome-types'
import { isTopLevelView } from '../shared/top-level-view'
import type { TopLevelView } from '../../../shared/ui-chrome-types'
import { isTopLevelView } from '../../../shared/top-level-view'
const ACTIVE_VIEW_FILE_NAME = 'active-view.json'
const SAVE_DEBOUNCE_MS = 100
@@ -4,7 +4,7 @@ import {
readDataFile,
testState,
writeDataFile
} from './persistence/persistence-test-harness'
} from '../persistence-test-harness'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import * as crypto from 'node:crypto'
import { mkdtempSync, rmSync } from 'node:fs'
@@ -15,7 +15,7 @@ vi.mock('electron', () => ({
app: { getPath: () => testState.dir },
safeStorage: { isEncryptionAvailable: () => false }
}))
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
vi.mock('node:crypto', async (importOriginal) => ({
...(await importOriginal<typeof crypto>()),
randomInt: vi.fn()
@@ -3,7 +3,7 @@ import {
recordCoalescedDurableCrashBreadcrumb,
recordDurableCrashBreadcrumb
} from '../../crash-reporting/durable-crash-breadcrumb'
import { getSystemPowerState } from '../../system-power-lifecycle'
import { getSystemPowerState } from '../../power/system-power-lifecycle'
import { profileStateWriterFailureOutcome } from './profile-state-writer-errors'
export type ProfileStateWriterDiagnosticRequest = {
@@ -3,13 +3,13 @@ import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { setImmediate as waitForPoll } from 'node:timers/promises'
import { afterEach, expect, it, vi } from 'vitest'
import type * as SystemPowerLifecycle from '../../system-power-lifecycle'
import { publishSystemResume, publishSystemSuspend } from '../../system-power-lifecycle'
import type * as SystemPowerLifecycle from '../../power/system-power-lifecycle'
import { publishSystemResume, publishSystemSuspend } from '../../power/system-power-lifecycle'
import type * as WriterDiagnostics from './profile-state-writer-diagnostics'
import { ProfileStateWriteWorkerClient } from './profile-state-writer-worker-client'
const power = vi.hoisted(() => ({ subscriptions: 0 }))
vi.mock('../../system-power-lifecycle', async (importOriginal) => {
vi.mock('../../power/system-power-lifecycle', async (importOriginal) => {
const actual = await importOriginal<typeof SystemPowerLifecycle>()
return {
...actual,
+1 -1
View File
@@ -1,6 +1,6 @@
import http from 'node:http'
import https from 'node:https'
import { extractHtmlTitle, findIconHref } from '../html-head-tags'
import { extractHtmlTitle, findIconHref } from '../network/page-metadata/html-head-tags'
import {
LOOPBACK_LOCALHOST_HOSTS,
connectableLoopbackHost,
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { AgentAwakeService } from './agent-awake-service'
import type { AgentAwakeStatus } from './agent-awake-service'
import type { AgentAwakeStatus } from './agent-awake-status-lease'
vi.mock('electron', () => ({
powerMonitor: {
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { AgentAwakeService, AGENT_AWAKE_STATUS_STALE_AFTER_MS } from './agent-awake-service'
import type { AgentAwakeStatus } from './agent-awake-service'
import { AgentAwakeService } from './agent-awake-service'
import { AGENT_AWAKE_STATUS_STALE_AFTER_MS } from './agent-awake-status-lease'
import type { AgentAwakeStatus } from './agent-awake-status-lease'
vi.mock('electron', () => ({
powerMonitor: {
@@ -3,16 +3,11 @@ import {
normalizeComputerAwakeMode,
type ComputerAwakeMode,
type ComputerAwakeStatus
} from '../shared/computer-awake-mode'
} from '../../shared/computer-awake-mode'
import { LinuxLidSleepAssertion } from './linux-lid-sleep-assertion'
import { MacosSystemSleepAssertion } from './macos-system-sleep-assertion'
import { AgentAwakeStatusLease, type AgentAwakeStatus } from './agent-awake-status-lease'
export {
AGENT_AWAKE_STATUS_STALE_AFTER_MS,
type AgentAwakeStatus
} from './agent-awake-status-lease'
type PowerSaveBlocker = {
start: (type: 'prevent-app-suspension' | 'prevent-display-sleep') => number
stop: (id: number) => void
@@ -1,4 +1,4 @@
import type { AgentStatusState } from '../shared/agent-status-types'
import type { AgentStatusState } from '../../shared/agent-status-types'
export const AGENT_AWAKE_STATUS_STALE_AFTER_MS = 2 * 60 * 60 * 1000
@@ -2,7 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import {
clearCrashBreadcrumbsForTest,
getCrashBreadcrumbSnapshot
} from './crash-reporting/crash-breadcrumb-store'
} from '../crash-reporting/crash-breadcrumb-store'
import { registerSystemResumeBroadcast } from './system-resume-broadcast'
vi.mock('electron', () => ({
@@ -1,5 +1,5 @@
import { BrowserWindow, powerMonitor } from 'electron'
import { recordCrashBreadcrumb } from './crash-reporting/crash-breadcrumb-store'
import { recordCrashBreadcrumb } from '../crash-reporting/crash-breadcrumb-store'
import { publishSystemResume, publishSystemSuspend } from './system-power-lifecycle'
export const SYSTEM_RESUMED_CHANNEL = 'system:resumed'
+3 -1
View File
@@ -28,7 +28,9 @@ vi.mock('./repo-git-remote-identity', () => ({ probeGitRemoteIdentity: vi.fn() }
vi.mock('./github/client', () => ({
getRepoUpstream: vi.fn(async () => ({ owner: 'acme', repo: 'app' }))
}))
vi.mock('./repo-icon-autodetect', () => ({ detectGitHubAvatarIcon: vi.fn(async () => null) }))
vi.mock('./repository-icons/repo-icon-autodetect', () => ({
detectGitHubAvatarIcon: vi.fn(async () => null)
}))
const MOVING = 'repo-1'
const STAYING = 'repo-2'
@@ -2,7 +2,7 @@ import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
import { afterEach, describe, expect, it } from 'vitest'
import { gitExecFileAsync } from './git/runner'
import { gitExecFileAsync } from '../git/command-runner/git-exec-file'
import { detectRepoIcon, detectRepoIconAndUpstream } from './repo-icon-autodetect'
const PNG_1X1_BASE64 =
@@ -1,21 +1,21 @@
import { readFile, stat } from 'node:fs/promises'
import type { ExecutionHostId } from '../shared/execution-host'
import type { GitHubRepositoryIdentity } from '../shared/github/pull-request-types'
import type { RepoKind } from '../shared/repo-types'
import type { ExecutionHostId } from '../../shared/execution-host'
import type { GitHubRepositoryIdentity } from '../../shared/github/pull-request-types'
import type { RepoKind } from '../../shared/repo-types'
import {
faviconUrlFromWebsite,
githubAvatarIcon,
githubAvatarSlug,
type RepoIcon
} from '../shared/repo-icon'
import { getRepoSlug, getRepoUpstream } from './github/client'
} from '../../shared/repo-icon'
import { getRepoSlug, getRepoUpstream } from '../github/client/fetch/repo-slug-upstream'
import {
resolveFilesystemRouteForHost,
resolveGitRouteForHost
} from './providers/execution-host-provider-dispatch'
import { detectGitRemoteIdentity } from './repo-git-remote-identity'
} from '../providers/execution-host-provider-dispatch'
import { detectGitRemoteIdentity } from '../repo-git-remote-identity'
import { detectRepoFileIcon } from './repo-icon-file-detection'
import { joinWorktreeRelativePath } from './runtime/runtime-relative-paths'
import { joinWorktreeRelativePath } from '../runtime/runtime-relative-paths'
const WEBSITE_HOSTS_TO_SKIP = new Set([
'github.com',
@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'
import { mkdtemp, mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises'
import type * as FsPromisesModule from 'node:fs/promises'
import { describe, expect, it, vi } from 'vitest'
import { resolveFilesystemRouteForHost } from './providers/execution-host-provider-dispatch'
import { resolveFilesystemRouteForHost } from '../providers/execution-host-provider-dispatch'
import { detectRepoFileIcon } from './repo-icon-file-detection'
// Spy on real fs entrypoints so accidental local reads cannot hide behind stubs.
@@ -1,11 +1,11 @@
import { readFile, stat } from 'node:fs/promises'
import { buildImageDataUri } from '../shared/image-data-uri'
import { MAX_REPO_ICON_UPLOAD_BYTES, type RepoIcon } from '../shared/repo-icon'
import type { ExecutionHostFilesystemRoute } from './providers/execution-host-provider-dispatch'
import { detectImageFileSignature } from './image-file-signature'
import { buildImageDataUri } from '../../shared/image-data-uri'
import { MAX_REPO_ICON_UPLOAD_BYTES, type RepoIcon } from '../../shared/repo-icon'
import type { ExecutionHostFilesystemRoute } from '../providers/execution-host-provider-dispatch'
import { detectImageFileSignature } from '../media/image-file-signature'
import { extractIconHref } from './repo-icon-source-href'
import { iconHrefCandidates } from './repo-icon-href-candidates'
import { joinWorktreeRelativePath } from './runtime/runtime-relative-paths'
import { joinWorktreeRelativePath } from '../runtime/runtime-relative-paths'
// Keep add-repo probes limited to conventional paths.
const REPO_ICON_FILE_STEMS = [
@@ -428,6 +428,12 @@ vi.mock('../../source-control/hosted-review', () => ({
}))
}))
vi.mock('../../github/client/fetch/repo-slug-upstream', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
getRepoSlug: getRepoSlugMock,
getRepoUpstream: getRepoUpstreamMock
}))
vi.mock('../../github/client', async (importOriginal) => {
const actual = (await importOriginal()) as Record<string, unknown>
return {
@@ -1,17 +1,22 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../shared/repo-types'
import * as client from '../github/client'
import * as repoSlugUpstream from '../github/client/fetch/repo-slug-upstream'
import { OrcaRuntimeService } from './orca-runtime'
import { repoTarget } from '../persistence/repo-host-target-matcher.test-fixture'
vi.mock('../github/client', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
getRepoUpstream: vi.fn(),
getRepoUpstream: vi.fn()
}))
vi.mock('../github/client/fetch/repo-slug-upstream', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
getRepoSlug: vi.fn()
}))
const getRepoUpstream = vi.mocked(client.getRepoUpstream)
const getRepoSlug = vi.mocked(client.getRepoSlug)
const getRepoSlug = vi.mocked(repoSlugUpstream.getRepoSlug)
type BackfillInternals = { repositoryForkBackfill: { run(): Promise<void> } }
@@ -15,7 +15,7 @@ import type { RpcRequest } from './core'
import { repoDispatcher } from './methods/repo-rpc.test-fixture'
import { UnixSocketTransport } from './unix-socket-transport'
vi.mock('../../repo-icon-autodetect', () => ({
vi.mock('../../repository-icons/repo-icon-autodetect', () => ({
detectRepoIconAndUpstream: vi.fn().mockResolvedValue({})
}))
vi.mock('../../worktree-root-preparation', () => ({
@@ -16,7 +16,7 @@ import { gitSpawnAfterWindowsEnvironmentReady, promptGuardGitEnv } from '../git/
import { reuseSavedCloneTarget } from '../git/saved-clone-target'
import { runWithGitReadCacheInvalidation } from '../git/status'
import { invalidateAuthorizedRootsCache } from '../ipc/registered-worktree-roots-cache'
import { detectRepoIconAndUpstream } from '../repo-icon-autodetect'
import { detectRepoIconAndUpstream } from '../repository-icons/repo-icon-autodetect'
import { getRepoName } from '../git/repo'
import { prepareLocalWorktreeRootForRepo } from '../worktree-root-preparation'
import type { RuntimeStore } from './runtime-store-contract'
@@ -8,7 +8,7 @@ import type { Repo } from '../../shared/repo-types'
import { RuntimeRepositoryCloneController } from './runtime-repository-clone-controller'
import type { RuntimeStore } from './runtime-store-contract'
vi.mock('../repo-icon-autodetect', () => ({
vi.mock('../repository-icons/repo-icon-autodetect', () => ({
detectRepoIconAndUpstream: vi.fn().mockResolvedValue({})
}))
vi.mock('../worktree-root-preparation', () => ({
@@ -6,7 +6,7 @@ import {
import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types'
import type { Repo } from '../../shared/repo-types'
import { getRepoUpstream } from '../github/client'
import { detectGitHubAvatarIcon } from '../repo-icon-autodetect'
import { detectGitHubAvatarIcon } from '../repository-icons/repo-icon-autodetect'
import type { RuntimeStore } from './runtime-store-contract'
import { isWslMoveRepoBlocked } from '../persistence/moving-wsl-projects/wsl-move-background-backoff'
import { blockedWslDistroForPath, wslDistroForPath } from '../wsl/wsl-unc-access-gate'
@@ -8,7 +8,7 @@ import type { Repo } from '../../shared/repo-types'
import { RuntimeRepositoryRegistrationController } from './runtime-repository-registration-controller'
import { partialRuntimeStore } from './runtime-store-partial-fixture'
vi.mock('../repo-icon-autodetect', () => ({
vi.mock('../repository-icons/repo-icon-autodetect', () => ({
detectRepoIconAndUpstream: vi.fn().mockResolvedValue({})
}))
vi.mock('../worktree-root-preparation', () => ({

Some files were not shown because too many files have changed in this diff Show More