From 7a9170cf77982e6ac5e1bcc716a46fbed288fccf Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 18 Oct 2026 15:41:29 -0700 Subject: [PATCH] refactor(main): import filesystem-auth, markdown-documents and preflight seams from their defining modules (#30440) The three ipc modules re-exported symbols owned elsewhere. Importers and test mocks now name the defining module, and the re-export lines are gone (no barrels). --- src/main/ipc/app.ts | 5 ++++- src/main/ipc/bitbucket.ts | 2 +- src/main/ipc/filesystem-auth.ts | 6 ------ ...ilesystem-content-search-cancellation.test.ts | 3 +-- .../ipc/filesystem-search-rg-timeout.test.ts | 3 +-- .../jira-project-metadata-registration.test.ts | 2 +- src/main/ipc/jira.ts | 2 +- src/main/ipc/linear.test.ts | 2 +- src/main/ipc/linear.ts | 2 +- .../ipc/markdown-documents-remote-paths.test.ts | 5 ++++- src/main/ipc/markdown-documents.test.ts | 2 +- src/main/ipc/markdown-documents.ts | 1 - ...eflight-agent-detection-no-subprocess.test.ts | 2 +- src/main/ipc/preflight-agent-detection.test.ts | 6 +++--- src/main/ipc/preflight-host-cli-status.test.ts | 3 ++- src/main/ipc/preflight-test-harness.ts | 2 +- src/main/ipc/preflight.ts | 4 ---- src/main/ipc/worktrees-removal-recovery.test.ts | 16 ++++++++-------- src/main/ipc/worktrees-remove-preflight.test.ts | 8 ++++---- .../removal/remove-registered-local-worktree.ts | 2 +- .../managed-worktree-create-registry.test.ts | 6 ++++-- .../managed-worktree-create-telemetry.test.ts | 6 ++++-- .../orca-runtime-test-mocks/setup.spec.ts | 11 +++++------ .../runtime-local-create-rearm-ordering.test.ts | 6 ++++-- .../runtime-project-host-setup-controller.ts | 2 +- .../runtime-repository-clone-controller.ts | 2 +- .../runtime/runtime-repository-hooks-commands.ts | 2 +- ...runtime-repository-registration-controller.ts | 3 ++- .../runtime-repository-settings-controller.ts | 2 +- src/main/runtime/runtime-worktree-filesystem.ts | 2 +- .../runtime/workspaces/workspace-creation.ts | 2 +- .../workspaces/workspace-registration-removal.ts | 2 +- .../workspaces/workspace-removal-target.ts | 2 +- .../startup/os-opened-document-arguments.test.ts | 2 +- src/main/startup/os-opened-documents.ts | 5 ++++- 35 files changed, 68 insertions(+), 65 deletions(-) diff --git a/src/main/ipc/app.ts b/src/main/ipc/app.ts index d63cd41612a..ee7e9afbdad 100644 --- a/src/main/ipc/app.ts +++ b/src/main/ipc/app.ts @@ -21,7 +21,10 @@ import { trustFloatingWorkspaceDirectory, resolveFloatingTerminalCwd } from './floating-workspace-directory' -import { isMarkdownDocumentName, markdownDocumentFromFilePath } from './markdown-documents' +import { + isMarkdownDocumentName, + markdownDocumentFromFilePath +} from '../../shared/markdown-document-paths' import { registerMacSymbolicHotkeysProbeHandler } from './macos-symbolic-hotkeys-probe' import { registerRendererShutdownCheckpointHandler } from './renderer-shutdown-checkpoint' import { readMacKeyboardLayoutSnapshot } from './macos-keyboard-layout-snapshot' diff --git a/src/main/ipc/bitbucket.ts b/src/main/ipc/bitbucket.ts index 2b9b030c691..0a9d07838f5 100644 --- a/src/main/ipc/bitbucket.ts +++ b/src/main/ipc/bitbucket.ts @@ -7,7 +7,7 @@ import { type BitbucketConnectResult, type BitbucketConnectionStatus } from '../bitbucket/credential-connection' -import { _resetPreflightCache } from './preflight' +import { _resetPreflightCache } from '../preflight/agent-detection' function optionalString(value: unknown): string | null { return typeof value === 'string' ? value : null diff --git a/src/main/ipc/filesystem-auth.ts b/src/main/ipc/filesystem-auth.ts index 4fb446860f7..ec04ce67a5a 100644 --- a/src/main/ipc/filesystem-auth.ts +++ b/src/main/ipc/filesystem-auth.ts @@ -10,12 +10,6 @@ import { isRegisteredWorktreePath } from './registered-worktree-roots-cache' -// Compatibility exports for runtime command modules that historically imported these seams from -// filesystem-auth. The implementations remain owned by their focused modules. -export { invalidateAuthorizedRootsCache } from './registered-worktree-roots-cache' -export { invalidateAuthorizedRootsCacheForRepo } from './registered-worktree-roots-scoped-invalidation' -export { isENOENT } from './filesystem-path-containment' - export const PATH_ACCESS_DENIED_MESSAGE = `${PATH_OUTSIDE_ALLOWED_DIRECTORIES}. If this blocks a legitimate workflow, please file a GitHub issue.` /** One allowed-root list shared by every check in a single authorization, built on first use. */ type AllowedRootsSnapshot = { get: () => readonly string[] } diff --git a/src/main/ipc/filesystem-content-search-cancellation.test.ts b/src/main/ipc/filesystem-content-search-cancellation.test.ts index 99256e1ba7d..2e8670ddb44 100644 --- a/src/main/ipc/filesystem-content-search-cancellation.test.ts +++ b/src/main/ipc/filesystem-content-search-cancellation.test.ts @@ -80,8 +80,7 @@ vi.mock('./local-worktree-runtime-options', () => ({ })) vi.mock('./markdown-documents', () => ({ - listMarkdownDocuments: vi.fn(), - markdownDocumentsFromRelativePaths: vi.fn() + listMarkdownDocuments: vi.fn() })) import { registerFilesystemHandlers } from './filesystem' diff --git a/src/main/ipc/filesystem-search-rg-timeout.test.ts b/src/main/ipc/filesystem-search-rg-timeout.test.ts index 79e09184eda..320b1f9f61a 100644 --- a/src/main/ipc/filesystem-search-rg-timeout.test.ts +++ b/src/main/ipc/filesystem-search-rg-timeout.test.ts @@ -74,8 +74,7 @@ vi.mock('./local-worktree-runtime-options', () => ({ })) vi.mock('./markdown-documents', () => ({ - listMarkdownDocuments: vi.fn(), - markdownDocumentsFromRelativePaths: vi.fn() + listMarkdownDocuments: vi.fn() })) import { registerFilesystemHandlers } from './filesystem' diff --git a/src/main/ipc/jira-project-metadata-registration.test.ts b/src/main/ipc/jira-project-metadata-registration.test.ts index 29d07cb8bda..709fc62aa32 100644 --- a/src/main/ipc/jira-project-metadata-registration.test.ts +++ b/src/main/ipc/jira-project-metadata-registration.test.ts @@ -9,7 +9,7 @@ const mocks = vi.hoisted(() => ({ listFavouriteFilters: vi.fn() })) vi.mock('electron', () => ({ ipcMain: { handle: mocks.handle } })) -vi.mock('./preflight', () => ({ _resetPreflightCache: vi.fn() })) +vi.mock('../preflight/agent-detection', () => ({ _resetPreflightCache: vi.fn() })) vi.mock('../jira/favourite-filters', () => ({ listFavouriteFilters: mocks.listFavouriteFilters })) vi.mock('../jira/client', () => ({ connect: vi.fn(), diff --git a/src/main/ipc/jira.ts b/src/main/ipc/jira.ts index 832d8102c63..69377b1ac33 100644 --- a/src/main/ipc/jira.ts +++ b/src/main/ipc/jira.ts @@ -4,7 +4,7 @@ import { ipcMain } from 'electron' import type { JiraMediaFormat } from '../../shared/jira-attachment-image' import { connect, disconnect, getStatus, selectSite, testConnection } from '../jira/client' import { listFavouriteFilters } from '../jira/favourite-filters' -import { _resetPreflightCache } from './preflight' +import { _resetPreflightCache } from '../preflight/agent-detection' import { JiraCancellableRequests } from './jira-cancellable-requests' import { registerJiraUserSearchHandlers } from './jira-user-search' import { registerJiraProjectMetadataHandlers } from './jira-project-metadata' diff --git a/src/main/ipc/linear.test.ts b/src/main/ipc/linear.test.ts index 59465513ab4..3e2bb5e445e 100644 --- a/src/main/ipc/linear.test.ts +++ b/src/main/ipc/linear.test.ts @@ -69,7 +69,7 @@ vi.mock('../linear/teams', () => ({ getTeamMembers: vi.fn() })) -vi.mock('./preflight', () => ({ +vi.mock('../preflight/agent-detection', () => ({ _resetPreflightCache: vi.fn() })) diff --git a/src/main/ipc/linear.ts b/src/main/ipc/linear.ts index b3e61d96d10..7a41c169dbb 100644 --- a/src/main/ipc/linear.ts +++ b/src/main/ipc/linear.ts @@ -1,6 +1,6 @@ import { ipcMain } from 'electron' import { connect, disconnect, getStatus, selectWorkspace, testConnection } from '../linear/client' -import { _resetPreflightCache } from './preflight' +import { _resetPreflightCache } from '../preflight/agent-detection' import { normalizeWorkspaceId, normalizeWorkspaceSelection } from './linear-ipc-args' import { registerLinearIssueHandlers } from './linear-issue-handlers' import { registerLinearProjectHandlers } from './linear-project-handlers' diff --git a/src/main/ipc/markdown-documents-remote-paths.test.ts b/src/main/ipc/markdown-documents-remote-paths.test.ts index 0d5dc66983a..0fb41971efe 100644 --- a/src/main/ipc/markdown-documents-remote-paths.test.ts +++ b/src/main/ipc/markdown-documents-remote-paths.test.ts @@ -6,7 +6,10 @@ vi.mock('node:path', async (importOriginal) => { return { ...actual, extname: actual.win32.extname } }) -import { isMarkdownDocumentName, markdownDocumentFromRelativePath } from './markdown-documents' +import { + isMarkdownDocumentName, + markdownDocumentFromRelativePath +} from '../../shared/markdown-document-paths' describe('remote Markdown filenames on a Windows client', () => { it('keeps the local filename helper on Windows semantics', () => { diff --git a/src/main/ipc/markdown-documents.test.ts b/src/main/ipc/markdown-documents.test.ts index 698935b1f62..8bc6b12f4c1 100644 --- a/src/main/ipc/markdown-documents.test.ts +++ b/src/main/ipc/markdown-documents.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest' import { markdownDocumentFromFilePath, markdownDocumentFromRelativePath -} from './markdown-documents' +} from '../../shared/markdown-document-paths' describe('markdownDocumentFromFilePath', () => { it.skipIf(process.platform === 'win32')('preserves local literal backslash names', () => { diff --git a/src/main/ipc/markdown-documents.ts b/src/main/ipc/markdown-documents.ts index faae39d60cb..6810fdb1fe9 100644 --- a/src/main/ipc/markdown-documents.ts +++ b/src/main/ipc/markdown-documents.ts @@ -6,7 +6,6 @@ import { MARKDOWN_DOCUMENT_LISTING_ARGS } from '../../shared/node-markdown-document-listing' import type { MarkdownDocument } from '../../shared/filesystem-entry-types' -export * from '../../shared/markdown-document-paths' export async function listMarkdownDocuments( rootPath: string, diff --git a/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts b/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts index ed72de1a824..7507eff6d87 100644 --- a/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts +++ b/src/main/ipc/preflight-agent-detection-no-subprocess.test.ts @@ -63,7 +63,7 @@ vi.mock('../pty/windows-environment-path', () => ({ mergePersistedWindowsPath: mergePersistedWindowsPathMock })) -import { _resetPreflightCache, detectInstalledAgents } from './preflight' +import { _resetPreflightCache, detectInstalledAgents } from '../preflight/agent-detection' import { getTuiAgentDetectionProbeCommands, KNOWN_TUI_AGENT_DETECTION_COMMANDS diff --git a/src/main/ipc/preflight-agent-detection.test.ts b/src/main/ipc/preflight-agent-detection.test.ts index d76d08fb9cf..fc6370fefaa 100644 --- a/src/main/ipc/preflight-agent-detection.test.ts +++ b/src/main/ipc/preflight-agent-detection.test.ts @@ -89,9 +89,9 @@ vi.mock('../gitea/client', () => ({ import { detectInstalledAgents, - detectInstalledAgentsWithShellPathHydration, - registerPreflightHandlers -} from './preflight' + detectInstalledAgentsWithShellPathHydration +} from '../preflight/agent-detection' +import { registerPreflightHandlers } from './preflight' import { resetPreflightMocks, type HandlerMap } from './preflight-test-harness' describe('preflight', () => { diff --git a/src/main/ipc/preflight-host-cli-status.test.ts b/src/main/ipc/preflight-host-cli-status.test.ts index 868d90e8090..3fdeed0d9a4 100644 --- a/src/main/ipc/preflight-host-cli-status.test.ts +++ b/src/main/ipc/preflight-host-cli-status.test.ts @@ -101,7 +101,8 @@ vi.mock('../gitea/client', () => ({ getGiteaAuthStatus: getGiteaAuthStatusMock })) -import { _resetPreflightCache, registerPreflightHandlers, runPreflightCheck } from './preflight' +import { _resetPreflightCache, runPreflightCheck } from '../preflight/agent-detection' +import { registerPreflightHandlers } from './preflight' import { defaultAzureDevOpsStatus, defaultBitbucketStatus, diff --git a/src/main/ipc/preflight-test-harness.ts b/src/main/ipc/preflight-test-harness.ts index 94acabe1f9f..68a6ea468c4 100644 --- a/src/main/ipc/preflight-test-harness.ts +++ b/src/main/ipc/preflight-test-harness.ts @@ -1,6 +1,6 @@ import path from 'node:path' import type { Mock } from 'vitest' -import { _resetPreflightCache } from './preflight' +import { _resetPreflightCache } from '../preflight/agent-detection' export type HandlerMap = Record Promise> diff --git a/src/main/ipc/preflight.ts b/src/main/ipc/preflight.ts index 1fbb2836055..b056a5dff19 100644 --- a/src/main/ipc/preflight.ts +++ b/src/main/ipc/preflight.ts @@ -10,10 +10,6 @@ import type { RemoteWindowsTerminalCapabilities } from '../preflight/agent-detection' -// Why this file is thin: everything above the handler layer moved to -// ../preflight/agent-detection so the runtime can call it without ipcMain. -// Re-exported here so existing importers of `ipc/preflight` keep working. -export * from '../preflight/agent-detection' import { readZCodeInteractiveCapability } from '../zcode/interactive-capability' export function registerPreflightHandlers(): void { diff --git a/src/main/ipc/worktrees-removal-recovery.test.ts b/src/main/ipc/worktrees-removal-recovery.test.ts index 042ad22ed58..fd946f807f9 100644 --- a/src/main/ipc/worktrees-removal-recovery.test.ts +++ b/src/main/ipc/worktrees-removal-recovery.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import * as filesystemAuth from './filesystem-auth' +import * as scopedRootsInvalidation from './registered-worktree-roots-scoped-invalidation' import * as authorizedRootsCache from './registered-worktree-roots-cache' import * as localWorktreeFilesystem from '../local-worktree-filesystem' import { lstat, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' @@ -126,7 +126,7 @@ describe('registerWorktreeHandlers', () => { beforeEach(() => { runtimeStub = setupWorktreeHandlers() - vi.spyOn(filesystemAuth, 'invalidateAuthorizedRootsCacheForRepo').mockClear() + vi.spyOn(scopedRootsInvalidation, 'invalidateAuthorizedRootsCacheForRepo').mockClear() vi.spyOn(authorizedRootsCache, 'invalidateAuthorizedRootsCache').mockClear() }) @@ -160,8 +160,8 @@ describe('registerWorktreeHandlers', () => { true ) - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( store, 'repo-1' ) @@ -188,8 +188,8 @@ describe('registerWorktreeHandlers', () => { await handlers['worktrees:remove'](null, { worktreeId: 'repo-1::/workspace/feature-wt' }) - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( store, 'repo-1' ) @@ -344,8 +344,8 @@ describe('registerWorktreeHandlers', () => { worktreeId: 'repo-1::/workspace/feature-wt' }) - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledOnce() + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).toHaveBeenCalledWith( store, 'repo-1' ) diff --git a/src/main/ipc/worktrees-remove-preflight.test.ts b/src/main/ipc/worktrees-remove-preflight.test.ts index ded891c6ad3..8e21ec12334 100644 --- a/src/main/ipc/worktrees-remove-preflight.test.ts +++ b/src/main/ipc/worktrees-remove-preflight.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import * as filesystemAuth from './filesystem-auth' +import * as scopedRootsInvalidation from './registered-worktree-roots-scoped-invalidation' import * as authorizedRootsCache from './registered-worktree-roots-cache' import { removeWorktreeLinkedPathsMock, @@ -101,7 +101,7 @@ describe('registerWorktreeHandlers', () => { beforeEach(() => { runtimeStub = setupWorktreeHandlers() - vi.spyOn(filesystemAuth, 'invalidateAuthorizedRootsCacheForRepo').mockClear() + vi.spyOn(scopedRootsInvalidation, 'invalidateAuthorizedRootsCacheForRepo').mockClear() vi.spyOn(authorizedRootsCache, 'invalidateAuthorizedRootsCache').mockClear() }) @@ -138,7 +138,7 @@ describe('registerWorktreeHandlers', () => { expect(removeWorktreeLinkedPathsMock).not.toHaveBeenCalled() expect(killAllProcessesForWorktreeMock).not.toHaveBeenCalled() expect(removeWorktreeMock).not.toHaveBeenCalled() - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).not.toHaveBeenCalled() + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).not.toHaveBeenCalled() expect(authorizedRootsCache.invalidateAuthorizedRootsCache).not.toHaveBeenCalled() }) @@ -201,7 +201,7 @@ describe('registerWorktreeHandlers', () => { expect(removeWorktreeLinkedPathsMock).not.toHaveBeenCalled() expect(killAllProcessesForWorktreeMock).not.toHaveBeenCalled() expect(removeWorktreeMock).not.toHaveBeenCalled() - expect(filesystemAuth.invalidateAuthorizedRootsCacheForRepo).not.toHaveBeenCalled() + expect(scopedRootsInvalidation.invalidateAuthorizedRootsCacheForRepo).not.toHaveBeenCalled() expect(authorizedRootsCache.invalidateAuthorizedRootsCache).not.toHaveBeenCalled() }) diff --git a/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts b/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts index 2693b5ca039..4fd9c2b9add 100644 --- a/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts +++ b/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts @@ -22,7 +22,7 @@ import { findExistingWorktreeSymlinkPaths, removeWorktreeLinkedPaths } from '../../worktree-symlinks' -import { invalidateAuthorizedRootsCacheForRepo } from '../../filesystem-auth' +import { invalidateAuthorizedRootsCacheForRepo } from '../../registered-worktree-roots-scoped-invalidation' import { runWorktreeChangeInvalidators } from '../../worktree-change-invalidators' import { formatWorktreeRemovalError, diff --git a/src/main/runtime/managed-worktree-create-registry.test.ts b/src/main/runtime/managed-worktree-create-registry.test.ts index f8121adbda4..2bcc8bdc5f3 100644 --- a/src/main/runtime/managed-worktree-create-registry.test.ts +++ b/src/main/runtime/managed-worktree-create-registry.test.ts @@ -37,8 +37,10 @@ vi.mock('./runtime-local-worktree-setup', () => ({ didStartInProcessSetupHook: false })) })) -vi.mock('../ipc/filesystem-auth', () => ({ - invalidateAuthorizedRootsCache: vi.fn(), +vi.mock('../ipc/registered-worktree-roots-cache', () => ({ + invalidateAuthorizedRootsCache: vi.fn() +})) +vi.mock('../ipc/registered-worktree-roots-scoped-invalidation', () => ({ invalidateAuthorizedRootsCacheForRepo: vi.fn() })) diff --git a/src/main/runtime/managed-worktree-create-telemetry.test.ts b/src/main/runtime/managed-worktree-create-telemetry.test.ts index 37723713275..49113c80feb 100644 --- a/src/main/runtime/managed-worktree-create-telemetry.test.ts +++ b/src/main/runtime/managed-worktree-create-telemetry.test.ts @@ -36,8 +36,10 @@ vi.mock('./runtime-local-worktree-setup', () => ({ didStartInProcessSetupHook: false })) })) -vi.mock('../ipc/filesystem-auth', () => ({ - invalidateAuthorizedRootsCache: vi.fn(), +vi.mock('../ipc/registered-worktree-roots-cache', () => ({ + invalidateAuthorizedRootsCache: vi.fn() +})) +vi.mock('../ipc/registered-worktree-roots-scoped-invalidation', () => ({ invalidateAuthorizedRootsCacheForRepo: vi.fn() })) diff --git a/src/main/runtime/orca-runtime-test-mocks/setup.spec.ts b/src/main/runtime/orca-runtime-test-mocks/setup.spec.ts index 5916e17bfc9..0fe8b00bde7 100644 --- a/src/main/runtime/orca-runtime-test-mocks/setup.spec.ts +++ b/src/main/runtime/orca-runtime-test-mocks/setup.spec.ts @@ -359,15 +359,14 @@ vi.mock('../../ipc/worktree-logic', async (importOriginal) => { }) vi.mock('../../ipc/filesystem-auth', () => ({ - resolveAuthorizedPath: vi.fn(async (pathValue: string) => pathValue), - invalidateAuthorizedRootsCache: invalidateAuthorizedRootsCacheMock, - invalidateAuthorizedRootsCacheForRepo: invalidateAuthorizedRootsCacheMock, - isENOENT: (error: unknown) => - Boolean(error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT') + resolveAuthorizedPath: vi.fn(async (pathValue: string) => pathValue) })) vi.mock('../../ipc/registered-worktree-roots-cache', () => ({ - invalidateAuthorizedRootsCache: invalidateAuthorizedRootsCacheMock, + invalidateAuthorizedRootsCache: invalidateAuthorizedRootsCacheMock +})) + +vi.mock('../../ipc/registered-worktree-roots-scoped-invalidation', () => ({ invalidateAuthorizedRootsCacheForRepo: invalidateAuthorizedRootsCacheMock })) diff --git a/src/main/runtime/runtime-local-create-rearm-ordering.test.ts b/src/main/runtime/runtime-local-create-rearm-ordering.test.ts index caf4dfb109f..8272a014d12 100644 --- a/src/main/runtime/runtime-local-create-rearm-ordering.test.ts +++ b/src/main/runtime/runtime-local-create-rearm-ordering.test.ts @@ -33,8 +33,10 @@ vi.mock('./runtime-local-worktree-setup', () => ({ })) })) -vi.mock('../ipc/filesystem-auth', () => ({ - invalidateAuthorizedRootsCache: vi.fn(), +vi.mock('../ipc/registered-worktree-roots-cache', () => ({ + invalidateAuthorizedRootsCache: vi.fn() +})) +vi.mock('../ipc/registered-worktree-roots-scoped-invalidation', () => ({ invalidateAuthorizedRootsCacheForRepo: vi.fn() })) diff --git a/src/main/runtime/runtime-project-host-setup-controller.ts b/src/main/runtime/runtime-project-host-setup-controller.ts index 1388c3aaef3..548f4636fd0 100644 --- a/src/main/runtime/runtime-project-host-setup-controller.ts +++ b/src/main/runtime/runtime-project-host-setup-controller.ts @@ -21,7 +21,7 @@ import { } from '../../shared/execution-host' import { getProjectIdForProviderIdentity } from '../../shared/project-host-setup-projection' import { getProjectHostSetupForRepo } from '../../shared/project-host-setup-lookup' -import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCache } from '../ipc/registered-worktree-roots-cache' import { SshHostNotServedError, sshTargetNotConnectedMessage diff --git a/src/main/runtime/runtime-repository-clone-controller.ts b/src/main/runtime/runtime-repository-clone-controller.ts index 05010bdf967..d56b0615178 100644 --- a/src/main/runtime/runtime-repository-clone-controller.ts +++ b/src/main/runtime/runtime-repository-clone-controller.ts @@ -18,7 +18,7 @@ import { import { gitSpawnAfterWindowsEnvironmentReady, promptGuardGitEnv } from '../git/runner' import { reuseSavedCloneTarget } from '../git/saved-clone-target' import { runWithGitReadCacheInvalidation } from '../git/status' -import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCache } from '../ipc/registered-worktree-roots-cache' import { detectRepoIconAndUpstream } from '../repo-icon-autodetect' import { getRepoName } from '../git/repo' import { prepareLocalWorktreeRootForRepo } from '../worktree-root-preparation' diff --git a/src/main/runtime/runtime-repository-hooks-commands.ts b/src/main/runtime/runtime-repository-hooks-commands.ts index ddfcfbd39dd..4de40c2f308 100644 --- a/src/main/runtime/runtime-repository-hooks-commands.ts +++ b/src/main/runtime/runtime-repository-hooks-commands.ts @@ -7,7 +7,7 @@ import { getDefaultTabCommandTrustContent, getEffectiveSetupRunPolicy } from '../effective-hook-config' -import { isENOENT } from '../ipc/filesystem-auth' +import { isENOENT } from '../ipc/filesystem-path-containment' import { isFolderRepo } from '../../shared/repo-kind' import { inspectSetupScriptImportCandidates } from '../../shared/setup-script-imports' import { joinWorktreeRelativePath } from './runtime-relative-paths' diff --git a/src/main/runtime/runtime-repository-registration-controller.ts b/src/main/runtime/runtime-repository-registration-controller.ts index 0c85451faac..d7a0cff081b 100644 --- a/src/main/runtime/runtime-repository-registration-controller.ts +++ b/src/main/runtime/runtime-repository-registration-controller.ts @@ -11,7 +11,8 @@ import { import type { Repo } from '../../shared/repo-types' import { gitExecFileAsync, awaitWindowsHostGitEnvironmentReady } from '../git/runner' import { getRepoName, inspectGitRepoForRegistrationAsync } from '../git/repo' -import { invalidateAuthorizedRootsCache, isENOENT } from '../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCache } from '../ipc/registered-worktree-roots-cache' +import { isENOENT } from '../ipc/filesystem-path-containment' import { findProjectAtSameRealPath } from '../project-realpath-identity' import { detectRepoIconAndUpstream } from '../repo-icon-autodetect' import { prepareLocalWorktreeRootForRepo } from '../worktree-root-preparation' diff --git a/src/main/runtime/runtime-repository-settings-controller.ts b/src/main/runtime/runtime-repository-settings-controller.ts index 083e9ede432..6eb883b5b87 100644 --- a/src/main/runtime/runtime-repository-settings-controller.ts +++ b/src/main/runtime/runtime-repository-settings-controller.ts @@ -3,7 +3,7 @@ import { isFolderRepo } from '../../shared/repo-kind' import { commitProvenRepoKindChange } from '../folder-repo-git-conversion' import type { Repo } from '../../shared/repo-types' import type { GhAccountBinding } from '../../shared/github/account-binding' -import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCache } from '../ipc/registered-worktree-roots-cache' import { prepareLocalWorktreeRootForRepo } from '../worktree-root-preparation' import type { RuntimeStore } from './runtime-store-contract' import { assertWslMoveRepoWritable } from '../persistence/moving-wsl-projects/wsl-move-scope-guard' diff --git a/src/main/runtime/runtime-worktree-filesystem.ts b/src/main/runtime/runtime-worktree-filesystem.ts index dfde4538a86..94093e28e8e 100644 --- a/src/main/runtime/runtime-worktree-filesystem.ts +++ b/src/main/runtime/runtime-worktree-filesystem.ts @@ -3,7 +3,7 @@ import { stat } from 'node:fs/promises' import { FOLDER_WORKSPACE_INSTANCE_SEPARATOR } from '../../shared/worktree/id' import type { Repo } from '../../shared/repo-types' import type { Worktree } from '../../shared/worktree/types' -import { isENOENT } from '../ipc/filesystem-auth' +import { isENOENT } from '../ipc/filesystem-path-containment' import { getLocalWorktreePathAccess, toLocalWorktreeRuntimePath diff --git a/src/main/runtime/workspaces/workspace-creation.ts b/src/main/runtime/workspaces/workspace-creation.ts index e5ca0ad3207..c918123a376 100644 --- a/src/main/runtime/workspaces/workspace-creation.ts +++ b/src/main/runtime/workspaces/workspace-creation.ts @@ -15,7 +15,7 @@ import { createRuntimeFolderWorktree } from '../runtime-folder-worktree-create' import { createRuntimeLocalManagedWorktree } from '../runtime-local-worktree-create' import type { PreparationRearmHolder } from '../../worktree-create-preparation' import { prepareRuntimeLocalWorktreeSetup } from '../runtime-local-worktree-setup' -import { invalidateAuthorizedRootsCacheForRepo } from '../../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCacheForRepo } from '../../ipc/registered-worktree-roots-scoped-invalidation' import { startRuntimeLocalWorktreeTerminals } from '../runtime-local-worktree-terminal-startup' import { trackRuntimeWorkspaceCreate } from '../../workspace-create-telemetry' import { assertOpenCodeModelLaunchPreferencesAbsent } from '../../opencode/opencode-model-startup-plan' diff --git a/src/main/runtime/workspaces/workspace-registration-removal.ts b/src/main/runtime/workspaces/workspace-registration-removal.ts index d67f8afaadb..0c1a06bf84f 100644 --- a/src/main/runtime/workspaces/workspace-registration-removal.ts +++ b/src/main/runtime/workspaces/workspace-registration-removal.ts @@ -6,7 +6,7 @@ import type { ExecutionHostId } from '../../../shared/execution-host' import type { WorktreeTeardownRuntime } from '../worktree-teardown' import { splitWorktreeId, splitWorktreeIdForFilesystem } from '../../../shared/worktree/id' import { parseExecutionHostId } from '../../../shared/execution-host' -import { invalidateAuthorizedRootsCache } from '../../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCache } from '../../ipc/registered-worktree-roots-cache' import { isFolderRepo } from '../../../shared/repo-kind' import { getRuntimeFolderWorkspaceRootId } from '../runtime-folder-workspace' import { killAllProcessesForWorktree } from '../worktree-teardown' diff --git a/src/main/runtime/workspaces/workspace-removal-target.ts b/src/main/runtime/workspaces/workspace-removal-target.ts index b2b70022e78..172e25434ac 100644 --- a/src/main/runtime/workspaces/workspace-removal-target.ts +++ b/src/main/runtime/workspaces/workspace-removal-target.ts @@ -25,7 +25,7 @@ import { parseExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host' -import { invalidateAuthorizedRootsCacheForRepo } from '../../ipc/filesystem-auth' +import { invalidateAuthorizedRootsCacheForRepo } from '../../ipc/registered-worktree-roots-scoped-invalidation' import { resumeInterruptedWorktreeRemovals, retryFailedWorktreeRemoval, diff --git a/src/main/startup/os-opened-document-arguments.test.ts b/src/main/startup/os-opened-document-arguments.test.ts index b4452c646eb..40002224f3a 100644 --- a/src/main/startup/os-opened-document-arguments.test.ts +++ b/src/main/startup/os-opened-document-arguments.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { isMarkdownDocumentName } from '../ipc/markdown-documents' +import { isMarkdownDocumentName } from '../../shared/markdown-document-paths' import { documentPathsFromArguments } from './os-opened-documents' describe('documentPathsFromArguments', () => { diff --git a/src/main/startup/os-opened-documents.ts b/src/main/startup/os-opened-documents.ts index cdc78803ef3..7a7b36aeeb9 100644 --- a/src/main/startup/os-opened-documents.ts +++ b/src/main/startup/os-opened-documents.ts @@ -3,7 +3,10 @@ import path from 'node:path' import { fileURLToPath } from 'node:url' import type { FileDocument } from '../../shared/filesystem-entry-types' import { ensureDefaultFloatingWorkspacePath } from '../ipc/floating-workspace-directory' -import { fileDocumentFromFilePath, isMarkdownDocumentName } from '../ipc/markdown-documents' +import { + fileDocumentFromFilePath, + isMarkdownDocumentName +} from '../../shared/markdown-document-paths' export function isOsOpenedDocumentName(name: string): boolean { const extension = path.extname(name).toLowerCase()