Skip to main content

canic_host/deployment_truth/promotion/error/
wasm_store.rs

1use crate::deployment_truth::{PromotionReadinessStatusV1, SafetySeverityV1};
2use thiserror::Error as ThisError;
3
4///
5/// PromotionWasmStoreIdentityReportError
6///
7#[derive(Debug, ThisError)]
8pub enum PromotionWasmStoreIdentityReportError {
9    #[error(
10        "promotion wasm-store identity report schema mismatch: expected {expected}, found {found}"
11    )]
12    SchemaVersionMismatch { expected: u32, found: u32 },
13    #[error("promotion wasm-store identity report is missing required field: {field}")]
14    MissingRequiredField { field: &'static str },
15    #[error(
16        "promotion wasm-store 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 wasm-store identity report contains duplicate role: {role}")]
23    DuplicateRole { role: String },
24    #[error(
25        "promotion wasm-store identity report staging receipt schema mismatch for role {role}: expected {expected}, found {found}"
26    )]
27    StagingReceiptSchemaVersionMismatch {
28        role: String,
29        expected: u32,
30        found: u32,
31    },
32    #[error("promotion wasm-store identity report blockers are stale")]
33    BlockerMismatch,
34    #[error("promotion wasm-store identity report field {field} is inconsistent")]
35    LinkageMismatch { field: &'static str },
36    #[error(
37        "promotion wasm-store identity report field {field} must be a lowercase sha256 hex digest"
38    )]
39    InvalidSha256Digest { field: &'static str },
40    #[error("promotion wasm-store identity report blocker has severity {severity:?}")]
41    BlockerSeverityMismatch { severity: SafetySeverityV1 },
42}
43
44///
45/// PromotionWasmStoreCatalogVerificationError
46///
47#[derive(Debug, ThisError)]
48pub enum PromotionWasmStoreCatalogVerificationError {
49    #[error(
50        "promotion wasm-store catalog verification schema mismatch: expected {expected}, found {found}"
51    )]
52    SchemaVersionMismatch { expected: u32, found: u32 },
53    #[error("promotion wasm-store catalog verification is missing required field: {field}")]
54    MissingRequiredField { field: &'static str },
55    #[error(
56        "promotion wasm-store catalog verification status {status:?} does not match blocker count {blocker_count}"
57    )]
58    StatusBlockerMismatch {
59        status: PromotionReadinessStatusV1,
60        blocker_count: usize,
61    },
62    #[error("promotion wasm-store catalog verification contains duplicate role: {role}")]
63    DuplicateRole { role: String },
64    #[error("promotion wasm-store catalog verification contains duplicate locator: {locator}")]
65    DuplicateLocator { locator: String },
66    #[error("promotion wasm-store catalog verification role {role} has inconsistent field {field}")]
67    RoleMismatch { role: String, field: &'static str },
68    #[error("promotion wasm-store catalog verification field {field} is inconsistent")]
69    LinkageMismatch { field: &'static str },
70    #[error(
71        "promotion wasm-store catalog verification field {field} must be a lowercase sha256 hex digest"
72    )]
73    InvalidSha256Digest { field: &'static str },
74    #[error("promotion wasm-store catalog verification blockers are stale")]
75    BlockerMismatch,
76    #[error("promotion wasm-store catalog verification blocker has severity {severity:?}")]
77    BlockerSeverityMismatch { severity: SafetySeverityV1 },
78    #[error(
79        "promotion wasm-store catalog verification has invalid wasm-store identity report: {0}"
80    )]
81    WasmStoreIdentity(#[from] PromotionWasmStoreIdentityReportError),
82}