Skip to content

feat(bitbucket): add guarded cloud PR decline - #1194

Merged
potiuk merged 2 commits into
apache:mainfrom
KatalKavya96:feat-bitbucket-cloud-pr-decline
Sep 11, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
KatalKavya96:feat-bitbucket-cloud-pr-decline

Conversation

@KatalKavya96

Copy link
Copy Markdown
Contributor

Summary

Adds a guarded Bitbucket Cloud pull-request decline mutation to the existing Bitbucket bridge.

This PR adds:

  • magpie-bitbucket pr decline <id>

The command operates on Bitbucket Cloud only. Bitbucket Data Center decline writes remain explicitly unsupported in this PR.

Implementation

  • Adds Bitbucket Cloud pull-request decline using POST.
  • Reuses the existing guarded HTTPS-only write path.
  • Keeps authenticated mutation redirects rejected.
  • Adds explicit Data Center fail-closed behavior.
  • Adds normalized decline output.
  • Adds CLI dispatch for pr decline <id>.
  • Updates Bitbucket bridge documentation and adapter coverage.

Safety / write-path discipline

Decline remains an explicit caller-confirmed mutation.

The bridge does not decline pull requests automatically. The calling skill is responsible for obtaining explicit user confirmation before invoking the command.

Tests

Added coverage for:

  • Cloud decline using POST with no request body
  • decline response handling
  • normalized decline output
  • CLI pr decline dispatch
  • Data Center fail-closed behavior

Validation completed successfully:

  • focused decline tests
  • full Bitbucket test suite
  • Ruff
  • Ruff format check
  • mypy
  • repository prek hooks
  • git diff --check

Scope

This intentionally remains a narrow follow-up to #606.

It does not add:

  • full post_review
  • PR merge
  • Data Center decline writes

@KatalKavya96

Copy link
Copy Markdown
Contributor Author

Hi @potiuk — another narrow #606 follow-up, continuing the Cloud PR mutation sequence.

This adds guarded pr decline <id>, reuses the existing HTTPS + no-auth-redirect write path, and keeps Data Center decline explicitly fail-closed.

Focused decline tests, the full Bitbucket suite, Ruff, mypy, prek hooks, and git diff --check are green.

Would appreciate your review when you get a chance.

Comment thread tools/bitbucket/README.md Resolved
Drop 'declining,' from the out-of-scope write list. The same paragraph
now both claimed decline as implemented and listed it as out of scope,
and the command table two sections down lists 'pr decline <id>' as a
supported Cloud write.

Generated-by: Claude Opus 5
Claude-Session: https://claude.ai/code/session_01M7zttXzAM1wbTdBAjJCECv
@potiuk
potiuk merged commit fcbe271 into apache:main Sep 11, 2026
9 checks passed
@potiuk

potiuk commented Sep 11, 2026

Copy link
Copy Markdown
Member

Pushed a one-line fixup rather than round-tripping: dropped declining, from the out-of-scope write list in tools/bitbucket/README.md, exactly as @AmirF194 identified — the paragraph claimed decline as implemented and out of scope at the same time, and the command table already listed pr decline <id>. Everything else was a clean match for the #1192 pattern, so this is merged. Thanks both — nice catch on the contradiction.

@potiuk potiuk added contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:tracker Tool capability: issue / board / label backend labels Sep 25, 2026
@potiuk potiuk added family:docs Docs, MISSION.md, READMEs family:tools tools/* labels Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) contract:tracker Tool capability: issue / board / label backend family:docs Docs, MISSION.md, READMEs family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants