Skip to main content

canic_host/deployment_truth/promotion/error/
provenance.rs

1use super::artifact_plan::ArtifactPromotionPlanError;
2use super::materialization::PromotionMaterializationIdentityReportError;
3use super::wasm_store::{
4    PromotionWasmStoreCatalogVerificationError, PromotionWasmStoreIdentityReportError,
5};
6use crate::deployment_truth::{PromotionReadinessStatusV1, SafetySeverityV1};
7use thiserror::Error as ThisError;
8
9///
10/// ArtifactPromotionProvenanceReportError
11///
12#[derive(Debug, ThisError)]
13pub enum ArtifactPromotionProvenanceReportError {
14    #[error(
15        "artifact promotion provenance report schema mismatch: expected {expected}, found {found}"
16    )]
17    SchemaVersionMismatch { expected: u32, found: u32 },
18    #[error("artifact promotion provenance report is missing required field: {field}")]
19    MissingRequiredField { field: &'static str },
20    #[error(
21        "artifact promotion provenance report status {status:?} does not match blocker count {blocker_count}"
22    )]
23    StatusBlockerMismatch {
24        status: PromotionReadinessStatusV1,
25        blocker_count: usize,
26    },
27    #[error("artifact promotion provenance report field {field} is inconsistent")]
28    LinkageMismatch { field: &'static str },
29    #[error("artifact promotion provenance report contains duplicate role: {role}")]
30    DuplicateRole { role: String },
31    #[error("artifact promotion provenance report blockers are stale")]
32    BlockerMismatch,
33    #[error("artifact promotion provenance report blocker has severity {severity:?}")]
34    BlockerSeverityMismatch { severity: SafetySeverityV1 },
35    #[error(
36        "artifact promotion provenance report field {field} must be a lowercase sha256 hex digest"
37    )]
38    InvalidSha256Digest { field: &'static str },
39    #[error("artifact promotion provenance report has invalid artifact promotion plan: {0}")]
40    Plan(#[from] ArtifactPromotionPlanError),
41    #[error("artifact promotion provenance report has invalid wasm-store identity report: {0}")]
42    WasmStoreIdentity(#[from] PromotionWasmStoreIdentityReportError),
43    #[error(
44        "artifact promotion provenance report has invalid wasm-store catalog verification: {0}"
45    )]
46    WasmStoreCatalog(#[from] PromotionWasmStoreCatalogVerificationError),
47    #[error(
48        "artifact promotion provenance report has invalid materialization identity report: {0}"
49    )]
50    MaterializationIdentity(#[from] PromotionMaterializationIdentityReportError),
51}
52
53///
54/// ArtifactPromotionExecutionReceiptError
55///
56#[derive(Debug, ThisError)]
57pub enum ArtifactPromotionExecutionReceiptError {
58    #[error(
59        "artifact promotion execution receipt schema mismatch: expected {expected}, found {found}"
60    )]
61    SchemaVersionMismatch { expected: u32, found: u32 },
62    #[error("artifact promotion execution receipt is missing required field: {field}")]
63    MissingRequiredField { field: &'static str },
64    #[error("artifact promotion execution receipt field {field} is inconsistent")]
65    LinkageMismatch { field: &'static str },
66    #[error("artifact promotion execution receipt contains unknown deployment role: {role}")]
67    UnknownDeploymentRole { role: String },
68    #[error("artifact promotion execution receipt is missing deployment role: {role}")]
69    MissingDeploymentRole { role: String },
70    #[error("artifact promotion execution receipt provenance status {status:?} is not ready")]
71    ProvenanceNotReady { status: PromotionReadinessStatusV1 },
72    #[error("artifact promotion execution receipt has invalid provenance report: {0}")]
73    Provenance(#[from] ArtifactPromotionProvenanceReportError),
74}