feat(pull-requests): link multiple pull requests to threads (#10839)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-09 15:50:58 -07:00
1 parent 383cc40f4d
commit afb84898be
172 files changed
+12063 -914

No files matched your search

@@ -1,3 +1,7 @@
import {
canonicalRepositoryKey,
sourceControlRepositorySelector,
} from "@t3tools/shared/sourceControl";
import {
CommandId,
type OrchestrationEvent,
@@ -53,18 +57,6 @@ interface RefreshRequest {
readonly backfill?: boolean;
}
function canonicalRepositoryKey(key: string): string {
return key
.replace(
/^(?:ssh\.dev\.azure\.com|vs-ssh\.visualstudio\.com)\/v3\/([^/]+)\/([^/]+)\/([^/]+)$/u,
"dev.azure.com/$1/$2/_git/$3",
)
.replace(
/^([^.]+)\.visualstudio\.com\/(?:defaultcollection\/)?([^/]+)\/_git\/([^/]+)$/u,
"dev.azure.com/$1/$2/_git/$3",
);
}
export function pullRequestMatchesProject(
pullRequest: GitManager.GitBranchPullRequest,
project: OrchestrationProjectShell,
@@ -138,7 +130,7 @@ export const make = Effect.gen(function* () {
const first = group[0]!;
const project = projects.get(first.projectId);
if (project === undefined) return finishBackfill(group);
const repository = PullRequestService.repositoryIdentityOf(project);
const repository = sourceControlRepositorySelector(project.repositoryIdentity);
if (first.branch !== null && repository === null) return finishBackfill(group);
const worktreeExists =
first.worktreePath !== null && (yield* fileSystem.exists(first.worktreePath));
@@ -189,6 +181,7 @@ export const make = Effect.gen(function* () {
let replacement: ThreadLinkedPullRequest | undefined;
if (
thread.pullRequests.length === 0 &&
thread.linkedPullRequest != null &&
detected?.state === "open" &&
detectedReference !== null &&