Outcome

Enum Outcome 

Source
pub enum Outcome {
    Pass,
    Skip(AssertDetail),
    Inconclusive(AssertDetail),
    Fail(AssertDetail),
}
Expand description

Terminal verdict for a single test scenario or merge fold — strict four-state enum that replaces the (passed, skipped) bool-pair encoding on AssertResult.

Precedence under AssertResult::merge: Fail > Inconclusive > Pass > Skip. A merge that contains any Fail resolves to Fail; absent a Fail, any Inconclusive resolves to Inconclusive; absent both, a Pass + Skip mix resolves to Pass (Pass dominates Skip — a check that actually ran and passed overrides a sibling check whose precondition was unmet, so the merge does not falsely demote to Skip on the strength of an unrelated missing-precondition sibling). Skip-only merges stay Skip. Pass-only merges stay Pass. Inconclusive sits between Fail and Pass because “couldn’t evaluate” is not a real Pass (an Inconclusive run must not satisfy is_pass()-keyed CI gates) but also not a hard Fail (no claim was made that the system did the wrong thing).

Inconclusive exists for ratio assertions whose denominator is an INSTRUMENT-derived measurement (iteration count, sample count, wall-clock interval) that legitimately reached zero — the gate has no signal to evaluate against. Distinguish from Fail: a POLICY-derived denominator (e.g. NUMA pages under MemPolicy::Bind, where the policy specifies pages will exist) staying at zero IS a defect signal and stays as Fail per the existing semantic — see assert_page_locality / AssertPlan::assert_cgroup for the policy-derived carve-out.

Note: Notes do NOT belong here. AssertResult::info_notes is the structurally-separate context stream; re-encoding Note as an Outcome variant would re-mix the failure / verdict surface with the context surface and erase the separation. Outcome is strictly terminal verdict; notes are non-verdict context.

Skip, Inconclusive, and Fail carry an AssertDetail payload so the match arm has the diagnostic in hand without re-walking details. Pass carries no payload — there is no failure to describe.

Outcomes are stored as AssertResult::outcomes and the AssertResult::outcome accessor folds the vec via this enum’s Self::merge (identity = Outcome::Pass). Callers query via AssertResult::is_pass / AssertResult::is_fail / AssertResult::is_skip / AssertResult::is_inconclusive (bool checks), AssertResult::record_fail / AssertResult::record_skip / AssertResult::record_pass / AssertResult::record_inconclusive (atomic mutators), or AssertResult::failure_details / AssertResult::skip_details / AssertResult::inconclusive_details (per-variant payload iterators).

Skip is not Pass: is_pass() returns false on skip — a skipped scenario is “couldn’t run”, not “passed”. Stats tooling and gate callers that want to count “not a failure” must test r.is_pass() || r.is_skip() rather than bare r.is_pass(). Inconclusive is not Pass either: is_pass() returns false when any Inconclusive is recorded, so a zero-denominator ratio gate cannot silently satisfy an is_pass()-keyed CI check. Uses serde’s externally-tagged default (no #[serde(tag, content)]). Most ktstr enums adopt the adjacently-tagged #[serde(tag = "kind", content = "data")] style for JSON readability, but Outcome is uniquely wire-encoded via postcard as part of AssertResult’s TLV transport from guest to host (see crate::test_support::output::parse_assert_result_from_drain and crate::test_support::test_helpers::assert_result_tlv_entry). Postcard is not a self-describing format and cannot decode adjacently-tagged enums — pre-fix the decode silently failed and surfaced as ERR_NO_TEST_FUNCTION_OUTPUT. The externally-tagged default is what postcard’s externally-tagged enum decoder expects. tests_assert.rs::outcome_serde_externally_tagged_* pins both the JSON shape and the postcard roundtrip so a refactor that re-adds adjacent tagging trips loudly at test time rather than at runtime.

§Wire-format stability (postcard variant index)

Postcard encodes externally-tagged enums by variant index, not variant name — the integer position in the enum body becomes part of the wire format. The current encoding is: Pass=0, Skip=1, Inconclusive=2, Fail=3.

Append-only: new variants MUST be added at the END of the variant list. Re-ordering, removing, or inserting a variant shifts the index of every variant after it and silently reinterprets in-flight bytes from guest payloads as a different variant on the host — the failure mode is a Pass reading as Skip (or vice versa) with no decode error.

Any change to the variant order or list MUST be accompanied by an update to tests_assert.rs::outcome_serde_externally_tagged_* (which pins both the JSON shape and the postcard byte sequence) so a silent-shift regression trips at test time.

Variants§

§

Pass

§

Skip(AssertDetail)

§

Inconclusive(AssertDetail)

§

Fail(AssertDetail)

Implementations§

Source§

impl Outcome

Source

pub fn is_pass(&self) -> bool

True iff self == Outcome::Pass.

Part of the is_pass / is_fail / is_inconclusive / is_skip vocabulary uniform across the verdict surfaces: crate::assert::AssertResult::is_pass / crate::test_support::SidecarResult::is_pass / Self::is_pass / MonitorVerdict::is_pass (in the monitor module, which is pub(crate)) / Verdict::is_pass (re-exported at crate::assert::Verdict) / GauntletRow::is_pass (in the stats module, which is pub(crate)). OutcomeRef::is_pass is a borrowed-view twin of this method on the borrowed OutcomeRef enum and is intentionally NOT counted as a peer surface — it shares the boolean semantic for naming parity but is a &self projection over Outcome, not an independent verdict shape.

Source

pub fn is_skip(&self) -> bool

True iff self == Outcome::Skip(_).

Source

pub fn is_fail(&self) -> bool

True iff self == Outcome::Fail(_).

Source

pub fn is_inconclusive(&self) -> bool

True iff self == Outcome::Inconclusive(_).

Source

pub fn merge(self, other: Outcome) -> Outcome

Merge two outcomes per the precedence Fail > Inconclusive > Pass > Skip.

Discriminant-commutative: the merged Pass/Skip/Inconclusive/Fail kind is the same regardless of operand order. Idempotent on Pass (Pass.merge(Pass) == Pass).

Payload semantic (NOT commutative):

  • Same-variant ties (Fail+Fail, Inconclusive+Inconclusive, Skip+Skip): the LEFT operand’s payload wins, so caller- controlled merge ordering produces deterministic detail content.
  • Cross-variant Fail+{Inconclusive,Skip}: the merged outcome is Fail and the payload comes from whichever side carries the Fail (the dominated side’s payload is dropped — the merged verdict is Fail, so the dominated narrative is irrelevant to the failure record).
  • Cross-variant Inconclusive+{Pass,Skip}: merged outcome is Inconclusive and the payload comes from whichever side carries the Inconclusive.
Source

pub fn as_ref(&self) -> OutcomeRef<'_>

Borrow this outcome’s payload as an OutcomeRef. Zero- allocation projection — Pass carries no payload; Skip, Inconclusive, and Fail borrow their AssertDetail in place. Used by the verdict-read fast path (AssertResult::outcome_ref) and any caller that wants to inspect the terminal verdict without cloning the detail (e.g. error-message formatting where the detail outlives the formatter, or sidecar emission that already owns the source Outcome).

Trait Implementations§

Source§

impl Clone for Outcome

Source§

fn clone(&self) -> Outcome

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Outcome

Source§

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

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

impl<'de> Deserialize<'de> for Outcome

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Outcome

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Serialize for Outcome

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Outcome

Source§

impl StructuralPartialEq for Outcome

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
§

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

§

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

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

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

§

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

Compare self to key and return true if they are equal.
§

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

§

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

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

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

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,