Skip to main content

parlov_core/
scoring.rs

1//! Structured scoring breakdown for oracle results.
2//!
3//! Each `ScoringReason` records one contribution to the confidence or impact score, giving
4//! operators a transparent audit trail of how a verdict was computed.
5
6use serde::{Deserialize, Serialize};
7
8/// One contribution to the confidence or impact score.
9///
10/// Reasons are accumulated during classification and attached to the `OracleResult` so the
11/// operator can see exactly which signals drove the final verdict and severity.
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct ScoringReason {
14    /// What was observed, e.g. `"Status differential 416 vs 404"`.
15    pub description: String,
16    /// Points contributed (positive or negative).
17    pub points: i16,
18    /// Which scoring axis this reason contributes to.
19    pub dimension: ScoringDimension,
20}
21
22/// Which scoring axis a reason contributes to.
23#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
24pub enum ScoringDimension {
25    /// Contributes to the numeric confidence score (0-100).
26    Confidence,
27    /// Contributes to the impact classification.
28    Impact,
29}