Skip to main content

llm_assisted_api_debugging_lab/
lib.rs

1//! Library entrypoint.
2//!
3//! ## Layering
4//!
5//! ```text
6//! Case + log  ->  Vec<Evidence>  ->  Diagnosis  -+->  Report (human)
7//!                                                |->  Prompt (LLM)
8//!                                                +->  Prompt JSON (LLM)
9//! ```
10//!
11//! 1. [`cases`] loads a [`Case`] (a sanitized HTTP transaction) from a
12//!    fixture file.
13//! 2. [`evidence::collect_evidence`] normalizes the case and its matching
14//!    log file into a `Vec<Evidence>`. The log parser ([`evidence::parse_log`])
15//!    is also exposed so the `diagnose-log` subcommand can run against a
16//!    bare log without a JSON fixture.
17//! 3. [`diagnose::diagnose`] is a **pure** function over `(name, &[Evidence])`
18//!    that produces a [`Diagnosis`]. There is no clock, no env, no fs, no
19//!    randomness inside the rules — every snapshot test is reproducible
20//!    on any machine.
21//! 4. The renderers ([`render_report`], [`render_short`], [`render_prompt`],
22//!    [`render_prompt_json`]) each consume a `&Diagnosis` and produce
23//!    user-visible output. None of them can reach back into the raw
24//!    `Case`. This is the architectural guarantee that the LLM-facing
25//!    surface cannot influence diagnostic truth.
26//!
27//! ## Re-exports
28//!
29//! Every public item a downstream caller needs is re-exported from the
30//! crate root, so `use llm_assisted_api_debugging_lab::diagnose;` works without naming the
31//! module. The modules themselves remain `pub` for callers who want to
32//! reach internal helpers (e.g. [`report::render_evidence`] used by the
33//! tests).
34
35pub mod cases;
36pub mod diagnose;
37pub mod evidence;
38pub mod llm_prompt;
39pub mod prose;
40pub mod report;
41
42pub use cases::{Case, CaseError, KNOWN_CASES};
43pub use diagnose::{diagnose, Diagnosis, Severity, SeveritySource};
44pub use evidence::{collect_evidence, parse_log, Evidence};
45pub use llm_prompt::{render_prompt, render_prompt_json};
46pub use report::{render_report, render_short};