From 543006505d0125e08a8173c8607fa068b9fc42d5 Mon Sep 17 00:00:00 2001 From: Andriy Polanski Date: Wed, 22 Jul 2026 13:53:09 +0000 Subject: [PATCH] fix(extension): remove stranded matchPullRequestTarget (#8023) #7487 left a duplicate of matchGitHubPageTarget with no production callers; drop it and the unused test-internals export. Co-authored-by: Cursor --- apps/loopover-extension/content.js | 7 ------- test/unit/extension-content.test.ts | 20 ++++++++------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/apps/loopover-extension/content.js b/apps/loopover-extension/content.js index 29f94aed4a..f5e58b5306 100644 --- a/apps/loopover-extension/content.js +++ b/apps/loopover-extension/content.js @@ -13,12 +13,6 @@ function matchGitHubPageTarget(pathname) { return { kind: "pull_request", owner, repo, pullNumber: Number(number) }; } -function matchPullRequestTarget(pathname) { - const target = matchGitHubPageTarget(pathname); - if (!target) return null; - return { owner: target.owner, repo: target.repo, pullNumber: target.pullNumber }; -} - function mountOverlay(target) { if (document.querySelector("[data-loopover-pr-context]")) return; const container = document.createElement("aside"); @@ -192,7 +186,6 @@ function renderActions(body, actions) { if (globalThis.__LOOPOVER_EXTENSION_TEST__) { globalThis.__loopoverContentInternals = { matchGitHubPageTarget, - matchPullRequestTarget, createOverlayLoader, renderPullContext, renderSection, diff --git a/test/unit/extension-content.test.ts b/test/unit/extension-content.test.ts index e8b9957503..4ee4f8f56c 100644 --- a/test/unit/extension-content.test.ts +++ b/test/unit/extension-content.test.ts @@ -22,21 +22,18 @@ describe("extension content script", () => { repo: "loopover", pullNumber: 146, }); - // Issue pages are out of scope — no kind:"issue" classification, and no match. - expect(internals.matchGitHubPageTarget("/JSONbored/loopover/issues/145")).toBeNull(); - expect(internals.matchGitHubPageTarget("/JSONbored/loopover/pulls")).toBeNull(); - expect(internals.matchPullRequestTarget("/JSONbored/loopover/pull/146")).toEqual({ - owner: "JSONbored", - repo: "loopover", - pullNumber: 146, - }); - expect(internals.matchPullRequestTarget("/JSONbored/loopover/pull/146/files")).toEqual({ + // Nested PR paths (e.g. /files) still match — same regex used by the content-script mount. + expect(internals.matchGitHubPageTarget("/JSONbored/loopover/pull/146/files")).toEqual({ + kind: "pull_request", owner: "JSONbored", repo: "loopover", pullNumber: 146, }); - expect(internals.matchPullRequestTarget("/JSONbored/loopover/issues/146")).toBeNull(); - expect(internals.matchPullRequestTarget("/JSONbored/loopover")).toBeNull(); + // Issue pages are out of scope — no kind:"issue" classification, and no match. + expect(internals.matchGitHubPageTarget("/JSONbored/loopover/issues/145")).toBeNull(); + expect(internals.matchGitHubPageTarget("/JSONbored/loopover/issues/146")).toBeNull(); + expect(internals.matchGitHubPageTarget("/JSONbored/loopover/pulls")).toBeNull(); + expect(internals.matchGitHubPageTarget("/JSONbored/loopover")).toBeNull(); }); it("renders private pull-context sections and escapes API text", () => { @@ -134,7 +131,6 @@ function loadContentInternals(overrides: Record = {}) { matchGitHubPageTarget: ( pathname: string, ) => { kind: "pull_request"; owner: string; repo: string; pullNumber: number } | null; - matchPullRequestTarget: (pathname: string) => { owner: string; repo: string; pullNumber: number } | null; createOverlayLoader: (container: { querySelector: (selector: string) => unknown }, target: unknown) => () => Promise; renderPullContext: (payload: unknown) => string; };