kyyn_core/violation.rs
1//! Validation outcome types — the wire vocabulary of the validator protocol.
2//!
3//! Two severities: `Error` blocks an accept; `Warning` is surfaced but never
4//! blocks. These are (de)serializable because they cross the process boundary
5//! between the engine and a KB's compiled `schema/` validator.
6
7use serde::{Deserialize, Serialize};
8
9/// How bad a violation is: `Error` blocks accept, `Warning` is advisory.
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
11pub enum Severity {
12 Error,
13 Warning,
14}
15
16/// One broken invariant, tied to the file that breaks it.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct Violation {
19 /// Repo-relative path of the offending file.
20 pub path: String,
21 pub severity: Severity,
22 pub message: String,
23}