feat(bitbucket): add read-only PR discussion fetch#766
Conversation
|
Hi @potiuk I opened the next Bitbucket follow-up PR for the read-only This adds I also tightened the normalised output to match the discussion contract shape more closely: top-level After a local review pass, I also added guarded Cloud pagination so response-controlled
|
|
I ran the review skill over this - looks like there one thing that needs to be fixed: Robustness / API correctness — tools/bitbucket/src/magpie_bitbucket/datacenter.py get_pull_request_discussion: the DC while True loop has no guard against a non-advancing cursor. If /activities returns isLastPage: false with a nextPageStart that never increases, it re-requests the same ?start=N forever. The Cloud path in this same PR added seen_urls repeat-detection for exactly this; the DC path has no analog. Suggest a next_start <= start → break/raise guard to keep the two backends symmetric. Docs / code quality — tools/spec-loop/specs/adapters.md: the new security note was wedged mid-sentence, so the bullet now reads "tools/bitbucket/ Fetched Bitbucket descriptions… before model use. currently provides read-only repository metadata…". Split it into its own sentence/bullet after the coverage description. Minor (non-blocking) — normalize.py: _cloud_inline and _datacenter_inline are near-identical copy-paste (DC only adds a line fallback); a shared helper would remove the duplication. Everything else checks out against the surrounding code: the _datacenter_user fallback, empty-raw-body preservation, the COMMENTED action filter, and the Cloud host/scheme + repeat-URL guards. This review was AI-generated so usual caution apply. |
4598c8a to
fc76553
Compare
|
@justinmclean Thanks, fixed both required points. I added a Data Center pagination guard for get_pull_request_discussion so a non-advancing nextPageStart cannot loop forever, and added a regression test covering that case. I also cleaned up the tools/spec-loop/specs/adapters.md Bitbucket note so the external-data/privacy warning is its own bullet instead of being wedged into the coverage sentence, and updated the adapter inventory wording to include the comments-only discussion fetch. prek run --all-files is passing. |
Summary
magpie-bitbucket pr discussion <id>as a comments-only, read-onlyget_discussionsubset so Magpie can fetch PR discussion without adding write paths.comments[],participants[],unresolved_count,kind: comment, common inline fields, and updates README/spec wording for external PR content and privacy handling.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespassesuv run pytest/ruff check/mypypasses(
PYTHONPATH=tools/skill-evals/src python3 -m skill_evals.runner tools/skill-evals/evals/<skill>/)(a regression test for the bug fixed / the behaviour added — see CONTRIBUTING.md)
PYTHONPATH=src uv run --group dev pytest tests/test_bitbucket.pyRFC-AI-0004 compliance
contract:change-request+Coverage: partial-read-onlymodel without introducing a Bitbucket-specific capability.Linked issues
Refs #606
Notes for reviewers (optional)
This is the next read-only step after the initial Bitbucket bridge and the
partial-read-onlycoverage clarification.The new command is
magpie-bitbucket pr discussion <id>, intended to represent a comments-only subset of theget_discussionsurface while keeping the bridge insideCoverage: partial-read-only. Bitbucket Cloud uses PR comments. Bitbucket Data Center uses PR activities, but filters to comment-bearing /COMMENTEDactivities only.Normalized discussion output now includes
comments[],participants[], andunresolved_count. Each comment includesid,author,date,created,updated,body,kind: comment,deleted,inline, andraw. Inline locations are normalized to a common subset such aspath,from_line, andto_line.Out of scope for this PR: posting comments, reviews, approve/decline/merge operations, Jira handoff, tracker operations, branch permissions, Pipelines status, full activity/event mapping, and unresolved-thread accounting.