pub fn validate_response(
resp: &SystemResponse,
criteria: &HashMap<String, Vec<String>>,
) -> ValidationResult<()>Expand description
Validate a response. Catches the common engine-side bugs:
- missing or unexpected answers (when
criteriacovers the request’s question ids) - probabilities don’t sum to 1
- confidence out of range
- choice answer’s keys don’t match criteria
- score answer legend doesn’t match probabilities
criteria maps question id → the question’s choice-criteria keys (empty for
noul/score questions). When the map is non-empty it is treated as the full
question-id set of the originating request, and answer coverage is enforced
both ways: every requested id must be answered, and no extra answers may
appear. An empty map skips coverage checks (per-answer checks still run).