dpp_rules/lineage/status_defect.rs
1//! What the life-status consistency rule reports.
2
3/// Why a passport's life status does not agree with its derivation edges.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum StatusDefect<'a> {
7 /// The passport claims `original` while also claiming to derive from a
8 /// predecessor.
9 ///
10 /// An original unit is the one placed on the market, not the output of an
11 /// operation performed on something else, so any derivation edge contradicts
12 /// the claim. Carries the first offending operation rather than all of them:
13 /// one is enough to show the contradiction, and the edge list is the
14 /// caller's to report in full.
15 OriginalIsDerived {
16 /// The operation of the first derivation edge, in wire form.
17 operation: &'a str,
18 },
19 /// The passport claims a second-life status that no derivation edge
20 /// supports.
21 ///
22 /// Either the edges name a different operation, or there are none at all —
23 /// which are the same defect from this rule's point of view, since both
24 /// leave the claimed operation unrecorded. Whether the edge that *is* there
25 /// carries its predecessor's consent is [`super::consent`]'s question.
26 NoEdgeSupportsStatus {
27 /// The status the passport claims, in wire form.
28 status: &'a str,
29 },
30 /// The status is not one of the five values Annex XIII point 4(c)
31 /// enumerates.
32 ///
33 /// Unreachable from core, whose `LifeStatus` is a closed enum, and the
34 /// reason this variant exists anyway is the Wasm plugins: they hand this
35 /// crate JSON string fields, so an unknown value is a shape a caller really
36 /// can produce. Reported rather than ignored — a status outside the annex is
37 /// an invented value, and the fail-open reading would be to treat it as
38 /// consistent with anything.
39 UnknownStatus {
40 /// What the passport carried.
41 status: &'a str,
42 },
43}