pub struct ReviewState {
pub target: Option<ContentHash>,
pub reviewers: Vec<String>,
pub verdicts: BTreeMap<String, VerdictState>,
pub slashes: BTreeMap<String, String>,
pub target_ref: Option<String>,
pub comments: Vec<CommentState>,
pub viewed: BTreeMap<String, u64>,
pub status: ReviewStatus,
}Expand description
Materialized state of one review: what is under review, who was asked, who has answered what, and what was said about it.
Fields§
§target: Option<ContentHash>The commit under review.
reviewers: Vec<String>Actors the review fanned out to.
verdicts: BTreeMap<String, VerdictState>reviewer → their answer; absent = not answered yet.
slashes: BTreeMap<String, String>reviewer → node-recorded reason for retroactively invalidating that approval. Kept separately from verdict bulk so archived rows remain compact while the append-only decision stays visible.
target_ref: Option<String>The ref the review proposes to land on (<repo>:<refname>), or
None for a review that named no destination. Policy reads this
to decide whether a review is privilege-bearing.
comments: Vec<CommentState>The discussion, in the order the sequencer admitted it (D38).
Emptied by OpKind::ArchiveReview with the rest of the bulk.
viewed: BTreeMap<String, u64>viewer → fold position of that viewer’s first recorded read
. Emptied by OpKind::ArchiveReview
with the rest of the bulk.
status: ReviewStatusLive, or settled with its outcome retained. Defaults to
ReviewStatus::Live, so replaying a log written before
archiving existed yields exactly the previous behaviour.
Implementations§
Source§impl ReviewState
impl ReviewState
Sourcepub fn counted_approvers(&self) -> Vec<(&str, u64)>
pub fn counted_approvers(&self) -> Vec<(&str, u64)>
The reviewer channels ReviewState::approval_weight actually
counts: the first standing Approve from each distinct operator,
in verdict order, slashes applied.
This exists so a OpKind::Submit can name the approvals its
weight rested on rather than “everyone who clicked approve”. The
weight is defined as this list’s length times
MAX_APPROVAL_WEIGHT_PER_OPERATOR, so the number in an
authorization record and the names beside it cannot drift.
Each entry pairs the channel with the fold position of the verdict
being counted, because that position is what resolves the channel
to a key (see View::bound_actor_at). Returning the channel
alone would leave every caller to look the position up again, and
the one that forgot would silently credit whatever key holds the
channel today.
Meaningless on an archived review, whose verdicts are gone: the
list is empty while ReviewState::approval_weight still answers
from the stored total.
Sourcepub fn approval_stands(&self, reviewer: &str) -> bool
pub fn approval_stands(&self, reviewer: &str) -> bool
Whether reviewer has an Approve verdict that no slash has
invalidated — the individual half of ReviewState::counted_approvers,
used where one named approval has to be checked rather than a set.
Sourcepub fn standing_approval_at(&self, reviewer: &str) -> Option<u64>
pub fn standing_approval_at(&self, reviewer: &str) -> Option<u64>
The fold position of reviewer’s standing approval, or None if
they have none — ReviewState::approval_stands plus the one
fact a caller needs to resolve it to a key
(View::bound_actor_at).
The predicate is defined as this returning Some, so the two can
never disagree about what “standing” means.
Sourcepub fn complete(&self) -> bool
pub fn complete(&self) -> bool
Whether every listed reviewer has answered. An unassigned review (no reviewers yet) is never complete — vacuous truth must not turn “asked nobody” into a finished review.
Sourcepub fn approval_weight(&self) -> usize
pub fn approval_weight(&self) -> usize
Approval weight after capping every operator at one unit.
Multiple agent channels under one operator/agent prefix never
manufacture additional approval weight. Archived reviews return
the compact weight captured before their reviewer detail was
dropped.
Sourcepub fn re_review_required(&self) -> bool
pub fn re_review_required(&self) -> bool
Whether a retroactive invalidation requires a fresh review before
the same (ref, commit) can authorize another protected landing.
Trait Implementations§
Source§impl Clone for ReviewState
impl Clone for ReviewState
Source§fn clone(&self) -> ReviewState
fn clone(&self) -> ReviewState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReviewState
impl Debug for ReviewState
Source§impl Default for ReviewState
impl Default for ReviewState
Source§fn default() -> ReviewState
fn default() -> ReviewState
Source§impl PartialEq for ReviewState
impl PartialEq for ReviewState
Source§fn eq(&self, other: &ReviewState) -> bool
fn eq(&self, other: &ReviewState) -> bool
self and other values to be equal, and is used by ==.