#[non_exhaustive]pub enum EngineStatusReport {
Ok,
DegradedTimeout,
DegradedError,
Unsupported,
}Expand description
v0.8 Sprint 1 A2 — PiiScanner 层引擎状态汇报。
设计目标:让 Firewall::evaluate 能感知 scanner 内部退化路径(timeout /
runtime error)→ 落审计 engine_degraded 事件 + decision_reasons 加 stable code,
不依赖各 scanner 实现具备 budget 能力。
与 vigil_redaction::EngineStatus 的区别:redaction 层只表达“模型路径运行
结果“(Ok/DegradedTimeout/DegradedError);本 enum 在 firewall caller 视角额外
引入 Unsupported,用于标记 scanner 实现未 override PiiScanner::scan_with_status
(Codex § 2 改进版 A:default 返 Unsupported,不返假安全 Ok,caller 必须
显式判此情况)。
R1 NICE(Codex 019deb53)— SemVer:#[non_exhaustive] 强制 caller 用
模式匹配时写 _ 通配,允许未来加 variant(如 DegradedOom / DegradedPanic)
不破 SemVer。SDK 暴露(vigil-sdk re-export)的契约文档(docs/sdk-shallow-api.md
§4.2)已声明 non_exhaustive,本 enum 实际加 attribute 让契约和实现一致。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ok
模型路径正常完成(scanner override 返此值表示真“Ok“)。
DegradedTimeout
模型路径在 budget 内未完成,已退化为 Hard-only。caller 应落
engine_degraded 审计 + decision_reasons.push(“engine.status=degraded_timeout”)。
DegradedError
模型 panic / runtime error,已退化为 Hard-only。caller 应落
engine_degraded 审计 + decision_reasons.push(“engine.status=degraded_error”)。
Unsupported
scanner 实现未 override PiiScanner::scan_with_status —— caller 必须
显式判此情况,不能当 Ok 处理。Codex § 2 改进版 A:default 返此值,
强制 caller 在编译期之外的 runtime path 走显式分支(无 status 不可隐式假定)。
Implementations§
Source§impl EngineStatusReport
impl EngineStatusReport
Sourcepub fn stable_code(&self) -> &'static str
pub fn stable_code(&self) -> &'static str
落审计 / decision_reasons 用稳定字面量。不包含 PII;不靠 Debug 格式化。
Ok / Unsupported 不预期被 caller 写入 reasons(只有退化路径需);返字面量便于
测试断言但 caller 不应对此分支落审计。
Trait Implementations§
Source§impl Clone for EngineStatusReport
impl Clone for EngineStatusReport
Source§fn clone(&self) -> EngineStatusReport
fn clone(&self) -> EngineStatusReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EngineStatusReport
Source§impl Debug for EngineStatusReport
impl Debug for EngineStatusReport
impl Eq for EngineStatusReport
Source§impl From<EngineStatus> for EngineStatusReport
impl From<EngineStatus> for EngineStatusReport
Source§fn from(s: EngineStatus) -> EngineStatusReport
fn from(s: EngineStatus) -> EngineStatusReport
Source§impl PartialEq for EngineStatusReport
impl PartialEq for EngineStatusReport
Source§fn eq(&self, other: &EngineStatusReport) -> bool
fn eq(&self, other: &EngineStatusReport) -> bool
self and other values to be equal, and is used by ==.