canic_host/deployment_truth/promotion/error/
transform.rs1use super::materialization::PromotionMaterializationIdentityError;
2use super::readiness::PromotionReadinessError;
3use crate::deployment_truth::executor::DeploymentExecutionPreflightError;
4use thiserror::Error as ThisError;
5
6#[derive(Debug, ThisError)]
10pub enum PromotionPlanTransformError {
11 #[error("promotion plan transform schema mismatch: expected {expected}, found {found}")]
12 SchemaVersionMismatch { expected: u32, found: u32 },
13 #[error("promotion plan transform is missing required field: {field}")]
14 MissingRequiredField { field: &'static str },
15 #[error("promotion readiness validation failed: {0}")]
16 Readiness(#[from] PromotionReadinessError),
17 #[error("promotion readiness is blocked with {blocker_count} blocker(s)")]
18 ReadinessBlocked { blocker_count: usize },
19 #[error("promotion target plan is missing role: {role}")]
20 TargetRoleMissing { role: String },
21 #[error("promotion transform contains duplicate source/build materialization for role: {role}")]
22 DuplicateMaterializationRole { role: String },
23 #[error(
24 "promotion transform is missing source/build materialization evidence for role: {role}"
25 )]
26 MaterializationRoleMissing { role: String },
27 #[error(
28 "promotion transform contains unexpected source/build materialization for role: {role}"
29 )]
30 UnexpectedMaterializationRole { role: String },
31 #[error("promotion materialization evidence is invalid: {0}")]
32 Materialization(#[from] PromotionMaterializationIdentityError),
33 #[error("promotion transform contains duplicate role: {role}")]
34 DuplicateRole { role: String },
35 #[error("promotion transform promoted plan id mismatch: expected {expected}, found {found}")]
36 PromotedPlanIdMismatch { expected: String, found: String },
37 #[error("promotion transform role {role} is missing from promoted plan")]
38 PromotedRoleMissing { role: String },
39 #[error("promotion transform role {role} has inconsistent field {field}")]
40 RoleStateMismatch { role: String, field: &'static str },
41}
42
43#[derive(Debug, ThisError)]
47pub enum PromotionPlanTransformEvidenceError {
48 #[error(
49 "promotion plan transform evidence schema mismatch: expected {expected}, found {found}"
50 )]
51 SchemaVersionMismatch { expected: u32, found: u32 },
52 #[error("promotion plan transform evidence is missing required field: {field}")]
53 MissingRequiredField { field: &'static str },
54 #[error(
55 "promotion plan transform evidence field {field} must be a lowercase sha256 hex digest"
56 )]
57 InvalidSha256Digest { field: &'static str },
58 #[error("promotion plan transform evidence field {field} is inconsistent")]
59 LinkageMismatch { field: &'static str },
60 #[error("promotion plan transform evidence has invalid transform: {0}")]
61 Transform(#[from] PromotionPlanTransformError),
62}
63
64#[derive(Debug, ThisError)]
68pub enum PromotionTargetExecutionLineageError {
69 #[error(
70 "promotion target execution lineage schema mismatch: expected {expected}, found {found}"
71 )]
72 SchemaVersionMismatch { expected: u32, found: u32 },
73 #[error("promotion target execution lineage is missing required field: {field}")]
74 MissingRequiredField { field: &'static str },
75 #[error(
76 "promotion target execution lineage field {field} must be a lowercase sha256 hex digest"
77 )]
78 InvalidSha256Digest { field: &'static str },
79 #[error("promotion target execution lineage has invalid transform: {0}")]
80 Transform(#[from] PromotionPlanTransformError),
81 #[error("promotion target execution lineage has invalid execution preflight: {0}")]
82 Preflight(#[from] DeploymentExecutionPreflightError),
83 #[error("promotion target execution lineage field {field} is inconsistent")]
84 LinkageMismatch { field: &'static str },
85 #[error("promotion target execution lineage must not claim execution occurred")]
86 ExecutionAttempted,
87}