[279] feat: wire Bitbucket Pipelines into parsec ci + pr-status mapping#282
Merged
[279] feat: wire Bitbucket Pipelines into parsec ci + pr-status mapping#282
Conversation
Closes the two gaps left after the Bitbucket Cloud forge work in #240: * `parsec ci` now dispatches on the origin remote — when it's Bitbucket, it resolves the PR's source branch and polls the Pipelines API (`/repositories/.../pipelines/`) instead of GitHub Checks. The result is shaped into the existing `CiStatus` struct so renderers, --watch, and exit-code logic stay forge-agnostic. * `parsec pr-status`'s Bitbucket branch no longer hardcodes "unknown" for ci_status / review_status. ci_status comes from the latest pipeline for the PR's source branch; review_status comes from the PR participants list. Both fall back to "unknown" on network error rather than failing the whole command. Vocabulary matches the GitHub path exactly: passing | failing | pending | no checks | unknown for CI; approved | changes_requested | pending | no reviews for review. New `BitbucketClient` helpers: `get_latest_pipeline_for_branch`, `get_pr_source_branch`, `get_pr_participants`. Pure mapping functions (`pipeline_to_ci_status`, `participants_to_review_status`) are unit tested directly. Adds `mockito` as a dev-dependency — the codebase had no HTTP mocking infra, and the new `tests/bitbucket_integration_tests.rs` needs it to verify the Bitbucket dispatch path end-to-end without hitting the real api.bitbucket.org. To make this testable, `BitbucketClient` honors a new `PARSEC_BITBUCKET_API_BASE` env var (also useful for future Bitbucket Server / Data Center support). Behaviour for GitHub repositories is unchanged. Test coverage: 20 unit tests for mappings + 5 integration tests (`pr-status` approved/changes_requested/no-pipeline cases, `ci` in-progress + failing-exit-code cases, plus an explicit "never call /repos/*" assertion to catch dispatch regressions). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the two gaps left after the Bitbucket Cloud forge work in #240 (PR #276):
1. `parsec ci` now dispatches on the origin remote
When the remote is Bitbucket, `ci` resolves the PR's source branch and polls the Pipelines API (`/repositories/.../pipelines/`) instead of GitHub Checks. The result is shaped into the existing `CiStatus` struct so renderers, `--watch`, and exit-code logic stay forge-agnostic.
2. `parsec pr-status` Bitbucket branch returns real CI / review
No more hardcoded `"unknown"` for `ci_status` / `review_status`:
Both fall back to `"unknown"` on network error rather than failing the whole command.
Vocabulary matches the GitHub path exactly:
Closes #279
Changes
GitHub repo behaviour is unchanged — verified by the unchanged 40 existing integration tests + an explicit `expect(0)` assertion on `/repos/*` in the Bitbucket CI integration test (catches dispatch regressions).
Verification
Test plan