parlov_core/scoring.rs
1//! Structured scoring breakdown for oracle results.
2
3use serde::{Deserialize, Serialize};
4
5/// One contribution to confidence or impact — audit trail for verdict computation.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
8pub struct ScoringReason {
9 /// e.g. `"Status differential 416 vs 404"`
10 pub description: String,
11 /// Points added (positive) or subtracted (negative) on this dimension.
12 pub points: i16,
13 /// Which scoring axis this reason contributes to.
14 pub dimension: ScoringDimension,
15}
16
17/// Which axis a `ScoringReason` contributes to.
18#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
19#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
20pub enum ScoringDimension {
21 /// Numeric confidence score (0–100).
22 Confidence,
23 /// Impact classification — drives severity when gated by confidence.
24 Impact,
25}