pub trait ReviewProvider {
Show 19 methods
// Required methods
fn review_for_branch(&self, branch: &str) -> Result<Option<ReviewRequest>>;
fn review_for_branch_including_closed(
&self,
branch: &str,
) -> Result<Option<ReviewRequest>>;
fn create_review(
&self,
branch: &str,
base: &str,
draft: bool,
) -> Result<String>;
fn update_review_base(
&self,
review: &ReviewRequest,
base: &str,
) -> Result<String>;
fn review_body(&self, review: &ReviewRequest) -> Result<String>;
fn update_review_body(
&self,
review: &ReviewRequest,
body: &str,
) -> Result<String>;
fn merge_review(
&self,
review: &ReviewRequest,
strategy: &str,
auto: bool,
) -> Result<String>;
fn merge_blocker(&self, review: &ReviewRequest) -> Result<MergeBlocker>;
fn wait_for_checks(&self, review: &ReviewRequest) -> Result<WaitOutcome>;
fn open_reviews(&self) -> Result<Vec<ReviewRequest>>;
fn mark_ready(&self, review: &ReviewRequest) -> Result<String>;
fn close_review(
&self,
review: &ReviewRequest,
delete_branch: bool,
) -> Result<String>;
fn open_review(&self, review: &ReviewRequest) -> Result<String>;
// Provided methods
fn review_state(
&self,
review: &ReviewRequest,
) -> Result<Option<ReviewState>> { ... }
fn annotate_branches(
&self,
branches: &[String],
detail: bool,
) -> Result<BTreeMap<String, ReviewAnnotation>> { ... }
fn check_status(&self, _review: &ReviewRequest) -> Result<CheckStatus> { ... }
fn review_summary(&self, _review: &ReviewRequest) -> Result<ReviewSummary> { ... }
fn request_reviewers(
&self,
_review: &ReviewRequest,
_reviewers: &[String],
) -> Result<String> { ... }
fn enqueued_branches(
&self,
_branches: &[String],
) -> Result<BTreeSet<String>> { ... }
}Required Methods§
fn review_for_branch(&self, branch: &str) -> Result<Option<ReviewRequest>>
Sourcefn review_for_branch_including_closed(
&self,
branch: &str,
) -> Result<Option<ReviewRequest>>
fn review_for_branch_including_closed( &self, branch: &str, ) -> Result<Option<ReviewRequest>>
Like review_for_branch, but also finds closed reviews. Kept separate so flows that act on a review (submit, sync, cleanup) never mistake a dead review for a live one; only the stack-notes ledger wants closed state, to restyle the entry rather than drop it.
Sourcefn create_review(&self, branch: &str, base: &str, draft: bool) -> Result<String>
fn create_review(&self, branch: &str, base: &str, draft: bool) -> Result<String>
Open a review for the branch; with draft, as a draft.
fn update_review_base( &self, review: &ReviewRequest, base: &str, ) -> Result<String>
fn review_body(&self, review: &ReviewRequest) -> Result<String>
fn update_review_body( &self, review: &ReviewRequest, body: &str, ) -> Result<String>
Sourcefn merge_review(
&self,
review: &ReviewRequest,
strategy: &str,
auto: bool,
) -> Result<String>
fn merge_review( &self, review: &ReviewRequest, strategy: &str, auto: bool, ) -> Result<String>
Merge the review with the given strategy: squash, rebase, or merge.
With auto, schedule the merge for when required checks pass
instead of merging now.
Sourcefn merge_blocker(&self, review: &ReviewRequest) -> Result<MergeBlocker>
fn merge_blocker(&self, review: &ReviewRequest) -> Result<MergeBlocker>
Why the platform won’t merge the review right now, read from its structured status. Consulted after a merge is rejected to explain it without parsing the CLI’s error text.
Sourcefn wait_for_checks(&self, review: &ReviewRequest) -> Result<WaitOutcome>
fn wait_for_checks(&self, review: &ReviewRequest) -> Result<WaitOutcome>
Block until the review’s checks settle, returning how the wait ended: checks passed (or there are none), one failed, or the review merged out-of-band while we waited.
Sourcefn open_reviews(&self) -> Result<Vec<ReviewRequest>>
fn open_reviews(&self) -> Result<Vec<ReviewRequest>>
Every open review, in one call - for annotating the stack with review numbers (and CI status) without a lookup per branch.
Sourcefn mark_ready(&self, review: &ReviewRequest) -> Result<String>
fn mark_ready(&self, review: &ReviewRequest) -> Result<String>
Mark a draft review as ready for review.
Sourcefn close_review(
&self,
review: &ReviewRequest,
delete_branch: bool,
) -> Result<String>
fn close_review( &self, review: &ReviewRequest, delete_branch: bool, ) -> Result<String>
Close the review without merging, deleting its source branch when
delete_branch. Used to retire a review superseded by a branch rename.
Sourcefn open_review(&self, review: &ReviewRequest) -> Result<String>
fn open_review(&self, review: &ReviewRequest) -> Result<String>
Open the review in the user’s browser.
Provided Methods§
Sourcefn review_state(&self, review: &ReviewRequest) -> Result<Option<ReviewState>>
fn review_state(&self, review: &ReviewRequest) -> Result<Option<ReviewState>>
A carried-forward ledger row’s current state, re-fetched by id after its branch has left the local stack. Nothing else re-queries such a row, so one that merged or closed since it was last recorded keeps rendering as open in the overview without this. Default None: a provider that cannot resolve a review by id alone leaves the recorded state untouched, and the caller treats any error as “leave it as-is” (best-effort refresh).
Sourcefn annotate_branches(
&self,
branches: &[String],
detail: bool,
) -> Result<BTreeMap<String, ReviewAnnotation>>
fn annotate_branches( &self, branches: &[String], detail: bool, ) -> Result<BTreeMap<String, ReviewAnnotation>>
Review annotations (id, CI dot, queue state, and - with detail -
review tallies) for the given branches, in as few calls as the provider
allows. The default is the generic per-branch path; a provider can
override to batch (GitHub folds it into a single GraphQL query). Only
branches with an open review appear in the result.
Sourcefn check_status(&self, _review: &ReviewRequest) -> Result<CheckStatus>
fn check_status(&self, _review: &ReviewRequest) -> Result<CheckStatus>
The CI check rollup for the review’s head, for the list/status dot.
Best-effort display data: the default is CheckStatus::None (no dot),
which is also the right answer for a provider that cannot report it.
Sourcefn review_summary(&self, _review: &ReviewRequest) -> Result<ReviewSummary>
fn review_summary(&self, _review: &ReviewRequest) -> Result<ReviewSummary>
The review’s latest-review tallies, for list --reviews. Fetched per
branch only when the flag is set; the default is an empty summary.
Sourcefn request_reviewers(
&self,
_review: &ReviewRequest,
_reviewers: &[String],
) -> Result<String>
fn request_reviewers( &self, _review: &ReviewRequest, _reviewers: &[String], ) -> Result<String>
Request reviews from the given users or teams on the review, additively
(anyone already requested stays). Team reviewers use the provider’s own
form (GitHub/Gitea org/team). The default errors, so a provider
without reviewer support surfaces that rather than dropping the request.
Sourcefn enqueued_branches(&self, _branches: &[String]) -> Result<BTreeSet<String>>
fn enqueued_branches(&self, _branches: &[String]) -> Result<BTreeSet<String>>
Of branches, those whose review is locked by a merge queue (GitHub)
or merge train (GitLab): they must be neither rebased nor force-pushed.
Rebasing would diverge from the frozen remote tip; a push is rejected
outright (GitHub locks the branch) or silently drops the review from the
queue (GitLab does not lock it). The default is empty - for providers
without a queue, and as the safe degradation when the lookup itself
fails (the reactive push-rejection net in git is the backstop).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".