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
//! The diagnostic vocabulary shared by every PowerIO crate.
//!
//! A free-form `Vec<String>` warning is useful for a human and opaque to CI, an
//! agent, or a downstream solver. Every finding a reader, a lowering pass, or a
//! writer records carries a stable [`DiagnosticCode`], a [`DiagnosticSeverity`],
//! a human message, and where known an element path, a [`SourceRef`], a details
//! object, and a suggested action. The structured record is primary and the
//! text lines are rendered from it by [`render_line`], so the two cannot
//! disagree.
//!
//! A code reads `NAMESPACE.SCOPE.SPECIFIC`. The first segment names the stage
//! ([`DiagnosticStage`]) and is the only segment a consumer parses; the rest is
//! opaque identity. powerio never emits a code whose first segment is outside
//! the ten, so a downstream producer picks any other first segment and its
//! codes merge into one report without coordination.
//!
//! The crate is a leaf on purpose: the transmission model, the distribution
//! model, and the `.pio.json` document model are peers, and a record that
//! crosses between them needs a home below all three.
//!
//! ```
//! use powerio_diag::{DiagnosticSeverity, DiagnosticStage, StructuredDiagnostic, render_line};
//!
//! let d = StructuredDiagnostic::new(
//! "READ.DSS.INCLUDE_REFUSED",
//! DiagnosticSeverity::Error,
//! "redirect ../shared.dss: refused; the include escapes the case directory",
//! );
//! assert_eq!(d.stage(), Some(DiagnosticStage::Read));
//! assert!(render_line(&d).starts_with("READ.DSS.INCLUDE_REFUSED: "));
//! ```
pub use ErrorCategory;
pub use ;
pub use Diagnostics;
pub use ;
pub use ;
pub use ;