From 120842264e49106973e9bba6dd5b790b58354e16 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Sat, 11 Jul 2026 18:58:24 +0200 Subject: [PATCH] fix(app): do not promote archive as primary for regular Git checkouts --- packages/app/src/git/policy.test.ts | 21 ++++++++++++++++++++- packages/app/src/git/policy.ts | 9 ++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/packages/app/src/git/policy.test.ts b/packages/app/src/git/policy.test.ts index c5d0a508d..6b96cf98a 100644 --- a/packages/app/src/git/policy.test.ts +++ b/packages/app/src/git/policy.test.ts @@ -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({ diff --git a/packages/app/src/git/policy.ts b/packages/app/src/git/policy.ts index 5bc7c0b65..a2cec4c1f 100644 --- a/packages/app/src/git/policy.ts +++ b/packages/app/src/git/policy.ts @@ -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: {