daemonic_error 0.1.0

Errors that compose, predict, and leave receipts - Compose: algebraic combination (in active development) - Predict: Glass/Severity - Receipts: audit trail, position, checksum - Reflection: Runtime Reflection through TopologySegment (in active development)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
//! Glass<GLASS> — The observation effect.
//!
//! Models a transition that produced (or failed to produce) a GLASS object (mirror).
//! GLASS is not inside the Glass. GLASS IS what was reflected through it.
//! The glass state describes what happened during the transition.
//!
//! Glass is the step, not the destination.
//! Meaning lives in the steps between nodes.
//!
//! # Glass as Pattern Matching Engine
//!
//! Glass<GLASS> is the type-level expression of a self-bootstrapping pattern matcher.
//! Every Glass implementation is a template. Every observation through Glass is a match
//! operation. Every match result is a new template. The system generates its own matching
//! patterns through operation.
//!
//! # Sizing Invariant
//!
//! Glass is FRAME AGNOSTIC with respect to sizing. Both Sized and Unsized types
//! can implement this trait. The `GLASS` type parameter carries no `Sized` bound.
//! Methods that require moving the payload by value (`into_payload`) are gated
//! behind `where Self: Sized`. This is not a limitation — it's correct behavior.
//! An unsized type's Glass can be observed but not consumed.
//!
//! If the Glass can only handle Sized OR Unsized objects but not both,
//! that is DESIGN FAILURE.
// pub use crate::daemonic::observation::display::*;
use alloc::string::{String, ToString};
use core::fmt::Pointer;
use core::ops::{ControlFlow, FromResidual, Try};
use crate::daemonic::{
	// Anchorable,
                      Daemonic, SymbolicAnchor, TopologySegment};
use crate::daemonic::{Anchor, AnchorDomainSet, TemporalAnchor};
use crate::{const_daemonic_hash, DaemonicError, AXIOM_OFFSET};
pub mod error;
pub mod states;
pub mod primitive_implementations;
pub mod daemonic_path_buffer;
pub use error::*;
use crate::daemonic::glass::daemonic_system_call::DaemonicSystemCall;
use crate::daemonic::TopologyAnchor;


// ═══════════════════════════════════════════════════════════════
// SEVERITY (Primary axis: match quality)
// ═══════════════════════════════════════════════════════════════

/// Primary axis: what survived the transition.
///
/// Severity is the MATCH QUALITY of the observation — how well the input
/// resolved against the Glass. Every Glass observation produces a Severity.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Severity {
	/// Perfect match. Payload guaranteed.
	Stable,
	/// Partial match with minor discrepancies. Payload present but annotated.
	Cracked,
	/// Partial match with significant loss. Payload may or may not be present.
	Fracture,
	/// The observation changed between measurements.
	Drift,
	/// The observation came back different from what was sent.
	Warp,
	/// Complete match failure. No usable payload.
	Shattered,
	/// This state should not exist. Physics/axiom violation.
	Impossible,
	/// Multiple contradictory but individually valid matches.
	Paradox,
	/// Match exists but cannot be observed from this reference frame.
	Opaque,
	/// Valid observation from a different temporal frame.
	Echo,
	/// Matching has not been attempted.
	Unknown,
}

// ═══════════════════════════════════════════════════════════════
// OBSERVATION TIER
// ═══════════════════════════════════════════════════════════════

/// At what abstraction tier was this observation made?
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ObservationTier {
	/// Cannot be broken down further. Finite, fully enumerable.
	Absolute,
	/// Conceptually atomic but substrate-decomposable. u8, i32, bool, char.
	Primitive,
	/// Structures composed from primitives. Most application types.
	Composed,
	/// Symbols that carry their own instruction logic. Glass states, errors.
	GlyphicExecutable,
}

// ═══════════════════════════════════════════════════════════════
// SUPPORTING ENUMS
// ═══════════════════════════════════════════════════════════════

/// What's attached to the observation
#[derive(Debug, Clone)]
pub enum Annotation {
	None,
	Note(String),
	Help(String),
	Suggestion(String),
	/// Sensitive annotation — redacted in serialized output
	Sensitive(String),
}

