Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): stop the branch rename before cancelling worktree setup #18443

Mergedsaphid(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/18443/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 55 additions and 1 deletion.

x
0 of 2 viewed, 2 left
49 additions and 0 deletionsapps/server/src/orchestration-v2/ThreadLaunchService.test.tsModified
View file
@@ -2460,6 +2460,55 @@
+it.effect("stops an in-flight branch rename when tracked setup is cancelled", () =>
+ Effect.gen(function* () {
+ const setupEntered = yield* Deferred.make<void>();
+ const branchNameStarted = yield* Deferred.make<void>();
+ const allowBranchName = yield* Deferred.make<void>();
+ const branchNameInterrupted = yield* Deferred.make<void>();
+ const renameAttempted = yield* Deferred.make<void>();
+ const harness = makeHarness({
+ renameBranch: (input) =>
+ Deferred.succeed(renameAttempted, undefined).pipe(Effect.as({ branch: input.newBranch })),
+ runSetup: () => Deferred.succeed(setupEntered, undefined).pipe(Effect.andThen(Effect.never)),
+ generateBranchName: () =>
+ Deferred.succeed(branchNameStarted, undefined).pipe(
+ Effect.andThen(Deferred.await(allowBranchName)),
+ Effect.as({ branch: "generated-branch" }),
+ Effect.onInterrupt(() => Deferred.succeed(branchNameInterrupted, undefined)),
+ ),
+ });
+ yield* Effect.gen(function* () {
+ const launches = yield* ThreadLaunch.ThreadLaunchService;
+ const tracker = yield* WorktreeSetupTracker.WorktreeSetupTracker;
+ const threads = yield* ThreadManagement.ThreadManagementService;
+ const launched = yield* launches.launch(
+ launchInput({
+ command: "launch:cancel-renaming",
+ thread: "thread:cancel-renaming",