Scope completed worktree removal authorization refresh to its repository (#26253)

This commit is contained in:
Neil
2026-10-07 22:41:58 -07:00
committed by GitHub
parent 4d7193c34d
commit 8e22ad2d0a
3 changed files with 5 additions and 4 deletions
@@ -24,7 +24,7 @@ import { terminalShellOverrideRefusal } from './terminal-shell-override-host-sup
import { resolveTerminalStartupCwd } from '../../shared/terminal-startup-cwd'
import { resolveLocalProjectRuntimeForWorktreeId } from '../local-project-runtime-resolution'
import { LOCAL_EXECUTION_HOST_ID, parseExecutionHostId } from '../../shared/execution-host'
import { invalidateAuthorizedRootsCache } from '../ipc/filesystem-auth'
import { invalidateAuthorizedRootsCacheForRepo } from '../ipc/filesystem-auth'
import {
resumeInterruptedWorktreeRemovals,
retryFailedWorktreeRemoval,
@@ -124,7 +124,7 @@ export class OrcaRuntimeWithResolveWorktreeRemovalTarget extends OrcaRuntimeWith
this.removeWorktreeMetadataAndHistory(store, worktreeId, removalHostId)
this.invalidateResolvedWorktreeCache()
this.invalidateWorktreeScanCacheForRepo(repoId)
invalidateAuthorizedRootsCache()
invalidateAuthorizedRootsCacheForRepo(store, repoId)
}
protected removeWorktreeMetadataAndHistory(
@@ -350,7 +350,7 @@ describe('OrcaRuntimeService', () => {
// an unqualified purge would evict a same-id row owned by another host.
expect(removeWorktreeMeta).toHaveBeenCalledWith(worktreeId, 'local')
expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(worktreeId)
expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalled()
expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(runtimeStore, TEST_REPO_ID)
expect(notifier.worktreesChanged).toHaveBeenCalledWith(TEST_REPO_ID)
} finally {
await rm(parentDir, { recursive: true, force: true })
@@ -376,7 +376,7 @@ describe('OrcaRuntimeService', () => {
// an unqualified purge would evict a same-id row owned by another host.
expect(removeWorktreeMeta).toHaveBeenCalledWith(worktreeId, 'local')
expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(worktreeId)
expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalled()
expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(runtimeStore, TEST_REPO_ID)
expect(notifier.worktreesChanged).toHaveBeenCalledWith(TEST_REPO_ID)
} finally {
await rm(parentDir, { recursive: true, force: true })
@@ -489,6 +489,7 @@ describe('OrcaRuntimeService', () => {
})
)
expect(deleteWorktreeHistoryDirMock).toHaveBeenCalledWith(TEST_WORKTREE_ID)
expect(invalidateAuthorizedRootsCacheMock).toHaveBeenCalledWith(store, TEST_REPO_ID)
expect(result.warning).toBe(
`orca.yaml archive hook skipped for ${TEST_WORKTREE_PATH}; pass --run-hooks to run it.`
)