Skip to content

BBC2-25 add bb pr ready#24

Open
b2l wants to merge 1 commit into
bbc2-23-pr-editfrom
bbc2-25-pr-ready
Open

BBC2-25 add bb pr ready#24
b2l wants to merge 1 commit into
bbc2-23-pr-editfrom
bbc2-25-pr-ready

Conversation

@b2l
Copy link
Copy Markdown
Owner

@b2l b2l commented Apr 22, 2026

Summary

  • New bb pr ready [id] that flips a draft PR to ready via PUT /pullrequests/{id} with body {draft: false}. Defaults to the current branch's PR.
  • Reuses the updatePullRequest helper introduced in BBC2-23 — draft?: boolean added to UpdatePullRequestInput.
  • Exposes PullRequest.draft on the detail shape (Bitbucket reports draft as a boolean alongside state, independent of it).
  • Pre-flights a GET so we can:
    1. Refuse cleanly on MERGED / DECLINED / SUPERSEDED (the API 4xx's there).
    2. Short-circuit when the PR is already ready — the spec is silent on whether {draft:false} on a non-draft PR is a no-op or a 4xx, so we don't trust either way.
  • No --undraft reverse. Bitbucket Cloud has no API path for ready → draft; deliberately out of scope per the ticket.

Dependency

Stacks on #23 (BBC2-23). The updatePullRequest helper it reuses is introduced there. The PR base is set to bbc2-23-pr-edit; rebase to main after that PR merges.

Test plan

  • bun test — 171 tests pass (1 new backend test for draft:false PUT body; 2 new mapping tests for PullRequest.draft — populated + default-false)
  • bun run lint clean
  • bunx tsc --noEmit clean
  • Manual: bb pr ready --help shows correct help

Manual test path

Needs BBC2-42 (--draft on create) to produce a draft PR. Replace <N> with its id.

  1. Create a throwaway draft PR: bb pr create --draft -t "draft-smoke" -b "testing bb pr ready".
  2. bb pr ready <N> → expect Marked pull request #<N> as ready for review: <url>. Verify in the Bitbucket web UI that the draft badge is gone.
  3. Run bb pr ready <N> again → expect Pull request #<N> is already ready: <url> (no PUT).
  4. Pick an already-merged PR and run bb pr ready <N> → expect Pull request #<N> is merged; cannot mark as ready.
  5. On a branch with an open draft PR: bb pr ready (no id) flips it.
  6. bb --json pr ready <N> emits the full updated PR detail.

Closes BBC2-25.

Marks a draft PR as ready for review via PUT /pullrequests/{id} with
body { draft: false }. Defaults to the PR for the current branch.

Reuses the updatePullRequest helper from BBC2-23. Adds `draft?: boolean`
to UpdatePullRequestInput and exposes `PullRequest.draft` so the command
can pre-flight a GET and:

1. Refuse cleanly on MERGED / DECLINED / SUPERSEDED (API would 4xx).
2. Short-circuit when the PR is already ready — not relying on the API
   tolerating a no-op `{draft:false}` PUT (the spec is silent on that).

No `--undraft` counterpart: Bitbucket Cloud has no API path from ready
back to draft, so it's deliberately out of scope.

Stacked on BBC2-23 so updatePullRequest lands together; rebase to main
after that PR merges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant