Expand description
Deterministic rules engine.
diagnose is a pure function over (name, &[Evidence]). There is no
clock, no env, no fs, and no randomness — which is what makes the
insta snapshot tests reproducible on any machine.
§How a rule works
Each rule is a private function rule_*(name, evidence, reproduction) -> Option<Diagnosis>. The rule:
- Inspects
evidencefor the variants it cares about. If the trigger pattern is absent, the rule returnsNoneand the dispatcher tries the next rule. - If the trigger pattern is present, the rule calls [
pick] to choose which evidence items to surface in the rendered output (and in what order). - The rule looks up its prose in
prose.tomlviaprose, then constructs and returns aDiagnosis.
§Why rule order matters
Rules are tried in order from most specific (network-layer failure) to
least specific (application-layer failure). The dispatcher returns the
first match. This matters for inputs where multiple rules could in
principle fire — see the test
tls_failure_rule_orders_after_dns_failure for the canonical example.
§Why prose lives outside this file
The hand-written English content (likely-cause templates, hypotheses,
unknowns, next-steps, escalation notes, severity rationales) lives in
prose.toml at the crate root. Editorial changes (a clearer
hypothesis, a tighter escalation note) do not require a code change.
Logic changes (severity, rule order, evidence patterns) still go here.
Structs§
Enums§
- Severity
- Severity rank assigned to a diagnosis. See
SeveritySourcefor how a rule arrived at the rank, and the README’s “What it does (and does not) claim” section for the ranking philosophy (immediacy of failure, not blast radius). - Severity
Source - How the rule arrived at its severity rank.
Functions§
- diagnose
- Diagnose a case by name and the evidence collected for it.