pub struct Report {
pub case_name: String,
pub severity: Severity,
pub primary: Option<Diagnosis>,
pub also_considered: Vec<Diagnosis>,
pub reproduction: String,
}Expand description
Top-level result of crate::rules::diagnose.
primary is None when no rule fired with confidence ≥ 0.6 (the
classification threshold). also_considered is sorted by
descending confidence and capped above by the primary’s confidence.
Fields§
§case_name: StringStable name of the case being diagnosed (matches Case::name).
severity: SeveritySeverity tag from the case (mirrored verbatim).
primary: Option<Diagnosis>Top-confidence diagnosis, if any rule fired above threshold.
also_considered: Vec<Diagnosis>Other rules that fired, sorted by descending confidence and
bounded above by primary.confidence. Empty when only one
rule fired (or none did).
reproduction: StringPre-rendered curl reproduction string. Header order is
alphabetical; the body is inlined with --data-raw so the
string is the same on every machine (no absolute paths).
Implementations§
Source§impl Report
impl Report
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Process exit code the CLI should return for this report.
0 if a primary diagnosis fired with confidence ≥ 0.60, 1
if the case is unclassified or low-confidence. The threshold
matches the human formatter’s “No rule matched” message.
Higher-level “bad input” errors are mapped to exit code 2
by the CLI itself, not here.
§Examples
use api_debug_lab::{diagnose, Case};
use std::path::Path;
let case = Case::load("auth_missing", Path::new("fixtures"))?;
assert_eq!(diagnose(&case).exit_code(), 0);Sourcepub fn render(&self, format: Format) -> String
pub fn render(&self, format: Format) -> String
Render the report in the requested Format.
Both formats are byte-stable: the same input always produces the same output bytes. The JSON format uses pretty-printing so diffs in PRs are legible.
§Examples
use api_debug_lab::{diagnose, Case, Format};
use std::path::Path;
let case = Case::load("auth_missing", Path::new("fixtures"))?;
let report = diagnose(&case);
let human = report.render(Format::Human);
assert!(human.starts_with("CASE:"));