diff --git a/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.test.ts b/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.test.ts index e17bded2032..180c0b3773f 100644 --- a/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.test.ts +++ b/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.test.ts @@ -327,7 +327,9 @@ it.each([ const enumerateWitnesses = vi.spyOn(witnesses, Symbol.iterator) const enumerateGlobal = vi.spyOn(pendingWorktreeRemovals, Symbol.iterator) try { - deps.metaById[records[0].worktreeId] = { displayName: 'changed metadata' } as WorktreeMeta + deps.metaById[records[0].worktreeId] = mergeWorktreeMetaForWrite(undefined, { + displayName: 'changed metadata' + }) joinResolvedWorktreeScans(deps.store, () => deps, scans) // Unrelated metadata cannot invalidate removal membership: no witness entries need copying. expect(enumerateWitnesses).not.toHaveBeenCalled() diff --git a/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts b/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts index 07a66a11d41..31e8e38c0b5 100644 --- a/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts +++ b/src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts @@ -5,7 +5,8 @@ import { splitWorktreeIdForFilesystem, worktreeIdentityKey } from '../../../../shared/worktree/id' -import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host' +import { getRepoExecutionHostId, LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host' +import type { ExecutionHostId } from '../../../../shared/execution-host' import { readAllWorktreeMetaForHost, readWorktreeMetaForHost @@ -37,7 +38,6 @@ import { type WorktreeRemovalWitnessScan } from '../../../workspaces/removal/worktree-removal-listing' import { pendingWorktreeRemovals } from '../../../workspaces/removal/worktree-removal-table' -import { LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host' type RepoWorktreeRowStore = Pick< RuntimeStore, diff --git a/src/main/workspaces/removal/worktree-background-removal-records.test.ts b/src/main/workspaces/removal/worktree-background-removal-records.test.ts index 639410c9349..f45667ae435 100644 --- a/src/main/workspaces/removal/worktree-background-removal-records.test.ts +++ b/src/main/workspaces/removal/worktree-background-removal-records.test.ts @@ -126,7 +126,7 @@ describe('durable worktree removal records', () => { }) const job = interruptedJob() void startBackgroundWorktreeRemoval({ removal, ...job }) - const initial = [{ id: removal.worktreeId }] + const initial: { id: string; hostId?: 'local' }[] = [{ id: removal.worktreeId }] expect( projectPendingWorktreeRemovals( initial, @@ -228,7 +228,7 @@ describe('durable worktree removal records', () => { ) const refusal = expect(retried).rejects.toThrow('Could not start deletion') expect( - projectPendingWorktreeRemovals( + projectPendingWorktreeRemovals<{ id: string; hostId?: 'local' }>( [{ id: removal.worktreeId }], (row) => row.id, true, diff --git a/src/main/workspaces/removal/worktree-background-removal.ts b/src/main/workspaces/removal/worktree-background-removal.ts index 6bf5fa164cc..c8da3913a78 100644 --- a/src/main/workspaces/removal/worktree-background-removal.ts +++ b/src/main/workspaces/removal/worktree-background-removal.ts @@ -1,5 +1,6 @@ import { addPendingRemoval, + assertAcceptedBranchChoice, settlementsByWorktreeId, waitForPendingWorktreeRemoval, type RemovalSettlement @@ -9,7 +10,7 @@ export { waitForWorktreeRemovalAcceptance, finishAcceptedWorktreeRemoval } from './worktree-removal-settlement' -import type { ExecutionHostId } from '../../../shared/execution-host' +import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../shared/execution-host' import type { RemoveWorktreeResult } from '../../../shared/worktree/create-types' import type { GitWorktreeInfo } from '../../../shared/worktree/types' import { normalizeLocalBranchRef } from '../../git/worktrees/worktree-operation-options' diff --git a/src/main/workspaces/removal/worktree-removal-settlement.ts b/src/main/workspaces/removal/worktree-removal-settlement.ts index a9ac0de9f18..ee9f9c085cd 100644 --- a/src/main/workspaces/removal/worktree-removal-settlement.ts +++ b/src/main/workspaces/removal/worktree-removal-settlement.ts @@ -59,7 +59,7 @@ export function waitForPendingWorktreeRemoval( return settlementsByWorktreeId.get(worktreeId)?.result } -function assertAcceptedBranchChoice( +export function assertAcceptedBranchChoice( record: WorktreeRemovalRecord | undefined, deleteBranch: boolean | undefined ): void { diff --git a/src/renderer/src/components/plugins/view/plugin-view-editor-workspace.test.ts b/src/renderer/src/components/plugins/view/plugin-view-editor-workspace.test.ts index 3290e31f134..dafde43ea40 100644 --- a/src/renderer/src/components/plugins/view/plugin-view-editor-workspace.test.ts +++ b/src/renderer/src/components/plugins/view/plugin-view-editor-workspace.test.ts @@ -52,17 +52,22 @@ it('still registers a genuinely unowned file folder and opens it', async () => { path: '/new/folder', hostId: 'local' }) - const addRepoPath = vi.fn(async () => { + const addRepoPath = vi.fn(async () => { useAppStore.setState({ worktreesByRepo: { added: [row] } }) - return { id: 'added' } + return { + id: 'added', + path: '/new/folder', + displayName: 'added', + badgeColor: 'blue', + addedAt: 1 + } }) - const fetchWorktrees = vi.fn(async () => {}) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the action reads only the returned repo id; production store actions are not invoked. + const fetchWorktrees = vi.fn().mockResolvedValue(true) useAppStore.setState({ worktreesByRepo: {}, folderWorkspaces: [], activeWorktreeId: null, - addRepoPath: addRepoPath as typeof initialState.addRepoPath, + addRepoPath, fetchWorktrees }) await expect(