/// When did this observation originate relative to current frame
#[derive(Debug, Clone)]
pub enum Temporal {
	Current,
	Echo { original_tick: u64 },
	Drift { from_severity: Severity, to_severity: Severity },
}

impl Anchor for Temporal {
	fn anchor_domains(&self) -> AnchorDomainSet {
		AnchorDomainSet::TEMPORAL
	}
}

impl TemporalAnchor for Temporal {
	fn anchor_tick(&self) -> u64 {
		1
	}
}
/// Can the observer see through
#[derive(Debug, Clone)]
pub enum Accessibility {
	Clear,
	Opaque { reason: String },
}


/// One observation or contradictory multiples
#[derive(Debug, Clone, Copy)]
pub enum Consistency {
	Singular,
	Paradox,
}

/// Has fidelity been assessed
#[derive(Debug, Clone, Copy)]
pub enum Assessment {
	Assessed,
	Unknown,
}

/// What should the observer do
#[derive(Debug, Clone, Copy)]
pub enum FidelityAction {
	Continue,
	Attend,
	Warn,
	Halt,
	Abort,
	/// Emergency containment — destroy the Glass to prevent propagation.
	Drop,
}

// ═══════════════════════════════════════════════════════════════
// GLASS TRAIT
// ═══════════════════════════════════════════════════════════════

/// The core observation trait. Everything passes through Glass.
/// ```text
/// Glass ≅ ∀F. (Glass → F(Glass)) → F(Glass)
/// ```
pub trait Glass<GLASS: ?Sized>:
// ?Send
// + ?Sync
// + DaemonicSystemCall
{
	type Anchor: TopologyAnchor;
	// ── Axes (what happened during this transition) ─────
	
	fn position(&self) -> &TopologySegment;
	fn severity(&self) -> Severity;
	
	fn annotation(&self) -> Annotation {
		Annotation::None
	}
	
	fn temporal(&self) -> Temporal {
		Temporal::Current
	}
	
	fn accessibility(&self) -> Accessibility {
		Accessibility::Clear
	}
	
	fn consistency(&self) -> Consistency {
		Consistency::Singular
	}
	
	fn assessment(&self) -> Assessment {
		Assessment::Unknown
	}
	
	fn tier(&self) -> ObservationTier {
		ObservationTier::Composed
	}
	
	// ── Payload (what resulted from this transition) ────
	
	fn payload(&self) -> Option<&GLASS>;
	
	fn into_payload(self) -> Option<GLASS>
		where
			Self: Sized,
			GLASS: Sized;
	
	// ── Derived (free, computed from axes) ──────────────
	
	fn fidelity_action(&self) -> FidelityAction {
		severity_to_fidelity(self.severity())
	}
	
	fn has_payload(&self) -> bool {
		self.payload().is_some()
	}
	
	fn is_clear(&self) -> bool {
		matches!(self.severity(), Severity::Stable)
			&& matches!(self.assessment(), Assessment::Assessed)
	}
	
	// ── Reporting (type-erased observation export) ──────
	
	fn as_report(&self) -> GlassReport {
		GlassReport {
			position: self.position().clone(),
			severity: self.severity(),
			tier: self.tier(),
			annotation: self.annotation(),
			temporal: self.temporal(),
			accessibility: self.accessibility(),
			consistency: self.consistency(),
			assessment: self.assessment(),
			fidelity_action: self.fidelity_action(),
		}
	}
}

/// Map severity to fidelity action.
pub fn severity_to_fidelity(severity: Severity) -> FidelityAction {
	match severity {
		Severity::Stable => FidelityAction::Continue,
		Severity::Cracked => FidelityAction::Warn,
		Severity::Fracture => FidelityAction::Halt,
		Severity::Warp => FidelityAction::Halt,
		Severity::Shattered => FidelityAction::Halt,
		Severity::Impossible => FidelityAction::Abort,
		Severity::Unknown => FidelityAction::Attend,
		Severity::Drift => FidelityAction::Attend,
		Severity::Paradox => FidelityAction::Warn,
		Severity::Opaque => FidelityAction::Halt,
		Severity::Echo => FidelityAction::Attend,
	}
}

// ═══════════════════════════════════════════════════════════════
// GLASS REPORT (type-erased observation)
// ═══════════════════════════════════════════════════════════════

