canic_host/deployment_truth/promotion/error/
policy.rs1use crate::deployment_truth::{
2 PromotionArtifactLevelV1, PromotionReadinessStatusV1, SafetySeverityV1,
3};
4use thiserror::Error as ThisError;
5
6#[derive(Debug, ThisError)]
10pub enum PromotionPolicyCheckError {
11 #[error("promotion policy check schema mismatch: expected {expected}, found {found}")]
12 SchemaVersionMismatch { expected: u32, found: u32 },
13 #[error("promotion policy check is missing required field: {field}")]
14 MissingRequiredField { field: &'static str },
15 #[error(
16 "promotion policy check status {status:?} does not match blocker count {blocker_count}"
17 )]
18 StatusBlockerMismatch {
19 status: PromotionReadinessStatusV1,
20 blocker_count: usize,
21 },
22 #[error("promotion policy check contains duplicate role: {role}")]
23 DuplicateRole { role: String },
24 #[error("promotion policy for role {role} has duplicate allowed level {level:?}")]
25 DuplicateAllowedLevel {
26 role: String,
27 level: PromotionArtifactLevelV1,
28 },
29 #[error("promotion policy for role {role} has no allowed promotion levels")]
30 EmptyAllowedLevels { role: String },
31 #[error("promotion policy decision for role {role} has inconsistent field {field}")]
32 DecisionMismatch { role: String, field: &'static str },
33 #[error("promotion policy check field {field} is inconsistent")]
34 LinkageMismatch { field: &'static str },
35 #[error("promotion policy check field {field} must be a lowercase sha256 hex digest")]
36 InvalidSha256Digest { field: &'static str },
37 #[error("promotion policy check blocker has severity {severity:?}")]
38 BlockerSeverityMismatch { severity: SafetySeverityV1 },
39}