Expand description
Case fixture model and JSON loader.
A Case is a sanitized HTTP transaction plus environmental
Context. Each variant the diagnoser cares about lives as an
explicit field — the struct is not a generic serde_json::Value
bag, because we want serde to fail loudly when a fixture changes shape
in a way the code didn’t expect.
Loading is gated on two checks (in order):
- The requested name is in
KNOWN_CASES— seecase_fixture_path. - The loaded JSON’s
namefield matches the requested name — seeload_case. A mismatch is a fixture-edit bug (CaseError::NameMismatch).
Bidirectional consistency between KNOWN_CASES and the on-disk
fixtures/cases/*.json set is enforced by the
known_cases_matches_on_disk_fixtures test below.
Structs§
- Case
- One sanitized HTTP transaction, plus environmental context, plus a pointer to the log file that recorded it.
- Context
- Environmental observations from the caller’s own network stack — things that don’t appear in the HTTP transaction itself.
- Request
- Sanitized HTTP request as authored in the fixture file.
- Response
- Sanitized HTTP response. Absent on
Case(i.e.Case::responseisNone) for connection-layer failures where no response was received.
Enums§
- Case
Error - Errors the case loader can produce.
Constants§
- KNOWN_
CASES - Every case the binary knows how to load. Adding a new case requires:
Functions§
- case_
fixture_ path - Look up the on-disk path for a known case name. Returns
Err(Unknown)when the name is not inKNOWN_CASES. - load_
case - Load a single case fixture by name from the given fixtures directory.
- log_
path_ for - Resolve the log file path for a case, relative to the fixtures directory’s
parent (so a case that records
fixtures/logs/foo.logresolves correctly regardless of the current working directory).