/// Type-erased Glass observation report.
/// Contains all observation AXES but not the PAYLOAD.
/// Universal exchange format for Glass observations.
// #[derive(Debug, Clone)]
pub struct GlassReport {
	pub position: TopologySegment,
	pub severity: Severity,
	pub tier: ObservationTier,
	pub annotation: Annotation,
	pub temporal: Temporal,
	pub accessibility: Accessibility,
	pub consistency: Consistency,
	pub assessment: Assessment,
	pub fidelity_action: FidelityAction,
}

impl GlassReport {
	pub fn is_clear(&self) -> bool {
		matches!(self.severity, Severity::Stable)
			&& matches!(self.assessment, Assessment::Assessed)
	}
	
	pub fn needs_attention(&self) -> bool {
		!matches!(self.fidelity_action, FidelityAction::Continue)
	}
	
	pub fn category(&self) -> &str {
		todo!(
			"GlassReport::category() is not yet implemented"
		)
	}
}

// ═══════════════════════════════════════════════════════════════
// GLASS STATE TRAITS
// ═══════════════════════════════════════════════════════════════

/// Guaranteed payload — Stable ALWAYS has a value.
pub use states::*;
/// Clear glass. Payload guaranteed. Passthrough.
///
/// Types implementing GlassStable are making a compile-time
/// promise: there IS a value here. Not Option. Not maybe.
/// The transition succeeded fully.
pub use {GlassStable, StableAnnotation};
/// Damaged but contained. Non-propagating.
/// The crack exists but isn't spreading.
/// Key property: can_cascade returns false.
pub use {GlassCracked, CrackedAnnotation};
/// Information lost. Structure holds but data is incomplete.
/// Unlike Cracked, Fracture CAN cascade.
pub use {GlassFracture, FractureAnnotation};
/// Total information loss. Nothing came through.
/// The glass absorbed everything.
/// May carry debris — fragments that can be inspected
/// but not used as values.
pub use {GlassShattered, ShatteredAnnotation};
/// Unassessed observation. Fidelity genuinely unknown.
/// Payload may or may not exist.
/// Not an error — just hasn't been evaluated yet.
/// Resolution: re-observe with more context.
pub use {GlassUnknown, UnknownAnnotation};
/// Temporally displaced observation.
/// Data may be perfect but it's from a different time.
/// The reflection arrived late.
pub use {GlassEcho, EchoAnnotation};
/// Should not exist. Medium or observer is broken.
/// Propagation ceiling exceeded. Laws violated.
/// If you're holding this, something is deeply wrong
/// and it's not the data — it's the system.
/// Impossible (hard): The state CANNOT be constructed. The type system prevents it. 
/// If you're holding an Impossible, a language invariant broke — the compiler failed to prevent something it should have prevented. 
/// This is a substrate-level failure. The entity didn't do anything wrong. The floor fell out from under it. 
/// The correct response is Broken Sword — document everything and terminate, 
/// because the system's guarantees have been violated and nothing can be trusted.
/// Paradox (soft impossible): The state LOOKS impossible from the current reference 
/// frame but might be valid from another frame. Incomplete context produces apparent 
/// impossibility. Two observations that each survive adversarial testing independently but 
/// contradict each other. This isn't a substrate failure — it's an information failure. The
/// correct response is Attend, not Abort. Gather more context. Check other frames. The paradox
/// might resolve with additional observation.
pub use {GlassImpossible, ImpossibleAnnotation};
/// Faithful but uninterpretable by current observer.
/// Information exists behind the glass but can't be seen through.
/// The Black glass protocol's external face.
pub use {GlassOpaque, OpaqueAnnotation};
/// Irreversible transformation. State cannot be trusted.
/// What came back is not what was sent.
/// Non-reversible by definition.
pub use {GlassWarp, WarpAnnotation};
/// glass state changed during observation.
/// The observation is smeared across a fidelity transition.
/// Need both the starting and ending state to interpret.
pub use {GlassDrift, DriftAnnotation};
// use libc::libc::c_int;
use crate::daemonic::topology::TOPOLOGY_ANCHOR;
// ═══════════════════════════════════════════════════════════════
// CONCRETE OBSERVATION TYPE
// ═══════════════════════════════════════════════════════════════

