Skip to content

feat(bitbucket): add Data Center pull request comments - #1728

Merged
potiuk merged 2 commits into
apache:mainfrom
KatalKavya96:feat-bitbucket-datacenter-pr-comment
Oct 20, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
KatalKavya96:feat-bitbucket-datacenter-pr-comment

Conversation

@KatalKavya96

Copy link
Copy Markdown
Contributor

Summary

  • Add Bitbucket Data Center support for creating top-level pull-request comments.
  • Reuse the existing pr comment <id> --body-file <path> command across Cloud and Data Center.
  • Normalize created Data Center comments into the existing backend-neutral comment shape.
  • Add backend, normalizer, and CLI coverage for the Data Center write path.
  • Update Bitbucket capability documentation to reflect Cloud + Data Center comment support.

Type of change

  • Skill change (.claude/skills/<name>/) — eval fixtures updated below
  • Tool / bridge contract (tools/<system>/*.md)
  • Python package (tools/*/ with pyproject.toml)
  • Groovy reference impl
  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
  • Documentation (docs/, README.md, CONTRIBUTING.md)
  • Project template (projects/_template/)
  • CI / dev loop (prek, workflows, validators)
  • Other

Test plan

  • uv run --group dev ruff check src tests --fix
  • uv run --group dev ruff format src tests
  • uv run --group dev mypy src tests
  • Focused PR-comment tests pass
  • Full tools/bitbucket/tests/test_bitbucket.py suite passes
  • git diff --check passes

Implementation

Bitbucket Data Center now creates a pull-request comment with:

POST /rest/api/1.0/projects/{project}/repos/{repo}/pull-requests/{id}/comments

using the Data Center payload:

{"text": "<comment body>"}

The returned Data Center comment is normalized through the existing pull-request comment output contract so callers continue using the same CLI and normalized response shape regardless of backend.

Write-path discipline is unchanged: the bridge executes the mutation only after the calling skill has obtained explicit user confirmation.

Scope

This PR only adds Data Center top-level pull-request comment creation.

Data Center approval/change-request, review verdict, decline/reject, and merge writes remain separate follow-up work under #606.

Refs #606

@github-actions github-actions Bot added family:tools tools/* family:docs Docs, MISSION.md, READMEs contract:tracker Tool capability: issue / board / label backend contract:change-request Tool capability: proposed-change review + merge gate (PR / MR / Gerrit change) labels Oct 20, 2026
@KatalKavya96

Copy link
Copy Markdown
Contributor Author

Hi @potiuk,
This is the next focused #606 follow-up for Bitbucket Data Center parity.

It adds Data Center support for the existing pr comment <id> --body-file command using the documented pull-request comments endpoint and keeps the same normalized output shape as Cloud.

Coverage added for:

  • the Data Center POST request and payload
  • created-comment normalization
  • CLI dispatch/output
  • existing empty/missing body fail-closed behavior

The full Bitbucket test suite, ruff, formatting, mypy, git diff --check, and repo hooks pass.

Data Center review/approval, decline/reject, and merge writes remain separate follow-ups.

Refs #606

- Say in the second Bitbucket bullet of the adapters spec that comment
  creation covers Data Center too, so both bullets agree.
- Move the activities-feed comment back above
  get_pull_request_discussion, the function it describes.
- Run the empty-body and missing-body-file CLI tests against both the
  Cloud and Data Center backends.

Generated-by: Claude Opus 5

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The Data Center comment write is correct and well tested, so rather than send it back for the last small points, I pushed a fixup commit (e4f191ef) to your branch:

  • tools/spec-loop/specs/adapters.md: the second Bitbucket bullet (write-path discipline) still said comment creation was Cloud-only. It now says Cloud and Data Center, matching the bullet this PR updated.
  • tools/bitbucket/src/magpie_bitbucket/datacenter.py: I moved the activities-feed block comment back above get_pull_request_discussion, the function it describes. It was sitting above the new POST.
  • tools/bitbucket/tests/test_bitbucket.py: the empty-body and missing-body-file CLI tests now run against both the Cloud and Data Center backends, so the fail-closed check on the newly enabled write path is pinned.

The endpoint and {"text": ...} payload match Data Center's pull-request comments resource.
The write goes through the guarded post_json path, and the response reuses _datacenter_comment, as pr discussion does.
Thanks!


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.

@potiuk
potiuk merged commit 93d872d into apache:main Oct 20, 2026
9 checks passed
@KatalKavya96
KatalKavya96 deleted the feat-bitbucket-datacenter-pr-comment branch October 21, 2026 03:49
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.

2 participants