Skip to content

Commit df1686b

Browse files
committed
test(server): pin the folder and the failure fallback for launch branches
The launch-branch test answered "main" for any folder but the worktree, so it could not catch a lookup in the wrong folder. Each row now names the folder it expects, and a new row checks that a failed branch lookup still lets the launch prepare and records no branch. Done with Claude Opus 5.5 in Claude Code (T3 Code).
1 parent 7723365 commit df1686b

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

‎apps/server/src/orchestration-v2/ThreadLaunchService.test.ts‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,12 +1071,29 @@ it.effect.each([
10711071
{
10721072
name: "an existing worktree",
10731073
workspace: { type: "existing_worktree", worktreePath: "/wt/task" },
1074+
expected: "task-branch",
10741075
},
1075-
{ name: "the project root", workspace: { type: "root" } },
1076-
] as const)("records the branch checked out in $name when the launch names none", (testCase) => {
1076+
{ name: "the project root", workspace: { type: "root" }, expected: "main" },
1077+
{
1078+
name: "a worktree whose branch lookup fails",
1079+
workspace: { type: "existing_worktree", worktreePath: "/wt/broken" },
1080+
expected: null,
1081+
},
1082+
] as const)("a launch in $name that names no branch records branch $expected", (testCase) => {
1083+
const checkedOut: Record<string, string> = { "/wt/task": "task-branch", "/repo": "main" };
10771084
const harness = makeHarness({
10781085
git: {
1079-
currentBranch: (cwd) => Effect.succeed(cwd === "/wt/task" ? "task-branch" : "main"),
1086+
currentBranch: (cwd) =>
1087+
testCase.expected === null
1088+
? Effect.fail(
1089+
new GitCommandError({
1090+
operation: "GitWorkflowService.currentBranch",
1091+
command: "git symbolic-ref",
1092+
cwd,
1093+
detail: "Failed to read the checked-out branch.",
1094+
}),
1095+
)
1096+
: Effect.succeed(checkedOut[cwd] ?? null),
10801097
},
10811098
});
10821099
return Effect.gen(function* () {
@@ -1090,10 +1107,8 @@ it.effect.each([
10901107
}),
10911108
);
10921109
const projection = yield* preparationSettled(launched.threadId);
1093-
assert.equal(
1094-
projection.thread.branch,
1095-
testCase.workspace.type === "root" ? "main" : "task-branch",
1096-
);
1110+
assert.equal(projection.runs[0]?.status, "starting");
1111+
assert.equal(projection.thread.branch, testCase.expected);
10971112
}).pipe(Effect.provide(harness.layer));
10981113
});
10991114

0 commit comments

Comments
 (0)