fix(app): do not promote archive as primary for regular Git checkouts

This commit is contained in:
Mohamed Boudra
2026-07-11 18:58:24 +02:00
parent a017ddfc29
commit 120842264e
2 changed files with 28 additions and 2 deletions
+20 -1
View File
@@ -140,7 +140,13 @@ describe("git-actions-policy", () => {
it("shows only remote sync actions on the base branch", () => {
const actions = buildGitActions(createInput({ hasRemote: true }));
expect(actions.secondary.map((action) => action.id)).toEqual(["pull", "push", "pull-and-push"]);
expect(actions.primary).toBeNull();
expect(actions.secondary.map((action) => action.id)).toEqual([
"pull",
"push",
"pull-and-push",
"archive-workspace",
]);
});
it("prioritizes pull when the branch is behind origin", () => {
@@ -369,6 +375,19 @@ describe("git-actions-policy", () => {
expect(worktree.secondary.some((action) => action.id === "archive-workspace")).toBe(true);
});
it("does not promote archive to primary for an idle regular Git checkout", () => {
const actions = buildGitActions(createInput());
expect(actions.primary).toBeNull();
expect(actions.secondary.some((action) => action.id === "archive-workspace")).toBe(true);
});
it("still promotes archive as primary for an idle Paseo-owned worktree", () => {
const actions = buildGitActions(createInput({ isPaseoOwnedWorktree: true }));
expect(actions.primary).toMatchObject({ id: "archive-workspace" });
});
it("promotes squash-and-merge when an open PR is mergeable and the branch is in sync", () => {
const actions = buildGitActions(
createInput({
+8 -1
View File
@@ -346,7 +346,14 @@ function getPrimaryActionId(input: BuildGitActionsInput): GitActionId | null {
if (input.githubFeaturesEnabled && input.hasPullRequest && input.pullRequestUrl) {
return "pr";
}
return "archive-workspace";
// Only Paseo-owned worktrees get Archive as a fallback primary action.
// Regular Git checkouts should not show the destructive archive CTA by default.
if (input.isPaseoOwnedWorktree) {
return "archive-workspace";
}
return null;
}
function getPullRequestActionIds(filter: {