canic_host/deployment_truth/promotion/error/
materialization.rs1use crate::deployment_truth::{PromotionReadinessStatusV1, SafetySeverityV1};
2use thiserror::Error as ThisError;
3
4#[derive(Debug, ThisError)]
8pub enum PromotionMaterializationIdentityError {
9 #[error(
10 "promotion materialization identity schema mismatch: expected {expected}, found {found}"
11 )]
12 SchemaVersionMismatch { expected: u32, found: u32 },
13 #[error("promotion materialization identity is missing required field: {field}")]
14 MissingRequiredField { field: &'static str },
15 #[error(
16 "promotion materialization identity field {field} must be a lowercase sha256 hex digest"
17 )]
18 InvalidSha256Digest { field: &'static str },
19 #[error("promotion materialization identity field {field} is inconsistent")]
20 LinkageMismatch { field: &'static str },
21 #[error(
22 "promotion materialization identity digest mismatch for {field}: expected {expected}, found {found}"
23 )]
24 DigestMismatch {
25 field: &'static str,
26 expected: String,
27 found: String,
28 },
29}
30
31#[derive(Debug, ThisError)]
35pub enum PromotionMaterializationIdentityReportError {
36 #[error(
37 "promotion materialization identity report schema mismatch: expected {expected}, found {found}"
38 )]
39 SchemaVersionMismatch { expected: u32, found: u32 },
40 #[error("promotion materialization identity report is missing required field: {field}")]
41 MissingRequiredField { field: &'static str },
42 #[error(
43 "promotion materialization identity report status {status:?} does not match blocker count {blocker_count}"
44 )]
45 StatusBlockerMismatch {
46 status: PromotionReadinessStatusV1,
47 blocker_count: usize,
48 },
49 #[error("promotion materialization identity report contains duplicate role: {role}")]
50 DuplicateRole { role: String },
51 #[error("promotion materialization identity report contains duplicate evidence: {evidence_id}")]
52 DuplicateEvidence { evidence_id: String },
53 #[error(
54 "promotion materialization identity report contains duplicate output group: {output_identity_key}"
55 )]
56 DuplicateOutputGroup { output_identity_key: String },
57 #[error(
58 "promotion materialization identity report output group {output_identity_key} has no roles"
59 )]
60 EmptyOutputGroup { output_identity_key: String },
61 #[error("promotion materialization identity report output group contains unknown role: {role}")]
62 UnknownGroupedRole { role: String },
63 #[error("promotion materialization identity report groups role {role} more than once")]
64 DuplicateGroupedRole { role: String },
65 #[error("promotion materialization identity report does not group role: {role}")]
66 MissingGroupedRole { role: String },
67 #[error(
68 "promotion materialization identity report role {role} belongs to output group {expected}, found {found}"
69 )]
70 OutputGroupRoleMismatch {
71 role: String,
72 expected: String,
73 found: String,
74 },
75 #[error(
76 "promotion materialization identity report output group key mismatch: expected {expected}, found {found}"
77 )]
78 OutputGroupKeyMismatch { expected: String, found: String },
79 #[error("promotion materialization identity report field {field} is inconsistent")]
80 LinkageMismatch { field: &'static str },
81 #[error(
82 "promotion materialization identity report field {field} must be a lowercase sha256 hex digest"
83 )]
84 InvalidSha256Digest { field: &'static str },
85 #[error("promotion materialization identity report blockers are stale")]
86 BlockerMismatch,
87 #[error("promotion materialization identity report blocker has severity {severity:?}")]
88 BlockerSeverityMismatch { severity: SafetySeverityV1 },
89 #[error("promotion materialization identity report has invalid materialization evidence: {0}")]
90 Materialization(#[from] PromotionMaterializationIdentityError),
91}