From c27f06778e5abd6561a46b9c95aa6e29c7cc0c48 Mon Sep 17 00:00:00 2001 From: Loom Doctor Date: Wed, 18 Nov 2026 14:56:30 +0000 Subject: [PATCH] refactor: remove unreachable Action::Defer from champion-hold ratification The #13932 fail-closed gate exits 3 on unreadable candidates before decide runs, so the (Verdict::Unreadable, None|Released) => Defer arm had no production caller. Drop the variant, its as_str arm, and the decide arm; an Unreadable verdict that somehow reaches decide now falls through to Hold/Stands (fail closed). The unit test now pins Hold instead of Defer. Closes #14332 --- loom-daemon/src/champion_hold/ratification.rs | 9 ++++----- loom-daemon/src/champion_hold/ratification/tests.rs | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/loom-daemon/src/champion_hold/ratification.rs b/loom-daemon/src/champion_hold/ratification.rs index cf40769410..fc89021e87 100644 --- a/loom-daemon/src/champion_hold/ratification.rs +++ b/loom-daemon/src/champion_hold/ratification.rs @@ -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 { @@ -346,7 +343,6 @@ impl Action { Action::Stands => "stands", Action::Release => "release", Action::Clear => "clear", - Action::Defer => "defer", } } } @@ -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); @@ -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, diff --git a/loom-daemon/src/champion_hold/ratification/tests.rs b/loom-daemon/src/champion_hold/ratification/tests.rs index 949a576828..b03fbc2619 100644 --- a/loom-daemon/src/champion_hold/ratification/tests.rs +++ b/loom-daemon/src/champion_hold/ratification/tests.rs @@ -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); }