Repository navigation
feat(bitbucket): add Data Center Jira issue handoff - #1687
Conversation
Kaap10
left a comment
There was a problem hiding this comment.
Thanks for adding this @KatalKavya96.
Clean implementation that respects the boundary between contract:change-request (Bitbucket) and contract:tracker (Jira) -- discovering the Jira issue keys while explicitly delegating subsequent issue operations to tools/jira via "handoff_tool": "tools/jira". Failing closed early on Cloud without sending network requests also fits the tool's design principles.
Verification
- Tested locally on branch pr1687:
- pytest tools/bitbucket/tests passes (all 218 tests, including the 5 new cases).
- ruff check, ruff format --check, and mypy all pass cleanly with zero warnings.
- Documentation updates in README.md, docs/labels-and-capabilities.md, and specs/adapters.md are consistent and in sync.
Left one minor defensive suggestion on key normalization inline. Otherwise, looks solid. LGTM.
… docs The two fail-closed branches of `pr jira-issues` (a body that is not JSON, such as a login page served with a 200, and a JSON object where an array is expected) and the filtering of non-object items had no tests; they do now. A comment says why this one JSON read goes through get_text: the endpoint returns an array, which get_json rejects. The labels-doc row no longer says the handoff exists and then that it "remains incomplete", and the README intro now names the Data Center handoff instead of saying no tracker operation exists. Generated-by: Claude Opus 5
potiuk
left a comment
There was a problem hiding this comment.
Adds a read-only Data Center pr jira-issues <id> that lists the Jira keys linked to a pull request's commits and hands them to tools/jira, failing closed on Cloud before any request; it matches the existing client and normalize helpers and Atlassian's documented Jira-integration endpoint.
I pushed one fixup commit (0d960f9) rather than send another round:
- Tests for the fail-closed paths. A body that is not JSON (a login or proxy page served with a 200) and a JSON object where an array is expected both raise
BitbucketErrornow under test, and a mixed list ([{"key": …}, "junk", 3, null]) keeps only the objects. - A comment on
get_text. It is the one JSON read that does not go throughget_json, which follows no redirects; the comment says why (the endpoint returns an array, andget_jsonrequires an object), so the next reader does not "fix" it. - Docs. The
docs/labels-and-capabilities.mdrow said the handoff exists and then that it "remains incomplete", and the README intro still said no tracker operation exists at all; both now say what ships and what #606 still tracks.
One question left for you, not blocking: normalize.pull_request_jira_issues falls back to issueKey, but the documented Data Center response carries only key (and url). If you saw issueKey from a real server, a one-line comment saying where would help; otherwise it can go in a follow-up.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Magpie handles maintainer review:
Contributing guide.
Summary
pr jira-issues <id>.tools/jiraremains responsible for Jira issue reads and writes.Type of change
.claude/skills/<name>/)tools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespassesuv run --group dev ruff check src tests --fixuv run --group dev ruff format src testsuv run --group dev mypy src teststools/bitbucket/tests/test_bitbucket.pysuite passesgit diff --checkpassesFocused coverage verifies:
tools/jiraas the tracker handoff.RFC-AI-0004 compliance
tools/jiraadapter.Linked issues
Refs #606
Notes for reviewers
Bitbucket Data Center exposes Jira issues associated with commits in a pull request through its Jira integration REST surface.
This PR adds:
The command intentionally does not turn the Bitbucket bridge into a Jira client. It only returns the Jira issue keys associated with the pull request and identifies
tools/jiraas the handoff tool for subsequent tracker operations.This preserves Magpie's vendor-neutral separation between
contract:change-requestandcontract:tracker: a project may use Bitbucket for code review while Jira remains its configured issue tracker.Bitbucket Cloud does not use this Data Center-specific integration endpoint, so the same command fails closed on Cloud rather than attempting heuristic issue-key extraction.