Skip to main content

EngineStatusReport

Enum EngineStatusReport 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

pub fn stable_code(&self) -> &'static str

落审计 / decision_reasons 用稳定字面量。包含 PII;靠 Debug 格式化。 Ok / Unsupported 不预期被 caller 写入 reasons(只有退化路径需);返字面量便于 测试断言但 caller 不应对此分支落审计。

Trait Implementations§

Source§

impl Clone for EngineStatusReport

Source§

fn clone(&self) -> EngineStatusReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EngineStatusReport

Source§

impl Debug for EngineStatusReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for EngineStatusReport

Source§

impl From<EngineStatus> for EngineStatusReport

Source§

fn from(s: EngineStatus) -> EngineStatusReport

Converts to this type from the input type.
Source§

impl PartialEq for EngineStatusReport

Source§

fn eq(&self, other: &EngineStatusReport) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for EngineStatusReport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.