From 65a766beb27946f7cf76be95694df96db49816fa Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Tue, 1 Sep 2026 22:31:13 -0400 Subject: [PATCH] fix(worktree): read the stale-cleanup ledger through its module #17857 and #17829 landed minutes apart: one moved staleCleanupInFlight into worktree-create-preparation-stale-cleanup.ts, the other added hasPendingWorktreeCreatePreparations reading it by name. main fails tc:node at the merge. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- src/main/worktree-create-preparation-stale-cleanup.ts | 4 ++++ src/main/worktree-create-preparation.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/worktree-create-preparation-stale-cleanup.ts b/src/main/worktree-create-preparation-stale-cleanup.ts index 4a422f672ed..653a1db3d4e 100644 --- a/src/main/worktree-create-preparation-stale-cleanup.ts +++ b/src/main/worktree-create-preparation-stale-cleanup.ts @@ -74,6 +74,10 @@ export async function cleanupStalePreparations( } } +export function hasStaleCleanupInFlight(): boolean { + return staleCleanupInFlight.size > 0 +} + export function resetStalePreparationCleanupForTests(): void { staleCleanupInFlight.clear() } diff --git a/src/main/worktree-create-preparation.ts b/src/main/worktree-create-preparation.ts index b4d86923490..cfb49d2c352 100644 --- a/src/main/worktree-create-preparation.ts +++ b/src/main/worktree-create-preparation.ts @@ -26,6 +26,7 @@ import { } from './worktree-create-preparation-burst' import { cleanupStalePreparations, + hasStaleCleanupInFlight, resetStalePreparationCleanupForTests } from './worktree-create-preparation-stale-cleanup' import { toHostFilesystemPath } from './host-tree-removal' @@ -63,7 +64,7 @@ const preparations = new Map() /** A prepared checkout is a create that is either in flight or imminent. */ export function hasPendingWorktreeCreatePreparations(): boolean { - return preparations.size > 0 || staleCleanupInFlight.size > 0 + return preparations.size > 0 || hasStaleCleanupInFlight() } function pathOps(path: string): Pick {