Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions loom-daemon/src/champion_hold/ratification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,6 @@ pub enum Action {
Release,
/// The head no longer declares it: post [`CLEARED_MARKER`], remove the label.
Clear,
/// A candidate could not be read and no hold stands: do not merge this
/// tick, write nothing.
Defer,
}

impl Action {
Expand All @@ -346,7 +343,6 @@ impl Action {
Action::Stands => "stands",
Action::Release => "release",
Action::Clear => "clear",
Action::Defer => "defer",
}
}
}
Expand All @@ -355,6 +351,10 @@ impl Action {
/// the current head. The release is scoped to a head: a push after it that
/// still declares ratification re-arms the hold, because the text the operator
/// released may not be the text now on the PR.
///
/// A [`Verdict::Unreadable`] cannot reach `decide` from the CLI: the verb
/// fails closed on it first (#13932). If one arrives anyway, it falls through
/// to `Hold`/`Stands` — fail closed, never a silent pass.
#[must_use]
pub fn decide(verdict: &Verdict, comments: &[Comment], head: &str) -> Action {
let ep = episode(comments);
Expand All @@ -366,7 +366,6 @@ pub fn decide(verdict: &Verdict, comments: &[Comment], head: &str) -> Action {
match (verdict, ep) {
(Verdict::Clear, Episode::None) => Action::None,
(Verdict::Clear, _) => Action::Clear,
(Verdict::Unreadable(_), Episode::None | Episode::Released { .. }) => Action::Defer,
(_, Episode::Held { .. }) if release_due(comments) => Action::Release,
(_, Episode::Held { .. }) => Action::Stands,
(_, Episode::None | Episode::Released { .. }) => Action::Hold,
Expand Down
4 changes: 3 additions & 1 deletion loom-daemon/src/champion_hold/ratification/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ fn the_state_machine_walks_hold_release_rearm_clear() {
#[test]
fn an_unreadable_candidate_never_merges_and_never_drops_a_hold() {
let unreadable = Verdict::Unreadable(vec!["spec/a.md".into()]);
assert_eq!(decide(&unreadable, &[], HEAD), Action::Defer);
// Unreachable from the CLI (#13932 fails closed first); if one arrives
// anyway it opens or keeps a hold, never a silent pass.
assert_eq!(decide(&unreadable, &[], HEAD), Action::Hold);
assert_eq!(decide(&unreadable, &[hold_note(HEAD)], HEAD), Action::Stands);
}

Expand Down
Loading