Skip to main content

canic_host/component_operation/
mod.rs

1//! Module: component_operation
2//!
3//! Responsibility: review and reconcile one operator-requested Component.
4//! Boundary: Root owns provisioning; the host retains exact submission authority.
5
6pub mod model;
7pub mod ops;
8pub mod policy;
9#[cfg(test)]
10mod tests;
11pub mod view;
12pub mod workflow;
13
14use std::io;
15use thiserror::Error;
16
17/// Typed host failure; remote protocol errors retain their originating diagnostic.
18#[derive(Debug, Error)]
19pub enum ComponentOperationError {
20    #[error("Component operation authority changed: {field}; preserve the existing operation")]
21    Authority { field: &'static str },
22
23    #[error("Component operation has no Ready pool asset; review Root capacity before applying")]
24    Capacity,
25
26    #[error(transparent)]
27    Inventory(#[from] crate::fleet_ensure::CurrentFleetInventoryError),
28
29    #[error(transparent)]
30    Icp(#[from] crate::icp::IcpCommandError),
31
32    #[error("invalid Component operation label: {0}")]
33    InvalidLabel(String),
34
35    #[error("Component operation record failed integrity validation")]
36    Integrity,
37
38    #[error(transparent)]
39    Io(#[from] io::Error),
40
41    #[error(transparent)]
42    Json(#[from] serde_json::Error),
43
44    #[error("Component operation has no retained review")]
45    Missing,
46
47    #[error(transparent)]
48    Network(#[from] crate::network::NetworkIdentityError),
49
50    #[error("Component operation progress conflicts with its reviewed authority")]
51    Progress,
52
53    #[error(transparent)]
54    Protocol(#[from] crate::CanisterProtocolError),
55
56    #[error(transparent)]
57    ProtocolBinding(#[from] crate::protocol_binding::ProtocolBindingError),
58
59    #[error("Component operation review digest differs from --review")]
60    Review,
61
62    #[error("Component Spec is not admitted on the selected Root")]
63    Spec,
64
65    #[error(transparent)]
66    State(#[from] crate::fleet_ensure::ops::EnsureStateError),
67}