Skip to content

Commit c1a7e53

Browse files
juliusmarmingecodex
andcommitted
Prevent semantic thread branches from regressing
- Keep live thread branches stable when git status reports a temporary worktree branch - Use the shared temporary worktree branch helper in web logic - Add regression test for semantic branch renames Co-authored-by: codex <[email protected]>
1 parent 801b83e commit c1a7e53

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎apps/web/src/components/GitActionsControl.logic.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,15 @@ describe("resolveLiveThreadBranchUpdate", () => {
10201020

10211021
assert.equal(update, null);
10221022
});
1023+
1024+
it("does not regress a semantic thread branch back to a temporary worktree branch", () => {
1025+
const update = resolveLiveThreadBranchUpdate({
1026+
threadBranch: "t3code/github-query-rate-limit",
1027+
gitStatus: status({ branch: "t3code/bda76797" }),
1028+
});
1029+
1030+
assert.equal(update, null);
1031+
});
10231032
});
10241033

10251034
describe("resolveAutoFeatureBranchName", () => {

‎apps/web/src/components/GitActionsControl.logic.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
GitStackedAction,
44
GitStatusResult,
55
} from "@t3tools/contracts";
6+
import { isTemporaryWorktreeBranch } from "@t3tools/shared/git";
67

78
export type GitActionIconName = "commit" | "push" | "pr";
89

@@ -354,6 +355,15 @@ export function resolveLiveThreadBranchUpdate(input: {
354355
return null;
355356
}
356357

358+
if (
359+
input.threadBranch !== null &&
360+
input.gitStatus.branch !== null &&
361+
!isTemporaryWorktreeBranch(input.threadBranch) &&
362+
isTemporaryWorktreeBranch(input.gitStatus.branch)
363+
) {
364+
return null;
365+
}
366+
357367
return {
358368
branch: input.gitStatus.branch,
359369
};

0 commit comments

Comments
 (0)