diff options
Diffstat (limited to 'src/review')
| -rw-r--r-- | src/review/approve.rs | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/review/approve.rs b/src/review/approve.rs index 82812fb..f277ac5 100644 --- a/src/review/approve.rs +++ b/src/review/approve.rs @@ -151,20 +151,37 @@ pub enum BulkOutcome { Refused(BulkRefusal), } -#[derive(Debug, thiserror::Error)] -pub enum BulkRefusal { - #[error("high risk: confirm it individually")] - HighRiskUnconfirmed, - #[error("unknown decision `{0}`")] - UnknownDecision(String), - #[error("no such review")] - NotFound, - #[error(transparent)] - Stale(Stale), - #[error("{0}")] - System(Error), +/// The real definition. The module is private, so this `pub` +/// is not a nameable path from outside; the alias below is the +/// only way to reach it, and the alias is what carries the +/// feature-conditional visibility. +mod bulk_refusal { + #[derive(Debug, thiserror::Error)] + pub enum BulkRefusal { + #[error("high risk: confirm it individually")] + HighRiskUnconfirmed, + #[error("unknown decision `{0}`")] + UnknownDecision(String), + #[error("no such review")] + NotFound, + #[error(transparent)] + Stale(Stale), + #[error("{0}")] + System(Error), + } } +/// The payload of one `BulkOutcome::Refused` arm. The bulk tests construct it to assert which approval was refused. +/// +/// `pub` only under `test-support`. Production reaches the type +/// through its own module and never names it from outside; the +/// outside reader that needs the name is a test. +#[cfg(feature = "test-support")] +pub use bulk_refusal::BulkRefusal; + +#[cfg(not(feature = "test-support"))] +pub(crate) use bulk_refusal::BulkRefusal; + pub fn bulk( db: &Db, actor: &str, |
