Skip to content

Commit df13391

Browse files
saphidclaude
andauthored
fix(azure-devops): a fork's same-named branch no longer hides the branch's own pull request (#29817)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 6577c6b commit df13391

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎packages/source-control-azure-devops/src/server/AzureDevOpsSourceControlProvider.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { processOutput } from "@t3tools/source-control-testing/TestSourceControlHost";
22
import { assert, it } from "@effect/vitest";
3+
import * as Effect from "effect/Effect";
4+
import * as Layer from "effect/Layer";
35
import * as Option from "effect/Option";
46
import { ChildProcessSpawner } from "effect/process";
57

8+
import * as AzureDevOpsCli from "./AzureDevOpsCli.ts";
69
import * as AzureDevOpsSourceControlProvider from "./AzureDevOpsSourceControlProvider.ts";
710

811
const { parseAuth } = AzureDevOpsSourceControlProvider.discovery;
@@ -25,3 +28,18 @@ it("reads the signed-in Azure account and says when az is signed out", () => {
2528
);
2629
assert.strictEqual(parseAuth(processOutput("\n")).status, "unknown");
2730
});
31+
32+
it.effect(
33+
"looks up a branch's pull requests a full page at a time, past forks' same-named branches",
34+
() =>
35+
Effect.gen(function* () {
36+
const provider = yield* AzureDevOpsSourceControlProvider.make;
37+
assert.deepStrictEqual(
38+
provider.headBranchProbe?.({
39+
headSelectors: ["octocat:feature", "feature"],
40+
state: "open",
41+
}),
42+
{ headSelectors: ["feature"], limit: 100 },
43+
);
44+
}).pipe(Effect.provide(Layer.mock(AzureDevOpsCli.AzureDevOpsCli)({}))),
45+
);

‎packages/source-control-azure-devops/src/server/AzureDevOpsSourceControlProvider.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ export const make = Effect.gen(function* () {
7676

7777
return SourceControlProvider.SourceControlProvider.of({
7878
kind: SourceControlProviderKind.make("azure-devops"),
79+
// Azure lists fork pull requests by source branch with no owner filter, so read a full page.
80+
headBranchProbe: ({ headSelectors }) => ({
81+
headSelectors: headSelectors.filter((selector) => !selector.includes(":")),
82+
limit: 100,
83+
}),
7984
listChangeRequests: Effect.fn("AzureDevOpsSourceControlProvider.listChangeRequests")(
8085
function (input) {
8186
const source = SourceControlProvider.sourceControlRefFromInput(input);

0 commit comments

Comments
 (0)