/// A generic struct representing an observation. It holds information about 
/// the observation's position, severity, tier, annotation, temporal context, 
/// and an optional payload containing additional data.
///
/// # Type Parameters
/// - `GLASS`: A generic type representing the payload data associated with the 
///   observation. This can be used to store additional information specific to 
///   the observation's context or domain.
///
/// # Fields
/// - `position` (`Position`): The spatial information or location associated 
///   with the observation.
/// - `severity` (`Severity`): A measure of the seriousness or importance of 
///   the observation.
/// - `tier` (`ObservationTier`): The classification or level of the observation, 
///   providing additional contextual grouping.
/// - `annotation` (`Annotation`): Any textual notes or metadata that further 
///   detail or explain the observation.
/// - `temporal` (`Temporal`): The time-related information or timestamp 
///   describing when the observation occurred or applies.
/// - `payload` (`Option<GLASS>`): Optional additional data related to the 
///   observation, which can be of any type determined by the `GLASS` parameter.
pub struct Observation<GLASS> {
	pub position: &'static TopologySegment,
	pub severity: Severity,
	pub tier: ObservationTier,
	pub annotation: Annotation,
	pub temporal: Temporal,
	pub payload: Option<GLASS>,
}

impl<GLASS> Observation<GLASS> {
	pub(crate) fn to_errno(&self) -> i32 {
		0i32
		// todo fix this
		// escalated observations store negative syscall return
		// negate to get positive errno
		// -(self.payload.unwrap_or(0)) as i32
		
	}
}


/// Observation implements Try so ? works in formatting chains.
/// Stable/Cracked → Continue (formatting succeeded, proceed).
/// Everything else → Break (formatting failed, propagate).
impl<GLASS> Try for Observation<GLASS> {
	type Output = GLASS;
	type Residual = Observation<core::convert::Infallible>;
	
	fn from_output(output: Self::Output) -> Self {
		Observation::stable(output, &TopologySegment::new(&"Daemonic::Glass::Try::stable"))
	}
	
	fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {
		match self.severity {
			Severity::Stable | Severity::Cracked => {
				match self.payload {
					Some(value) => ControlFlow::Continue(value),
					None => ControlFlow::Break(Observation {
						position: self.position,
						severity: self.severity,
						tier: self.tier,
						annotation: self.annotation,
						temporal: self.temporal,
						payload: None,
					}),
				}
			}
			_ => ControlFlow::Break(Observation {
				position: self.position,
				severity: self.severity,
				tier: self.tier,
				annotation: self.annotation,
				temporal: self.temporal,
				payload: None,
			}),
		}
	}
}
impl<GLASS> FromResidual<Observation<core::convert::Infallible>> for Observation<GLASS> {
	fn from_residual(residual: Observation<core::convert::Infallible>) -> Self {
		Observation {
			position: residual.position,
			severity: residual.severity,
			tier: residual.tier,
			annotation: residual.annotation,
			temporal: residual.temporal,
			payload: None,
		}
	}
}

