@@ -99,6 +99,7 @@ interface HarnessOptions {
9999 readonly managedFolders ?: Layer . Layer < ManagedProjectFolders . ManagedProjectFolders > ;
100100 readonly createWorktree ?: GitWorkflow . GitWorkflowService [ "Service" ] [ "createWorktree" ] ;
101101 readonly fetchRemote ?: GitWorkflow . GitWorkflowService [ "Service" ] [ "fetchRemote" ] ;
102+ readonly hasCommit ?: GitWorkflow . GitWorkflowService [ "Service" ] [ "hasCommit" ] ;
102103 readonly renameBranch ?: GitWorkflow . GitWorkflowService [ "Service" ] [ "renameBranch" ] ;
103104 readonly runSetup ?: ProjectSetupScriptRunner . ProjectSetupScriptRunner [ "Service" ] [ "runForThread" ] ;
104105 readonly generateTitle ?: TextGeneration . TextGeneration [ "Service" ] [ "generateThreadTitle" ] ;
@@ -167,6 +168,7 @@ function makeHarness(options: HarnessOptions = {}) {
167168 createWorktree,
168169 renameBranch,
169170 fetchRemote : options . fetchRemote ?? ( ( ) => Effect . void ) ,
171+ hasCommit : options . hasCommit ?? ( ( ) => Effect . succeed ( false ) ) ,
170172 remoteExists : ( ) => Effect . succeed ( true ) ,
171173 remoteBranchExists : ( ) => Effect . succeed ( true ) ,
172174 removeWorktree,
@@ -1165,6 +1167,37 @@ it.effect("renames a temporary t3code/<hash> branch off the provisioning critica
11651167 } ) ,
11661168) ;
11671169
1170+ it . effect ( "provisions under t3code-<hash> when a plain t3code branch blocks t3code/*" , ( ) =>
1171+ Effect . gen ( function * ( ) {
1172+ const harness = makeHarness ( {
1173+ hasCommit : ( input ) => Effect . succeed ( input . refName === "refs/heads/t3code" ) ,
1174+ createWorktree : ( input ) =>
1175+ Effect . succeed ( {
1176+ worktree : { path : "/repo-worktrees/temp" , refName : input . newRefName , headSha : "abc" } ,
1177+ } as never ) ,
1178+ } ) ;
1179+ yield * Effect . gen ( function * ( ) {
1180+ const launches = yield * ThreadLaunch . ThreadLaunchService ;
1181+ const threads = yield * ThreadManagement . ThreadManagementService ;
1182+ const launched = yield * launches . launch (
1183+ launchInput ( {
1184+ command : "command:launch:blocked-namespace" ,
1185+ thread : "thread:launch:blocked-namespace" ,
1186+ message : "Build the feature" ,
1187+ workspace : { type : "worktree" , baseRef : "main" , branch : "t3code/abcd1234" } ,
1188+ } ) ,
1189+ ) ;
1190+ yield * waitUntil ( ( ) =>
1191+ threads
1192+ . getThreadProjection ( launched . threadId )
1193+ . pipe ( Effect . map ( ( projection ) => projection . thread . branch === "generated-branch" ) ) ,
1194+ ) ;
1195+ assert . equal ( harness . createWorktree . mock . calls [ 0 ] ?. [ 0 ] ?. newRefName , "t3code-abcd1234" ) ;
1196+ assert . equal ( harness . renameBranch . mock . calls [ 0 ] ?. [ 0 ] ?. oldBranch , "t3code-abcd1234" ) ;
1197+ } ) . pipe ( Effect . provide ( harness . layer ) ) ;
1198+ } ) ,
1199+ ) ;
1200+
11681201it . effect ( "keeps an explicit branch name instead of generating one" , ( ) =>
11691202 Effect . gen ( function * ( ) {
11701203 const harness = makeHarness ( ) ;
0 commit comments