@@ -16,7 +16,9 @@ import * as Layer from "effect/Layer";
1616import * as Option from "effect/Option" ;
1717import * as Path from "effect/Path" ;
1818import { symlinksSupported } from "@t3tools/shared/testing/symlinks" ;
19+ import * as GitWorkflowService from "../git/GitWorkflowService.ts" ;
1920import * as CheckpointRollbackService from "./CheckpointRollbackService.ts" ;
21+ import { isCheckpointRestoreIsolated } from "./CheckpointRestoreSafety.ts" ;
2022import * as ThreadCommandExecutor from "./ThreadCommandExecutor.ts" ;
2123import { CheckpointServiceV2 } from "./CheckpointService.ts" ;
2224import { EventSinkV2 } from "./EventSink.ts" ;
@@ -105,6 +107,7 @@ it.effect.each([
105107 NodeServices . layer ,
106108 ThreadCommandExecutor . layer ,
107109 IdAllocator . layer ,
110+ Layer . mock ( GitWorkflowService . GitWorkflowService ) ( { } ) ,
108111 Layer . mock ( ProjectStore . ProjectStoreV2 ) ( {
109112 get : ( ) => Effect . succeed ( Option . some ( { workspaceRoot : parent } as never ) ) ,
110113 } ) ,
@@ -197,3 +200,25 @@ it.effect.each([
197200 }
198201 } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
199202) ;
203+
204+ it . effect ( "lets rollback recreate a worktree storage cleanup removed" , ( ) =>
205+ Effect . gen ( function * ( ) {
206+ const fileSystem = yield * FileSystem . FileSystem ;
207+ const path = yield * Path . Path ;
208+ const parent = yield * fileSystem . makeTempDirectoryScoped ( { prefix : "t3-v2-restore-removed-" } ) ;
209+ const worktreePath = path . join ( parent , "worktree" ) ;
210+ const isolated = yield * isCheckpointRestoreIsolated (
211+ { id : ThreadId . make ( "restore-removed" ) , worktreePath } ,
212+ { cwd : worktreePath } ,
213+ {
214+ fileSystem,
215+ path,
216+ projections : {
217+ getShellSnapshot : ( ) => Effect . succeed ( { threads : [ ] , archivedThreads : [ ] } ) ,
218+ } as never ,
219+ projects : { } as never ,
220+ } ,
221+ ) ;
222+ assert . isTrue ( isolated ) ;
223+ } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
224+ ) ;
0 commit comments