BBC2-40 auto-apply effective default reviewers on bb pr create#16
Merged
Merged
Conversation
Bitbucket's POST /pullrequests does not honor the repo's Default reviewers configuration; PRs created via the API ship with zero reviewers regardless of what the web UI shows. To match the web UI's behavior, bb pr create now reads /effective-default-reviewers (which includes project-inherited entries) and inlines the UUIDs in the POST body, minus the authenticated user (Bitbucket rejects a body where the author is also a reviewer). The default-reviewers fetch and the current-user fetch run in parallel. Failures on either MUST propagate — we never silently create a reviewerless PR; that's the bug we're fixing. No opt-out flag. Explicit per ticket: users who don't want the defaults can remove them in the web UI after the fact. See docs/bb-notes.md → Default reviewers for the API details that informed this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bitbucket's
POST /pullrequestsdoes not honor the repo's Default reviewers configuration. PRs created viabb pr create(or any API client) currently ship with zero reviewers, regardless of what the web UI shows under Repository settings → Default reviewers.This PR fixes that by mimicking the web UI's behavior:
GET /effective-default-reviewers(includes project-inherited defaults).reviewers: [{type: "account", uuid}].The two pre-create fetches (current user + default reviewers) run in parallel.
Design choices, called out
--no-default-reviewers). Per the ticket, deliberate.effective-default-reviewers4xx/5xx's, we abort the create. The whole point is to stop silently shipping reviewerless PRs.pagelennot bumped. Real-world default-reviewer lists are tiny (your screenshot showed 4). If anyone ever configures more, we'll add pagination.Test plan
lcdp-front-monoper the screenshot is a good fit), runbun src/index.ts pr create --title "test: defaults"from a feature branch. Verify the resulting PR has the expected reviewers attached, matching what the web UI shows under Default reviewers (minus you if you're listed).bun test(145 passing, 7 new — 4 forlistEffectiveDefaultReviewers, 3 forcreatePullRequest's reviewer-handling).bun run lint.Notes on follow-ups
BBC2-43 (in backlog) adds an explicit
--reviewer <handle>flag with nickname → UUID resolution, and will switch off the default-reviewers fetch when explicit reviewers are supplied. This PR establishes the "auto-apply repo default" pattern that BBC2-15 (merge) is also told to mirror.