Skip to content

Commit 83b8716

Browse files
committed
Fix asymmetric state mapping: include SUPERSEDED PRs when filtering by closed
toBitbucketState mapped 'closed' only to 'declined', but normalizeBitbucketPullRequestState maps both DECLINED and SUPERSEDED to 'closed'. This caused SUPERSEDED PRs to appear in 'all' listings but disappear from 'closed' listings. Refactored toBitbucketState into toBitbucketStateArgs which returns CLI flag pairs, allowing 'closed' to expand into --state declined --state superseded.
1 parent 7a57722 commit 83b8716

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

apps/server/src/sourceControl/BitbucketCli.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,16 @@ function sourceBranch(input: {
158158
return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
159159
}
160160

161-
function toBitbucketState(state: "open" | "closed" | "merged" | "all"): string {
161+
function toBitbucketStateArgs(state: "open" | "closed" | "merged" | "all"): readonly string[] {
162162
switch (state) {
163163
case "open":
164-
return "open";
164+
return ["--state", "open"];
165165
case "closed":
166-
return "declined";
166+
return ["--state", "declined", "--state", "superseded"];
167167
case "merged":
168-
return "merged";
168+
return ["--state", "merged"];
169169
case "all":
170-
return "all";
170+
return ["--state", "all"];
171171
}
172172
}
173173

@@ -254,8 +254,7 @@ export const make = Effect.fn("makeBitbucketCli")(function* () {
254254
"list",
255255
"--head",
256256
sourceBranch(input),
257-
"--state",
258-
toBitbucketState(input.state),
257+
...toBitbucketStateArgs(input.state),
259258
"--limit",
260259
String(input.limit ?? 20),
261260
"--json",

0 commit comments

Comments
 (0)