Skip to main content

euv_core/dynamic/manifest/
enum.rs

1use super::*;
2
3/// Distribution channel delivery mode sharing the exact same manifest, pinning, and rollback contract.
4#[derive(
5    Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
6)]
7#[serde(rename_all = "snake_case")]
8pub enum DeliveryChannelMode {
9    /// Executable sandboxed Wasm Component / WIT modules for channels permitting dynamic Wasm execution.
10    #[default]
11    WasmComponent,
12    /// Store-compliant Declarative Data channel (App Store / Google Play) interpreting signed UI/style/action specs only.
13    DeclarativeData,
14}
15
16/// Content classification of a single content-addressed release artifact.
17#[derive(
18    Clone, Copy, Debug, Default, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
19)]
20#[serde(rename_all = "snake_case")]
21pub enum ArtifactKind {
22    /// Executable WebAssembly component or core `.wasm` module.
23    #[default]
24    WasmComponent,
25    /// Signed declarative JSON `DynamicNodeSpec` / `DynamicUpdateBundle` payload.
26    DeclarativeSpec,
27    /// Immutable static resource bundle (fonts, icons, themes, tokens).
28    AssetBundle,
29}
30
31/// Comprehensive typed error taxonomy for manifest verification, negotiation, state recovery, and activation.
32#[derive(Clone, Debug, Eq, PartialEq)]
33pub enum DynamicReleaseError {
34    /// Release manifest signature was absent, malformed, or did not verify under the trusted key.
35    InvalidSignature(String),
36    /// Release or artifact ABI range does not include the host ABI version.
37    AbiIncompatible {
38        /// Running host ABI version.
39        host_abi: u32,
40        /// Minimum ABI required by the release or artifact.
41        min_abi: u32,
42        /// Maximum ABI supported by the release or artifact.
43        max_abi: u32,
44    },
45    /// Release delivery mode is incompatible with the client channel policy.
46    UnsupportedDeliveryMode {
47        /// Allowed client delivery mode.
48        allowed: DeliveryChannelMode,
49        /// Incoming release delivery mode.
50        incoming: DeliveryChannelMode,
51    },
52    /// Host lacks a capability required by the release or one of its artifacts.
53    MissingCapability(String),
54    /// Transitive dependency graph or hash closure is broken.
55    BrokenDependencyClosure(String),
56    /// Downloaded or cached blob bytes failed SHA-256 verification.
57    HashMismatch {
58        /// Expected 64-char SHA-256 hex digest.
59        expected: String,
60        /// Actual computed SHA-256 hex digest.
61        actual: String,
62    },
63    /// Incoming release sequence did not strictly advance over the active sequence.
64    NonMonotonicRelease {
65        /// Currently accepted release sequence.
66        current: u64,
67        /// Incoming release sequence.
68        incoming: u64,
69    },
70    /// Required content-addressed blob could not be found in cache or remote store.
71    BlobMissing(String),
72    /// Requested route is not declared in the pinned release manifest.
73    RouteNotFound(String),
74    /// Mounted component implementation does not satisfy the compile-time contract interface ID or version.
75    InterfaceMismatch {
76        /// Compile-time expected interface ID.
77        expected_interface: String,
78        /// Actual artifact interface ID.
79        actual_interface: String,
80    },
81    /// Pure background state migration failed or would lose active user draft state.
82    StateMigrationFailed(String),
83    /// Hot-swap was deferred because the UI is not at a safe interaction boundary.
84    UnsafeSwapPoint(String),
85    /// Delta catch-up from revision `R` to `R+n` failed because history wrapped or conflicted.
86    StateCatchUpConflict {
87        /// Snapshot base revision `R`.
88        base_revision: u64,
89        /// Live store revision `R+n`.
90        live_revision: u64,
91    },
92    /// Client/server protocol negotiation found no mutually compatible track or schema.
93    ProtocolIncompatible(String),
94    /// Network or HTTP/SSE transport failure.
95    NetworkError(String),
96    /// Serialization, deserialization, or local storage failure.
97    StorageError(String),
98}