From a58f013a10fd0a2258b8030502b6d21146c99cc6 Mon Sep 17 00:00:00 2001 From: Michael Yong Date: Thu, 20 Aug 2026 16:04:09 -0700 Subject: [PATCH] fix(github): disable links for removed pull files --- plugins/github/app.test.tsx | 74 +++++++++++++++++++++++++++++++++++++ plugins/github/app.tsx | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/plugins/github/app.test.tsx b/plugins/github/app.test.tsx index 70d87c613a..c9982e4684 100644 --- a/plugins/github/app.test.tsx +++ b/plugins/github/app.test.tsx @@ -77,4 +77,78 @@ describe("GitHub app navigation", () => { expect(slot.container.firstElementChild?.className).not.toContain("p-3"); slot.lifecycle.unmount(); }); + + it("keeps removed pull-request files out of live workspace navigation", async () => { + const slot = renderSlot( + app.threadPanelActions[0]!, + { threadId: "thr-1", params: null }, + { + rpc: { + pullForThread: () => ({ + pull: { + repo: "get-bb/bb", + number: 42, + environmentId: "env-1", + }, + }), + getPull: () => ({ + pull: { + repo: "get-bb/bb", + number: 42, + title: "Navigation fix", + state: "OPEN", + author: "octocat", + body: "", + url: "https://github.com/get-bb/bb/pull/42", + createdAt: "2026-08-20T00:00:00.000Z", + updatedAt: "2026-08-20T00:00:00.000Z", + baseRefName: "main", + headRefName: "fix-navigation", + additions: 1, + deletions: 1, + changedFiles: 2, + labels: [], + assignees: [], + reviewDecision: "", + mergeStateStatus: "CLEAN", + reviewRequests: [], + checks: [], + comments: [], + reviews: [], + reviewThreads: [], + files: [ + { + path: "removed.ts", + status: "removed", + additions: 0, + deletions: 1, + patch: "@@ -1 +0,0 @@\n-removed", + }, + { + path: "modified.ts", + status: "modified", + additions: 1, + deletions: 0, + patch: "@@ -0,0 +1 @@\n+added", + }, + ], + }, + }), + listLinks: () => ({ links: {} }), + }, + }, + ); + + await slot.findByText("Navigation fix"); + expect(slot.queryByRole("link", { name: "removed.ts" })).toBeNull(); + expect(slot.getByRole("link", { name: "modified.ts" })).toBeDefined(); + + slot.getByRole("button", { name: "Expand removed.ts diff" }).click(); + const diff = await slot.findByTestId("bb-diff"); + expect(diff.getAttribute("data-path")).toBe("removed.ts"); + expect( + slot.getByRole("button", { name: "Collapse removed.ts diff" }), + ).toBeDefined(); + slot.lifecycle.unmount(); + }); }); diff --git a/plugins/github/app.tsx b/plugins/github/app.tsx index c773eef487..bfdeee305f 100644 --- a/plugins/github/app.tsx +++ b/plugins/github/app.tsx @@ -1407,7 +1407,7 @@ function FileDiffCard({ > {open ? "▾" : "▸"} - {environmentId === null ? ( + {environmentId === null || file.status === "removed" ? ( {file.path}