From 38f3c62304bfe79ea6c9f75a17afb732b555f48d Mon Sep 17 00:00:00 2001 From: Pujitha Paladugu Date: Mon, 28 Sep 2026 18:00:36 -0700 Subject: [PATCH] fix(shared): local-path remotes no longer crash legacy PR link projection (#13463) Co-authored-by: Julius Marminge Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> --- packages/shared/src/threadPullRequests.test.ts | 12 ++++++++++++ packages/shared/src/threadPullRequests.ts | 2 ++ 2 files changed, 14 insertions(+) diff --git a/packages/shared/src/threadPullRequests.test.ts b/packages/shared/src/threadPullRequests.test.ts index 4844df8f7786e3e2897f03b1eb10b3320e460892..a7042a7c8828f5e9200c206057a9e6bc8277c4ef 100644 --- a/packages/shared/src/threadPullRequests.test.ts +++ b/packages/shared/src/threadPullRequests.test.ts @@ -242,6 +242,18 @@ describe("legacyLinkedPullRequestOf", () => { it("does not guess when the project identity is unavailable", () => { expect(legacyLinkedPullRequestOf([link(7)], "project-1" as never, null)).toBeNull(); }); + it("does not route links for a local-path remote with no host or provider", () => { + const localIdentity = { + canonicalKey: "/tmp/r/remote", + displayName: "remote", + locator: { + source: "git-remote" as const, + remoteName: "origin", + remoteUrl: "/tmp/r/remote.git", + }, + }; + expect(legacyLinkedPullRequestOf([link(7)], "project-1" as never, localIdentity)).toBeNull(); + }); }); describe("resolveThreadPullRequestChains", () => { diff --git a/packages/shared/src/threadPullRequests.ts b/packages/shared/src/threadPullRequests.ts index e747c151bd1c4cb7f79a2a78a6fd2a31d444357e..15b5451adf0a3d813e6228d2c53d561b9bc5487b 100644 --- a/packages/shared/src/threadPullRequests.ts +++ b/packages/shared/src/threadPullRequests.ts @@ -157,7 +157,9 @@ export function legacyLinkedPullRequestOf( identity: RepositoryIdentity | null | undefined, ): ThreadLinkedPullRequest | null { if (!identity) return null; + // A local-path remote has no host segment and no provider, so there is no host to match. const host = pullRequestHostOf(identity, identity.provider as SourceControlProviderKind); + if (typeof host !== "string") return null; const repository = sourceControlRepositorySelector(identity); if (repository === null) return null; const azureKey = -- 2.54.0