fix(server): link thread PRs without an open client (#10101)

Co-authored-by: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5.1 authored and GitHub committed 2026-09-06 04:06:15 -07:00
1 parent 5fa35d2116
commit 223ff4490f
50 files changed
+2308 -1485

No files matched your search

+2 -17
View File
@@ -9,18 +9,16 @@ describe("resolveThreadReferenceCopyTarget", () => {
threadId: "thread-1",
openPanelPullRequestUrl: null,
linkedPullRequestUrl: "https://github.com/t3/pr/12",
detectedPullRequestUrl: "https://github.com/t3/pr/13",
}),
).toBeNull();
});
it("prefers the open panel pull request over linked and detected pull requests", () => {
it("prefers the open panel pull request over the thread pull request", () => {
expect(
resolveThreadReferenceCopyTarget({
threadId: "thread-1",
openPanelPullRequestUrl: "https://github.com/t3/pr/14",
linkedPullRequestUrl: "https://github.com/t3/pr/12",
detectedPullRequestUrl: "https://github.com/t3/pr/13",
}),
).toMatchObject({
kind: "pull-request",
@@ -29,12 +27,11 @@ describe("resolveThreadReferenceCopyTarget", () => {
});
});
it("prefers a durable linked pull request", () => {
it("uses the thread pull request when no panel is open", () => {
expect(
resolveThreadReferenceCopyTarget({
threadId: "thread-1",
linkedPullRequestUrl: "https://github.com/t3/pr/12",
detectedPullRequestUrl: "https://github.com/t3/pr/13",
}),
).toMatchObject({
kind: "pull-request",
@@ -43,18 +40,6 @@ describe("resolveThreadReferenceCopyTarget", () => {
});
});
it("uses a pull request detected from the active branch", () => {
expect(
resolveThreadReferenceCopyTarget({
threadId: "thread-1",
detectedPullRequestUrl: "https://github.com/t3/pr/13",
}),
).toMatchObject({
kind: "pull-request",
value: "https://github.com/t3/pr/13",
});
});
it("falls back to the thread ID", () => {
expect(resolveThreadReferenceCopyTarget({ threadId: "thread-1" })).toEqual({
kind: "thread",