// Also implement FromResidual for Result interop
// so ? works on Result inside formatting functions
impl<GLASS> FromResidual<Result<core::convert::Infallible, core::fmt::Error>> for Observation<GLASS> {
	fn from_residual(_residual: Result<core::convert::Infallible, core::fmt::Error>) -> Self {
		Observation::shattered(
			&TopologySegment::new(&"Daemonic::Glass::Try::fmt_error")
		).with_note("std::fmt::Error converted to Glass")
	}
}
static OBSERVATION_TOPOLOGY_ANCH0R: TopologySegment = TopologySegment {
	label: "Daemonic::Glass::Observation<()>",
	hash: const_daemonic_hash(
		"Daemonic::Glass::Observation<()>".as_bytes(),
		AXIOM_OFFSET,
	),
	crypto_id: const_daemonic_hash("Daemonic::Glass::Observation<()>".as_bytes(), TOPOLOGY_ANCHOR),
	depth: 3u16,
};
impl<GLASS> Observation<GLASS> {
	/// Construct a Stable observation with payload
	pub fn stable(value: GLASS, position: &TopologySegment) -> Self {
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Stable,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: Some(value),
		}
	}
	pub fn cracked(value: Option<GLASS>, position: &TopologySegment) -> Self {
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Cracked,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: value,
		}
	}
	pub fn warp(value: Option<GLASS>, position: &TopologySegment) -> Self
		where
			Self: Sized,
	{
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Warp,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: value,
		}
	}
	pub fn drift(value: Option<GLASS>, position: &TopologySegment) -> Self
		where
			Self: Sized,
	{
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Drift,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: value,
		}
	}
	pub fn opaque(position: &TopologySegment) -> Self
		where
			Self: Sized,
	{
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Opaque,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: None,
		}
	}
	/// Construct a Shattered observation (no payload)
	pub fn shattered(position: &TopologySegment) -> Self
		where
			Self: Sized,
	{
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Shattered,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: None,
		}
	}
	
	/// Construct an Unknown observation (no payload)
	pub fn unknown(position: &TopologySegment) -> Self {
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity: Severity::Unknown,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: None,
		}
	}
	
	/// Construct with specific severity
	pub fn with_severity(severity: Severity, position: &TopologySegment) -> Self {
		Self {
			//todo: unfuck this
			position: &OBSERVATION_TOPOLOGY_ANCH0R,
			severity,
			tier: ObservationTier::Composed,
			annotation: Annotation::None,
			temporal: Temporal::Current,
			payload: None,
		}
	}
	
	/// Attach an annotation
	pub fn with_note(mut self, note: impl Into<String>) -> Self {
		self.annotation = Annotation::Note(note.into());
		self
	}
	
	/// Set the observation tier
	pub fn at_tier(mut self, tier: ObservationTier) -> Self {
		self.tier = tier;
		self
	}
	
	/// Set temporal state
	pub fn with_temporal(mut self, temporal: Temporal) -> Self {
		self.temporal = temporal;
		self
	}
}

// SAFETY: Observation is Send + Sync if GLASS is Send + Sync
// #[allow(unsafe_code)]
// unsafe impl<GLASS: Send> Send for Observation<GLASS> {}
// #[allow(unsafe_code)]
// unsafe impl<GLASS: Sync> Sync for Observation<GLASS> {}


#[allow(unsafe_code)]
unsafe impl<GLASS> DaemonicSystemCall for Observation<GLASS> {}

impl<GLASS> Glass<Observation<GLASS>> for Observation<GLASS>
	where
		GLASS: Glass<GLASS>,
{
	type Anchor = TopologySegment;

	fn position(&self) -> &TopologySegment {
		&self.position
	}

	fn severity(&self) -> Severity {
		self.severity
	}

	fn annotation(&self) -> Annotation {
		self.annotation.clone()
	}

	fn temporal(&self) -> Temporal {
		self.temporal.clone()
	}

	fn tier(&self) -> ObservationTier {
		self.tier
	}

	fn payload(&self) -> Option<&Observation<GLASS>> {
		Some(self)
	}

	fn into_payload(self) -> Option<Observation<GLASS>> {
		Some(self)
	}
}

// ═══════════════════════════════════════════════════════════════
// BOUNDARY PROTOCOL (Glass ↔ Result/Option)
// ═══════════════════════════════════════════════════════════════

/// Convert Result to Glass observation (information-adding)
impl<T, E: core::fmt::Display> From<Result<T, E>> for Observation<T> {
	fn from(result: Result<T, E>) -> Self {
		match result {
			Ok(value) => Observation::stable(value, &TopologySegment::new("Daemonic::Glass::Boundary::Ok")),
			Err(e) => Observation::shattered(&TopologySegment::new("Daemonic::Glass::Boundary::Err"))
				.with_note(e.to_string()),
		}
	}
}

/// Convert Option to Glass observation (None = Unknown)
impl<T> From<Option<T>> for Observation<T> {
	fn from(opt: Option<T>) -> Self {
		match opt {
			Some(value) => Observation::stable(value, &TopologySegment::new("Daemonic::Glass::Boundary::Option::Some")),
			None => Observation::unknown(&TopologySegment::new("Daemonic::Glass::Boundary::Option::None")),
		}
	}
}

pub(crate) mod daemonic_system_call;