Skip to main content

canic_host/deployment_truth/promotion/error/
identity.rs

1use crate::deployment_truth::{PromotionReadinessStatusV1, SafetySeverityV1};
2use thiserror::Error as ThisError;
3
4///
5/// PromotionArtifactIdentityReportError
6///
7#[derive(Debug, ThisError)]
8pub enum PromotionArtifactIdentityReportError {
9    #[error(
10        "promotion artifact identity report schema mismatch: expected {expected}, found {found}"
11    )]
12    SchemaVersionMismatch { expected: u32, found: u32 },
13    #[error("promotion artifact identity report is missing required field: {field}")]
14    MissingRequiredField { field: &'static str },
15    #[error(
16        "promotion artifact identity report status {status:?} does not match blocker count {blocker_count}"
17    )]
18    StatusBlockerMismatch {
19        status: PromotionReadinessStatusV1,
20        blocker_count: usize,
21    },
22    #[error("promotion artifact identity report contains duplicate role: {role}")]
23    DuplicateRole { role: String },
24    #[error("promotion artifact identity report contains duplicate identity group: {identity_key}")]
25    DuplicateIdentityGroup { identity_key: String },
26    #[error("promotion artifact identity report identity group {identity_key} has no roles")]
27    EmptyIdentityGroup { identity_key: String },
28    #[error("promotion artifact identity report identity group contains unknown role: {role}")]
29    UnknownGroupedRole { role: String },
30    #[error("promotion artifact identity report groups role {role} more than once")]
31    DuplicateGroupedRole { role: String },
32    #[error("promotion artifact identity report does not group role: {role}")]
33    MissingGroupedRole { role: String },
34    #[error(
35        "promotion artifact identity report role {role} belongs to identity group {expected}, found {found}"
36    )]
37    IdentityGroupRoleMismatch {
38        role: String,
39        expected: String,
40        found: String,
41    },
42    #[error(
43        "promotion artifact identity report identity group key mismatch: expected {expected}, found {found}"
44    )]
45    IdentityGroupKeyMismatch { expected: String, found: String },
46    #[error("promotion artifact identity report summary field {field} is stale")]
47    SummaryMismatch { field: &'static str },
48    #[error("promotion artifact identity report field {field} is inconsistent")]
49    LinkageMismatch { field: &'static str },
50    #[error(
51        "promotion artifact identity report field {field} must be a lowercase sha256 hex digest"
52    )]
53    InvalidSha256Digest { field: &'static str },
54    #[error("promotion artifact identity report blocker has severity {severity:?}")]
55    BlockerSeverityMismatch { severity: SafetySeverityV1 },
56}