liminal_protocol/outcome/startup.rs
1/// Receipt/identity configuration field subject to the nonzero check.
2#[derive(Clone, Copy, Debug, PartialEq, Eq)]
3pub enum CapabilityLimitField {
4 /// Attach-receipt lifetime in milliseconds.
5 AttachReceiptTtlMs,
6 /// Receipt-provenance lifetime in milliseconds.
7 ReceiptProvenanceTtlMs,
8 /// Server-wide live attach-receipt capacity.
9 MaxLiveAttachReceiptsServer,
10 /// Per-participant live attach-receipt capacity.
11 MaxLiveAttachReceiptsPerParticipant,
12 /// Server-wide receipt-provenance capacity.
13 MaxReceiptProvenanceServer,
14 /// Per-conversation receipt-provenance capacity.
15 MaxReceiptProvenancePerConversation,
16 /// Per-participant receipt-provenance capacity.
17 MaxReceiptProvenancePerParticipant,
18 /// Server-wide retired identity-slot capacity.
19 MaxRetiredIdentitySlotsServer,
20 /// Per-conversation retired identity-slot capacity.
21 MaxRetiredIdentitySlotsPerConversation,
22}
23
24/// Participant receipt/identity configuration is invalid.
25///
26/// Each variant is the exact flat dimension body; no generic reason or
27/// optional operand bag exists.
28#[derive(Clone, Copy, Debug, PartialEq, Eq)]
29pub enum ParticipantCapabilityConfigurationInvalid {
30 /// First signed capability limit in validation order was zero.
31 NonzeroLimit {
32 /// Offending configuration field.
33 field: CapabilityLimitField,
34 /// Actual value, which is zero for this variant.
35 actual: u64,
36 /// Required minimum, which is one for this variant.
37 required_minimum: u64,
38 },
39 /// Receipt provenance would expire before the receipt.
40 ReceiptDeadlineOrder {
41 /// Signed attach-receipt lifetime.
42 attach_receipt_ttl_ms: u64,
43 /// Signed receipt-provenance lifetime.
44 receipt_provenance_ttl_ms: u64,
45 /// Required minimum provenance lifetime.
46 required_minimum_provenance_ttl_ms: u64,
47 },
48}
49
50/// Participant retention configuration failed its fixed startup validation.
51///
52/// `SuccessorOccurrenceArray` is deliberately absent under
53/// `docs/design/LP-EXTRACTION-GOAL.md` Fix 2: cursor-progress accounting is
54/// per participant and no serialized fixed occurrence array is part of this
55/// crate's state model.
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57pub enum ParticipantRetentionCapacityInvalid {
58 /// Configured retained-entry capacity is below the exact required value.
59 EntryCapacity {
60 /// Exact widened required entry capacity.
61 required: u128,
62 /// Configured retained-entry capacity.
63 configured: u64,
64 },
65 /// Configured retained-byte capacity is below the exact required value.
66 ByteCapacity {
67 /// Exact widened required byte capacity.
68 required: u128,
69 /// Configured retained-byte capacity.
70 configured: u64,
71 },
72 /// Episode churn limit is outside the proved bounded domain.
73 EpisodeChurnLimit {
74 /// Configured raw episode churn limit.
75 configured: u64,
76 /// Required minimum, which is two.
77 required_minimum: u64,
78 /// Required maximum, which is `u32::MAX`.
79 required_maximum: u64,
80 },
81}
82
83/// Connection-incarnation mint exhausted one monotonic component.
84///
85/// The enum shape fixes `current_value` to `u64::MAX` and makes the server arm
86/// carry no attempted incarnation while the ordinal arm always carries one.
87#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88pub enum ConnectionIncarnationExhausted {
89 /// Persisted server-incarnation counter is exhausted.
90 ServerIncarnation,
91 /// Connection ordinal is exhausted for this server incarnation.
92 ConnectionOrdinal {
93 /// Current server incarnation whose ordinal space is exhausted.
94 attempted_server_incarnation: u64,
95 },
96}
97
98impl ConnectionIncarnationExhausted {
99 /// Returns the terminal current component value.
100 #[must_use]
101 pub const fn current_value(self) -> u64 {
102 let _ = self;
103 u64::MAX
104 }
105
106 /// Returns the attempted server incarnation only for ordinal exhaustion.
107 #[must_use]
108 pub const fn attempted_server_incarnation(self) -> Option<u64> {
109 match self {
110 Self::ServerIncarnation => None,
111 Self::ConnectionOrdinal {
112 attempted_server_incarnation,
113 } => Some(attempted_server_incarnation),
114 }
115 }
116}