mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
refactor(ipc): import worktree, watcher and runtime-environment helpers from their owning modules (#30375)
Removes the re-export lines in worktree-logic, worktree-base-directory-poller, filesystem-watcher and runtime-environment-transport-routing. Test mocks that supplied a re-exported name now mock the module that defines it, so they still reach the code under test.
This commit is contained in:
@@ -26,7 +26,7 @@ vi.mock('../text-generation/commit-message-text-generation', () => ({
|
||||
vi.mock('../text-generation/commit-message-agent-environment', () => ({
|
||||
prepareLocalCommitMessageAgentEnv: vi.fn(async () => ({ ok: true }))
|
||||
}))
|
||||
vi.mock('../ipc/worktree-logic', () => ({
|
||||
vi.mock('../ipc/worktree-branch-name', () => ({
|
||||
computeBranchName: vi.fn((leaf: string) => `you/${leaf}`),
|
||||
getConfiguredBranchPrefix: vi.fn(() => 'you')
|
||||
}))
|
||||
|
||||
@@ -35,7 +35,7 @@ vi.mock('../text-generation/commit-message-text-generation', () => ({
|
||||
vi.mock('../text-generation/commit-message-agent-environment', () => ({
|
||||
prepareLocalCommitMessageAgentEnv: prepareLocalEnvMock
|
||||
}))
|
||||
vi.mock('../ipc/worktree-logic', () => ({
|
||||
vi.mock('../ipc/worktree-branch-name', () => ({
|
||||
computeBranchName: computeBranchNameMock,
|
||||
getConfiguredBranchPrefix: getConfiguredBranchPrefixMock
|
||||
}))
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
stripConfiguredBranchPrefix
|
||||
} from '../../shared/branch-name-from-work'
|
||||
import { getCommitMessageModelDiscoveryHostKey } from '../../shared/commit-message-host-key'
|
||||
import { computeBranchName, getConfiguredBranchPrefix } from '../ipc/worktree-logic'
|
||||
import { computeBranchName, getConfiguredBranchPrefix } from '../ipc/worktree-branch-name'
|
||||
import { gitExecFileAsync } from '../git/runner'
|
||||
import { resolveLocalGitUsername } from '../git/git-username'
|
||||
import { resolveGitRouteForHost } from '../providers/execution-host-provider-dispatch'
|
||||
|
||||
@@ -34,14 +34,16 @@ import {
|
||||
import { getLocalWatcherRoot, getRemoteWatcherKey } from './filesystem-watcher-paths'
|
||||
import { reinstallRemoteWatchersForConnection } from './filesystem-watcher-remote-controller'
|
||||
import { reinstallRemoteWatchersForConnectionCore } from './filesystem-watcher-remote-provider-rearm'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import {
|
||||
registerFilesystemWatcherHandlers,
|
||||
closeAllWatchers,
|
||||
closeLocalWatcherForWorktreePath,
|
||||
restoreLocalWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher-local-removal'
|
||||
import {
|
||||
closeRemoteWatcherForWorktreePath,
|
||||
restoreLocalWatcherAfterFailedRemoval,
|
||||
restoreRemoteWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher'
|
||||
} from './filesystem-watcher-remote-removal'
|
||||
|
||||
const handlers = new Map<string, (event: { sender: Sender }, args: WatchArgs) => Promise<void>>()
|
||||
function invoke(channel: string, sender: Sender, args: WatchArgs): Promise<void> {
|
||||
|
||||
@@ -21,7 +21,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { stat } from 'node:fs/promises'
|
||||
import { subscribe as subscribeParcelWatcher } from '@parcel/watcher'
|
||||
import type { Event as WatcherEvent } from '@parcel/watcher'
|
||||
|
||||
@@ -37,12 +37,12 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import {
|
||||
closeAllWatchers,
|
||||
closeLocalWatcherForWorktreePath,
|
||||
registerFilesystemWatcherHandlers,
|
||||
restoreLocalWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher'
|
||||
} from './filesystem-watcher-local-removal'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { stat } from 'node:fs/promises'
|
||||
import { subscribe as subscribeParcelWatcher } from '@parcel/watcher'
|
||||
import { subscribeViaWatcherProcess } from './parcel-watcher-process'
|
||||
|
||||
@@ -21,7 +21,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import {
|
||||
MAX_PHYSICAL_WATCHER_CHILDREN,
|
||||
reserveWatcherChild,
|
||||
|
||||
@@ -25,7 +25,8 @@ vi.mock('electron', () => ({
|
||||
ipcMain: { handle: handleMock }
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import {
|
||||
createAliasedWatcherRoot,
|
||||
removeAliasedWatcherRoot,
|
||||
|
||||
@@ -22,7 +22,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
type WatchCallback = (events: FsChangeEvent[]) => void
|
||||
|
||||
@@ -18,7 +18,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}))
|
||||
|
||||
import { WATCH_ROOT_CAPACITY_REFUSAL_MESSAGE } from '../../shared/watch-root-capacity-refusal'
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { watcherLifecycleState } from './filesystem-watcher-lifecycle-state'
|
||||
import { getRemoteWatcherKey } from './filesystem-watcher-paths'
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
|
||||
|
||||
@@ -37,11 +37,9 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import {
|
||||
closeAllWatchers,
|
||||
closeLocalWatcherForWorktreePath,
|
||||
registerFilesystemWatcherHandlers
|
||||
} from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { closeLocalWatcherForWorktreePath } from './filesystem-watcher-local-removal'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import {
|
||||
createWatcherRemovalDeadline,
|
||||
drainBeforeWatcherRemoval,
|
||||
|
||||
@@ -20,13 +20,13 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import {
|
||||
closeAllWatchers,
|
||||
closeRemoteWatcherForWorktreePath,
|
||||
forgetRemoteWatcherRemovalSnapshot,
|
||||
registerFilesystemWatcherHandlers,
|
||||
restoreRemoteWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher'
|
||||
} from './filesystem-watcher-remote-removal'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
|
||||
type HandlerMap = Record<string, (_event: unknown, args: unknown) => unknown>
|
||||
type TerminalErrorHandler = (error: Error) => void
|
||||
|
||||
@@ -29,7 +29,8 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
onSshFilesystemProviderRegistered: () => () => {}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers, registerFilesystemWatcherHandlers } from './filesystem-watcher'
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { stat } from 'node:fs/promises'
|
||||
import { watcherLifecycleState } from './filesystem-watcher-lifecycle-state'
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ vi.mock('../providers/ssh-filesystem-dispatch', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
import {
|
||||
closeAllWatchers,
|
||||
closeRemoteWatcherForWorktreePath,
|
||||
forgetRemoteWatcherRemovalSnapshot,
|
||||
registerFilesystemWatcherHandlers,
|
||||
restoreRemoteWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher'
|
||||
} from './filesystem-watcher-remote-removal'
|
||||
import { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
import { stat } from 'node:fs/promises'
|
||||
import { subscribe as subscribeParcelWatcher } from '@parcel/watcher'
|
||||
import { createWslWatcher } from './filesystem-watcher-wsl'
|
||||
|
||||
@@ -10,15 +10,6 @@ import {
|
||||
restoreRemoteWatcherAfterFailedRemoval
|
||||
} from './filesystem-watcher-remote-removal'
|
||||
|
||||
export { closeLocalWatcherForWorktreePath } from './filesystem-watcher-local-removal'
|
||||
export { restoreLocalWatcherAfterFailedRemoval } from './filesystem-watcher-local-removal'
|
||||
export { forgetLocalWatcherRemovalSnapshot } from './filesystem-watcher-local-removal'
|
||||
export { closeRemoteWatcherForWorktreePath } from './filesystem-watcher-remote-removal'
|
||||
export { restoreRemoteWatcherAfterFailedRemoval } from './filesystem-watcher-remote-removal'
|
||||
export { forgetRemoteWatcherRemovalSnapshot } from './filesystem-watcher-remote-removal'
|
||||
export { registerFilesystemWatcherHandlers } from './filesystem-watcher-handlers'
|
||||
export { closeAllWatchers } from './filesystem-watcher-shutdown'
|
||||
|
||||
// ── Public API ───────────────────────────────────────────────────────
|
||||
|
||||
/** The desktop binding for {@link WorktreeWatcherRemoval}. Installed during startup. */
|
||||
|
||||
@@ -23,8 +23,11 @@ vi.mock('./registered-worktree-roots-cache', () => ({
|
||||
}))
|
||||
vi.mock('./repos/repos-changed-notification', () => ({ notifyReposChanged: fake.reposChanged }))
|
||||
vi.mock('./worktree-remote', () => ({ notifyWorktreesChanged: fake.worktreesChanged }))
|
||||
vi.mock('./worktree-base-directory-marker-poller', async (importOriginal) => ({
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
WORKTREE_BASE_BACKSTOP_TICKS: 15
|
||||
}))
|
||||
vi.mock('./worktree-base-directory-poller', () => ({
|
||||
WORKTREE_BASE_BACKSTOP_TICKS: 15,
|
||||
WORKTREE_BASE_POLL_INTERVAL_MS: 2000,
|
||||
createWorktreePollerWindowVisibility: () => ({
|
||||
isWindowVisible: () => true,
|
||||
|
||||
@@ -16,10 +16,10 @@ import { notifyWorktreesChanged } from './worktree-remote'
|
||||
import { setFolderRepoGitUpgradeWakeListener } from './folder-repo-git-upgrade-wake'
|
||||
import {
|
||||
createWorktreePollerWindowVisibility,
|
||||
WORKTREE_BASE_BACKSTOP_TICKS,
|
||||
WORKTREE_BASE_POLL_INTERVAL_MS,
|
||||
type WorktreePollerWindowVisibility
|
||||
} from './worktree-base-directory-poller'
|
||||
import { WORKTREE_BASE_BACKSTOP_TICKS } from './worktree-base-directory-marker-poller'
|
||||
|
||||
// Why: with no folder project registered there is nothing to stat, so back off until
|
||||
// the next catalog mutation wakes the fast cadence.
|
||||
|
||||
@@ -300,7 +300,7 @@ vi.mock('../filesystem', () => ({
|
||||
registerFilesystemHandlers: registerFilesystemHandlersMock
|
||||
}))
|
||||
|
||||
vi.mock('../filesystem-watcher', () => ({
|
||||
vi.mock('../filesystem-watcher-handlers', () => ({
|
||||
registerFilesystemWatcherHandlers: registerFilesystemWatcherHandlersMock
|
||||
}))
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { OrcaRuntimeService } from '../../runtime/orca-runtime'
|
||||
import type { StatsCollector } from '../../stats/collector'
|
||||
import { registerFilesystemHandlers } from '../filesystem'
|
||||
import type { CommitMessageAgentEnvironmentResolvers } from '../../text-generation/commit-message-agent-environment'
|
||||
import { registerFilesystemWatcherHandlers } from '../filesystem-watcher'
|
||||
import { registerFilesystemWatcherHandlers } from '../filesystem-watcher-handlers'
|
||||
import { registerUsageProviderHandlers } from '../usage-provider-handlers'
|
||||
import { registerGitHubHandlers } from '../github'
|
||||
import { registerGitLabHandlers } from '../gitlab'
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ vi.mock('electron', () => ({ ipcMain: { handle: handleMock } }))
|
||||
vi.mock('../../../shared/runtime-environment-store', () => ({
|
||||
resolveEnvironment: resolveEnvironmentMock
|
||||
}))
|
||||
vi.mock('./runtime-environment-transport-routing', () => ({
|
||||
vi.mock('./runtime-environment-status-probe', () => ({
|
||||
getRuntimeEnvironmentStatus: getRuntimeEnvironmentStatusMock
|
||||
}))
|
||||
vi.mock('../../browser/paired-runtime-browser-client-host-runtime', () => ({
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import {
|
||||
} from '../../browser/paired-runtime-browser-client-host-runtime'
|
||||
import { prepareBrowserClientHostPlacement } from '../../browser/browser-client-host-placement-preparation'
|
||||
import { isRuntimeEnvironmentManuallyDisconnected } from './runtime-environment-connectivity-handlers'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
|
||||
export function registerRuntimeEnvironmentBrowserClientHostHandler(options: {
|
||||
getUserDataPath: () => string
|
||||
|
||||
@@ -32,10 +32,8 @@ import {
|
||||
isRuntimeEnvironmentManuallyDisconnected,
|
||||
RUNTIME_MANUALLY_DISCONNECTED_MESSAGE
|
||||
} from './runtime-environment-manual-disconnect'
|
||||
import {
|
||||
callRuntimeEnvironment,
|
||||
getRuntimeEnvironmentStatus
|
||||
} from './runtime-environment-transport-routing'
|
||||
import { callRuntimeEnvironment } from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
import { publicRuntimeEnvironmentWithHostKey } from './runtime-environment-host-key'
|
||||
import { withWslOrcadAccountEnv } from '../../wsl/wsl-orcad-account-env'
|
||||
import { clearSshCredentialDeclinedForEnvironment } from '../../ssh/ssh-credential-decline'
|
||||
|
||||
+2
-4
@@ -32,10 +32,8 @@ vi.mock('./runtime-environment-request-connections', async () => {
|
||||
})
|
||||
})
|
||||
|
||||
import {
|
||||
callRuntimeEnvironment,
|
||||
resetSharedControlSupport
|
||||
} from './runtime-environment-transport-routing'
|
||||
import { callRuntimeEnvironment } from './runtime-environment-transport-routing'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
|
||||
describe('federated read RPC transport routing', () => {
|
||||
let userDataPath: string
|
||||
|
||||
@@ -33,8 +33,8 @@ vi.mock('./runtime-environment-request-connections', async (importOriginal) => (
|
||||
...(await importOriginal<Record<string, unknown>>()),
|
||||
closeRemoteRuntimeRequestConnection: mocks.closeRequest
|
||||
}))
|
||||
vi.mock('./runtime-environment-transport-routing', () => ({
|
||||
callRuntimeEnvironment: vi.fn(),
|
||||
vi.mock('./runtime-environment-transport-routing', () => ({ callRuntimeEnvironment: vi.fn() }))
|
||||
vi.mock('./runtime-environment-status-probe', () => ({
|
||||
getRuntimeEnvironmentStatus: mocks.getStatus
|
||||
}))
|
||||
vi.mock('../../ssh/ssh-credential-decline', () => ({
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ vi.mock('./runtime-environment-host-service-ops', () => ({
|
||||
connectThroughOwningService: vi.fn(async () => {}),
|
||||
removeThroughOwningService: vi.fn()
|
||||
}))
|
||||
vi.mock('./runtime-environment-transport-routing', () => ({
|
||||
callRuntimeEnvironment: vi.fn(),
|
||||
vi.mock('./runtime-environment-transport-routing', () => ({ callRuntimeEnvironment: vi.fn() }))
|
||||
vi.mock('./runtime-environment-status-probe', () => ({
|
||||
getRuntimeEnvironmentStatus: vi.fn(async () => ({ ok: true }))
|
||||
}))
|
||||
vi.mock('../ssh/ssh-session-teardown', () => ({ disconnectRegisteredSshTarget: hoisted.teardown }))
|
||||
|
||||
+2
-4
@@ -14,10 +14,8 @@ import { getPreferredPairedRuntimeConnection } from '../../../shared/runtime-env
|
||||
import { OrcaRuntimeService } from '../../runtime/orca-runtime'
|
||||
import { OrcaRuntimeRpcServer } from '../../runtime/runtime-rpc'
|
||||
import { makeStore, SESSION_WORKTREE_ID } from '../../runtime/paired-client-navigation-test-harness'
|
||||
import {
|
||||
resetSharedControlSupport,
|
||||
subscribeRuntimeEnvironment
|
||||
} from './runtime-environment-transport-routing'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
import { subscribeRuntimeEnvironment } from './runtime-environment-transport-routing'
|
||||
|
||||
vi.mock('electron', () => ({ BrowserWindow: { getAllWindows: () => [] } }))
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
createSharedControlTestServer,
|
||||
closeSharedControlTestServers
|
||||
} from '../../../shared/remote-runtime-shared-control-test-server'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
import {
|
||||
getRuntimeEnvironmentStatusOwner,
|
||||
resetRuntimeEnvironmentStatusOwners
|
||||
|
||||
@@ -5,10 +5,8 @@ import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { addEnvironmentFromPairingCode } from '../../../shared/runtime-environment-store'
|
||||
import { pairingCode } from './runtime-environments-ipc-test-harness'
|
||||
import {
|
||||
getRuntimeEnvironmentStatus,
|
||||
resetSharedControlSupport
|
||||
} from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
|
||||
const { request, publish } = vi.hoisted(() => ({ request: vi.fn(), publish: vi.fn() }))
|
||||
vi.mock('../../../shared/remote-runtime-client', () => ({
|
||||
|
||||
@@ -34,7 +34,7 @@ vi.mock('./runtime-environment-request-connections', async () => {
|
||||
})
|
||||
vi.mock('electron', () => ({ BrowserWindow: { getAllWindows: () => [] } }))
|
||||
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
import { resetRuntimeEnvironmentStatusOwners } from './runtime-environment-request-connections'
|
||||
|
||||
let directory: string
|
||||
|
||||
+3
-3
@@ -7,10 +7,10 @@ import { encodePairingOffer, type PairingOffer } from '../../../shared/pairing'
|
||||
import { addEnvironmentFromPairingCode } from '../../../shared/runtime-environment-store'
|
||||
import {
|
||||
callRuntimeEnvironment,
|
||||
getRuntimeEnvironmentStatus,
|
||||
subscribeRuntimeEnvironment,
|
||||
resetSharedControlSupport
|
||||
subscribeRuntimeEnvironment
|
||||
} from './runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
|
||||
// Why: prove the wiring, not just the helper — an unreachable endpoint exercises
|
||||
// the real WebSocket failure → reject → Tailscale-hint join points the settings
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
sendRemoteRuntimeRequestAbortable
|
||||
} from './runtime-environment-abortable-requests'
|
||||
import { runtimeEnvironmentRevisionFailure } from './runtime-environment-revision-guard'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
import {
|
||||
executeSupportRoutedCall,
|
||||
shouldUseSharedControlEnvelope,
|
||||
@@ -31,10 +30,6 @@ import {
|
||||
|
||||
const DEFAULT_REMOTE_RUNTIME_TIMEOUT_MS = 15_000
|
||||
|
||||
export { resetSharedControlSupport }
|
||||
|
||||
export { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe'
|
||||
|
||||
export async function callRuntimeEnvironment(
|
||||
userDataPath: string,
|
||||
selector: string,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import { registerRuntimeEnvironmentRecoveryHandler } from './runtime-environment-recovery-handler'
|
||||
import { registerRuntimeEnvironmentRepairHandler } from './runtime-environment-repair-handler'
|
||||
import { advanceRuntimeEnvironmentTransportGeneration } from './runtime-environment-transport-generation'
|
||||
import { resetSharedControlSupport } from './runtime-environment-transport-routing'
|
||||
import { resetSharedControlSupport } from './runtime-environment-shared-control-support'
|
||||
import { RUNTIME_ENVIRONMENT_HANDLER_CHANNELS } from './runtime-environment-handler-channels'
|
||||
import { registerOrcadRuntimeLifecycleHandlers } from './orcad-runtime-lifecycle-handlers'
|
||||
import { registerOrcadRuntimeConversionHandlers } from './orcad-runtime-conversion-handlers'
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
FOLDER_WORKSPACE_INSTANCE_SEPARATOR,
|
||||
getRepoMainWorktreeId
|
||||
} from '../../shared/worktree/id'
|
||||
import { mergeWorktree } from './worktree-logic'
|
||||
import { mergeWorktree } from './worktree-metadata-merge'
|
||||
import { getRepoOwnedWorktreeMeta } from '../worktree-metadata-ownership'
|
||||
|
||||
export function listWorkspaceCleanupFolderWorkspaces(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { isFolderRepo } from '../../shared/repo-kind'
|
||||
import { readWorktreeMetaForHost } from '../persistence/host-qualified-worktree-meta'
|
||||
import type { Repo } from '../../shared/repo-types'
|
||||
import type { GitWorktreeInfo, Worktree } from '../../shared/worktree/types'
|
||||
import { mergeWorktree } from './worktree-logic'
|
||||
import { mergeWorktree } from './worktree-metadata-merge'
|
||||
import type {
|
||||
WorkspaceCleanupCandidate,
|
||||
WorkspaceCleanupScanArgs,
|
||||
|
||||
@@ -6,10 +6,10 @@ import { join } from 'node:path'
|
||||
import {
|
||||
createWorktreePollerWindowVisibility,
|
||||
startWorktreeBaseDirectoryPoller,
|
||||
WORKTREE_BASE_BACKSTOP_TICKS,
|
||||
type WorktreeBasePollEvent,
|
||||
type WorktreePollerWindowVisibility
|
||||
} from './worktree-base-directory-poller'
|
||||
import { WORKTREE_BASE_BACKSTOP_TICKS } from './worktree-base-directory-marker-poller'
|
||||
import { startGitCommonPrimaryPolling } from './worktree-git-common-primary-polling'
|
||||
import type {
|
||||
WorktreeBaseRepoWatchConfig,
|
||||
|
||||
@@ -6,8 +6,6 @@ import type {
|
||||
import { startBasePoller } from './worktree-base-directory-marker-poller'
|
||||
import { startGitCommonWatch } from './worktree-git-common-watch'
|
||||
|
||||
export { WORKTREE_BASE_BACKSTOP_TICKS } from './worktree-base-directory-marker-poller'
|
||||
|
||||
export type WorktreeBasePollEvent = { type: 'create' | 'update' | 'delete'; path: string }
|
||||
|
||||
export type WorktreeBaseSubscription = { unsubscribe: () => Promise<void> }
|
||||
|
||||
@@ -2,27 +2,31 @@ import { posix, resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
sanitizeWorktreeName,
|
||||
sanitizeWorktreeDisplayName,
|
||||
resolveWorktreeCreateDisplayName,
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
resolveWorktreeCreateDisplayNameMeta,
|
||||
ensurePathWithinWorkspace,
|
||||
computeBranchName,
|
||||
getConfiguredBranchPrefix,
|
||||
computeValidatedBranchName,
|
||||
computeWorktreePath,
|
||||
computeRemoteWorktreePath,
|
||||
computeWorkspaceRoot,
|
||||
getWorktreeCreationLayout,
|
||||
getWorktreePathSettings,
|
||||
shouldSetDisplayName,
|
||||
mergeWorktree,
|
||||
parseWorktreeId,
|
||||
formatWorktreeRemovalError,
|
||||
isWindowsLongPathWorktreeRemovalError,
|
||||
isOrphanCompatiblePreflightError,
|
||||
isOrphanedWorktreeError
|
||||
} from './worktree-logic'
|
||||
import {
|
||||
sanitizeWorktreeDisplayName,
|
||||
resolveWorktreeCreateDisplayName,
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
resolveWorktreeCreateDisplayNameMeta,
|
||||
shouldSetDisplayName
|
||||
} from './worktree-display-name'
|
||||
import {
|
||||
computeBranchName,
|
||||
getConfiguredBranchPrefix,
|
||||
computeValidatedBranchName
|
||||
} from './worktree-branch-name'
|
||||
import { mergeWorktree } from './worktree-metadata-merge'
|
||||
import { areWorktreePathsEqual } from '../git/worktree-path-comparison'
|
||||
|
||||
describe('sanitizeWorktreeName', () => {
|
||||
|
||||
@@ -21,13 +21,6 @@ type WorktreePathSettings = Pick<GlobalSettings, 'nestWorkspaces' | 'workspaceDi
|
||||
}
|
||||
type WorktreeBasePathRepo = Pick<Repo, 'path' | 'worktreeBasePath'>
|
||||
|
||||
export {
|
||||
computeBranchName,
|
||||
getConfiguredBranchPrefix,
|
||||
computeValidatedBranchName
|
||||
} from './worktree-branch-name'
|
||||
export { mergeWorktree } from './worktree-metadata-merge'
|
||||
|
||||
/**
|
||||
* Sanitize a worktree name for use in branch names and directory paths.
|
||||
* Strips unsafe characters and collapses runs of special chars to a single hyphen.
|
||||
@@ -66,14 +59,6 @@ function containsEmoji(input: string): boolean {
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
resolveWorktreeCreateDisplayName,
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
resolveWorktreeCreateDisplayNameMeta,
|
||||
sanitizeWorktreeDisplayName,
|
||||
shouldSetDisplayName
|
||||
} from './worktree-display-name'
|
||||
|
||||
/**
|
||||
* Ensure a target path is within the workspace directory (prevent path traversal).
|
||||
*/
|
||||
|
||||
@@ -63,16 +63,18 @@ type CreateWorktreeArgsWithSystemProvenance = CreateWorktreeArgs & {
|
||||
}
|
||||
import {
|
||||
sanitizeWorktreeName,
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
resolveWorktreeCreateDisplayNameMeta,
|
||||
computeValidatedBranchName,
|
||||
computeWorktreePath,
|
||||
computeWorkspaceRootAsync,
|
||||
ensurePathWithinWorkspace,
|
||||
getWorktreeCreationLayout,
|
||||
getWorktreePathSettings,
|
||||
mergeWorktree
|
||||
getWorktreePathSettings
|
||||
} from './worktree-logic'
|
||||
import {
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
resolveWorktreeCreateDisplayNameMeta
|
||||
} from './worktree-display-name'
|
||||
import { computeValidatedBranchName } from './worktree-branch-name'
|
||||
import { mergeWorktree } from './worktree-metadata-merge'
|
||||
import { resolveCreatedWorktree } from './created-worktree-reconciliation'
|
||||
import { notifyLineageRepos } from '../worktree-lineage-change-notification'
|
||||
import { getRepoIdFromWorktreeId } from '../../shared/worktree/id'
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { CreateWorktreeResult } from '../../../../shared/worktree/create-ty
|
||||
import type { Store } from '../../../persistence/loading-store/store'
|
||||
import type { CreateWorktreeArgsWithSystemProvenance } from '../ipc-context-schemas'
|
||||
import { getFolderWorkspaceInstanceId, mergeFolderWorkspace } from '../folder-workspace-model'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../../worktree-logic'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../../worktree-display-name'
|
||||
|
||||
export function createFolderWorkspace(
|
||||
args: CreateWorktreeArgsWithSystemProvenance,
|
||||
|
||||
@@ -31,7 +31,7 @@ vi.mock('node:crypto', async (importOriginal) => ({
|
||||
const { buildDetectedGitWorktrees } = await import('./ssh-worktree-fallback')
|
||||
const { getProjectHostSetupWorktreeMeta } =
|
||||
await import('../../../../shared/project-host-setup-lookup')
|
||||
const { mergeWorktree } = await import('../../worktree-logic')
|
||||
const { mergeWorktree } = await import('../../worktree-metadata-merge')
|
||||
const { resolveWorktreeMetaWithDiscoveryBackfill } = await import('./worktree-discovery-metadata')
|
||||
const ownership = await import('../../../../shared/worktree/ownership')
|
||||
const { projectResolvedWorktreeLineage } =
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { preserveFolderUpgradeWorktreePath } from '../../../folder-upgrade-worktree-path'
|
||||
import type { WorktreeMeta } from '../../../../shared/worktree/meta-types'
|
||||
import { parseWorktreeId, mergeWorktree } from '../../worktree-logic'
|
||||
import { parseWorktreeId } from '../../worktree-logic'
|
||||
import { mergeWorktree } from '../../worktree-metadata-merge'
|
||||
import {
|
||||
getRepoIdFromWorktreeId,
|
||||
getWorktreePathBasenameFromId
|
||||
|
||||
@@ -9,11 +9,11 @@ import type { AutomationWorkspaceProvenance, GitWorktreeInfo } from '../shared/w
|
||||
import { normalizeRuntimePathForComparison } from '../shared/cross-platform-path'
|
||||
import { getProjectHostSetupWorktreeMeta } from '../shared/project-host-setup-lookup'
|
||||
import { isTuiAgent } from '../shared/tui-agent-config'
|
||||
import { getWorktreeCreationLayout } from './ipc/worktree-logic'
|
||||
import {
|
||||
getWorktreeCreationLayout,
|
||||
resolveWorktreeCreateDisplayNameMeta,
|
||||
resolveWorktreeCreateDisplayNameRequest
|
||||
} from './ipc/worktree-logic'
|
||||
} from './ipc/worktree-display-name'
|
||||
|
||||
export type ProvisionedRootRequest = Pick<
|
||||
CreateWorktreeArgs,
|
||||
|
||||
@@ -24,7 +24,7 @@ import type { ProjectExecutionRuntimeResolution } from '../../shared/project-exe
|
||||
import type { RuntimeStore } from './runtime-store-contract'
|
||||
|
||||
import { areWorktreePathsEqual } from '../git/worktree-path-comparison'
|
||||
import { mergeWorktree } from '../ipc/worktree-logic'
|
||||
import { mergeWorktree } from '../ipc/worktree-metadata-merge'
|
||||
import { pruneLineageForMissingRepoWorktrees } from '../worktree-lineage-pruning'
|
||||
import { getRepoOwnedWorktreeMeta } from '../worktree-metadata-ownership'
|
||||
import { resolveLocalProjectRuntimesForRepos } from '../project-runtime-git-options'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { paneIdentity } from './runtime-terminal-pane-identity'
|
||||
import { shouldSeedWorktreePrimaryTerminal } from '../../shared/worktree-first-surface'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { getProjectHostSetupWorktreeMeta } from '../../shared/project-host-setup-lookup'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../ipc/worktree-logic'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../ipc/worktree-display-name'
|
||||
import type { RuntimeTerminalCreate } from '../../shared/runtime-types'
|
||||
import type { CreateWorktreeResult } from '../../shared/worktree/create-types'
|
||||
import type { Repo } from '../../shared/repo-types'
|
||||
|
||||
@@ -5,10 +5,10 @@ import type { getPRForBranch } from '../github/client'
|
||||
import {
|
||||
computeWorktreePath,
|
||||
ensurePathWithinWorkspace,
|
||||
resolveWorktreeCreateDisplayNameRequest,
|
||||
sanitizeWorktreeName,
|
||||
type getWorktreePathSettings
|
||||
} from '../ipc/worktree-logic'
|
||||
import { resolveWorktreeCreateDisplayNameRequest } from '../ipc/worktree-display-name'
|
||||
import { getBranchConflictKind } from '../git/repo'
|
||||
import {
|
||||
getBranchNameOverrideCandidate,
|
||||
|
||||
@@ -8,11 +8,9 @@ import type { CreateWorktreeArgs } from '../../shared/worktree/create-types'
|
||||
import type { TuiAgent } from '../../shared/tui-agent'
|
||||
import { resolveWorktreeIncludePaths } from '../git/worktree-include-file'
|
||||
import { formatWorktreeIncludeCopyWarning } from '../ipc/worktree-include-copy-budget'
|
||||
import {
|
||||
getWorktreeCreationLayout,
|
||||
mergeWorktree,
|
||||
resolveWorktreeCreateDisplayNameMeta
|
||||
} from '../ipc/worktree-logic'
|
||||
import { getWorktreeCreationLayout } from '../ipc/worktree-logic'
|
||||
import { mergeWorktree } from '../ipc/worktree-metadata-merge'
|
||||
import { resolveWorktreeCreateDisplayNameMeta } from '../ipc/worktree-display-name'
|
||||
import {
|
||||
createWorktreeCopiedPaths,
|
||||
createWorktreeLinkedPaths,
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
resolveCustomWorktreeVisibilitySources,
|
||||
type WorktreeVisibilitySourceMatcher
|
||||
} from '../../shared/worktree/visibility-sources'
|
||||
import { mergeWorktree } from '../ipc/worktree-logic'
|
||||
import { mergeWorktree } from '../ipc/worktree-metadata-merge'
|
||||
import { pruneLineageForMissingRepoWorktrees } from '../worktree-lineage-pruning'
|
||||
import { pruneMetadataMissingFromAuthoritativeLocalScan } from '../ipc/worktrees/listing/authoritative-local-worktree-metadata-pruning'
|
||||
import type { Store } from '../persistence'
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getPRForBranch } from '../github/client'
|
||||
import type { GitAdmissionTier } from '../../shared/rpc-contract/git-admission-tier-params'
|
||||
import { gitExecFileAsync } from '../git/runner'
|
||||
import { listWorktrees } from '../git/worktree'
|
||||
import { computeValidatedBranchName } from '../ipc/worktree-logic'
|
||||
import { computeValidatedBranchName } from '../ipc/worktree-branch-name'
|
||||
import { getHostedReviewForBranch } from '../source-control/hosted-review'
|
||||
import {
|
||||
getSelectedReviewBranch,
|
||||
|
||||
@@ -15,7 +15,7 @@ import type { Repo } from '../../../shared/repo-types'
|
||||
import type { RuntimeStore } from '../runtime-store-contract'
|
||||
import type { RuntimeWorkspaceCatalog } from './workspace-catalog'
|
||||
import { areWorktreePathsEqual } from '../../git/worktree-path-comparison'
|
||||
import { mergeWorktree } from '../../ipc/worktree-logic'
|
||||
import { mergeWorktree } from '../../ipc/worktree-metadata-merge'
|
||||
|
||||
export abstract class RuntimeWorkspaceSelectors extends OrcaRuntimeWithResolveBrowserNetworkExecutionHostForWorktree {
|
||||
protected abstract hasFreshResolvedWorktreeCache(
|
||||
|
||||
@@ -11,7 +11,7 @@ const mocks = vi.hoisted(() => ({
|
||||
vi.mock('electron', () => ({
|
||||
app: { getPath: () => '/state', isPackaged: true }
|
||||
}))
|
||||
vi.mock('../ipc/runtime-environments/runtime-environment-transport-routing', () => ({
|
||||
vi.mock('../ipc/runtime-environments/runtime-environment-status-probe', () => ({
|
||||
getRuntimeEnvironmentStatus: mocks.getRuntimeEnvironmentStatus
|
||||
}))
|
||||
vi.mock('./skill-remote-install-service', () => ({
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
SkillInstallRequest
|
||||
} from '../../shared/skill-install-contract'
|
||||
import type { SkillCloudDownloadGrant } from '../../shared/skill-cloud-contract'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-status-probe'
|
||||
import type { OrcaRuntimeService } from '../runtime/orca-runtime'
|
||||
import { skillInstallFailureFromError } from './skill-install-operation-error'
|
||||
import { recordSkillCapabilityAbsence } from './skill-operation-observability'
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-status-probe'
|
||||
import {
|
||||
supportsSkillRuntimeCancellation,
|
||||
supportsSkillRuntimeInstall,
|
||||
supportsSkillRuntimeManagement
|
||||
} from './skill-runtime-capability'
|
||||
|
||||
vi.mock('../ipc/runtime-environments/runtime-environment-transport-routing', () => ({
|
||||
vi.mock('../ipc/runtime-environments/runtime-environment-status-probe', () => ({
|
||||
getRuntimeEnvironmentStatus: vi.fn()
|
||||
}))
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
SKILL_INSTALL_CAPABILITY,
|
||||
SKILL_MANAGEMENT_CAPABILITY
|
||||
} from '../../shared/skill-install-capability'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-transport-routing'
|
||||
import { getRuntimeEnvironmentStatus } from '../ipc/runtime-environments/runtime-environment-status-probe'
|
||||
|
||||
export async function supportsSkillRuntimeManagement(
|
||||
userDataPath: string,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { app, type Event } from 'electron'
|
||||
import { closeAllWatchers } from '../ipc/filesystem-watcher'
|
||||
import { closeAllWatchers } from '../ipc/filesystem-watcher-shutdown'
|
||||
import { disposeWorktreeBaseDirectoryWatchers } from '../ipc/worktree-base-directory-watcher'
|
||||
import { stopFolderRepoGitUpgradeWatch } from '../ipc/folder-repo-git-upgrade'
|
||||
import { killAllPty } from '../ipc/pty/kill-all'
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
resolveGitRouteForHost
|
||||
} from './providers/execution-host-provider-dispatch'
|
||||
import { createFolderWorktree, listRepoWorktrees } from './repo-worktrees'
|
||||
import { mergeWorktree } from './ipc/worktree-logic'
|
||||
import { mergeWorktree } from './ipc/worktree-metadata-merge'
|
||||
import { getLocalProjectWorktreeGitOptions } from './project-runtime-git-options'
|
||||
import {
|
||||
WorkspaceSpaceScanCancelledError,
|
||||
|
||||
Reference in New Issue
Block a user