Skip to main content

PolicyEvent

Enum PolicyEvent 

Source
pub enum PolicyEvent {
    Finding(FindingEvent),
    WarnUnsafe {
        trigger: Trigger,
        policy: PolicyId,
    },
    CoreFinding {
        core_id: &'static str,
        code: &'static str,
        message: String,
    },
    EngineFailure {
        code: EngineFailureCode,
        message: String,
        trigger: Option<Trigger>,
        policy: Option<PolicyId>,
        path: Option<EventPath>,
    },
    FixSummary {
        trigger: Trigger,
        passes: u64,
        changed_paths: Vec<EventPath>,
    },
    CommitLanded {
        oid: String,
    },
    LandingRaceLost {
        attempt: u64,
        winning_oid: String,
    },
    LandingReserved {
        lost_races: u64,
    },
    CommitReplayed {
        prepared_oid: String,
        from_base: Option<String>,
        onto: String,
        oid: String,
    },
    ReplayHeadersDropped {
        prepared_oid: String,
        oid: String,
        headers: Vec<String>,
    },
    ReplayConflict {
        target_ref: String,
        paths: Vec<String>,
        winning_oid: String,
        prepared_oid: String,
    },
}
Expand description

What: Every event a policy pass can produce. An enum is a closed set of named alternatives; each variant carries its own fields. Vec<EventPath> is an owned list of pathnames in their event form. Why: One list of events is rendered in order, whatever mixture of kinds it holds.

In TS you’d write (pseudocode):

type PolicyEvent = FindingEvent | ConfigurationWarningEvent | CoreFindingEvent | EngineFailureEvent | FixSummaryEvent;

Variants§

§

Finding(FindingEvent)

A policy reported something.

§

WarnUnsafe

A policy that warn does not protect is configured as warn.

Fields

§trigger: Trigger

The lifecycle point that ran the policy.

§policy: PolicyId

The policy configured as warn.

§

CoreFinding

A fixed transform rejected the command; it has no severity and cannot be configured.

Fields

§core_id: &'static str

The transform, for example commit-only.

§code: &'static str

The transform-local code; rendering prefixes the transform name.

§message: String

The explanation for the person who ran the command.

§

EngineFailure

The pass could not complete.

Fields

§code: EngineFailureCode

The stable cause.

§message: String

The explanation for the person who ran the command.

§trigger: Option<Trigger>

The lifecycle point, when the failure belongs to one.

§policy: Option<PolicyId>

The policy that could not complete, when one is responsible.

§path: Option<EventPath>

The repository path responsible, when the failure is about one path.

§

FixSummary

Corrections were applied.

Fields

§trigger: Trigger

The fixing lifecycle point.

§passes: u64

How many passes changed candidate content before it settled.

§changed_paths: Vec<EventPath>

The changed paths, each once, in Git’s byte order.

§

CommitLanded

The landed commit whose automatic backup the post-commit gate stopped. The commit stays local; the event names it so the user can push it deliberately.

Fields

§oid: String

The exact landed commit object ID.

§

LandingRaceLost

A landing found the target moved (landing-race-lost).

Fields

§attempt: u64

This transaction’s lost races so far, from 1.

§winning_oid: String

The target value that won.

§

LandingReserved

A commit that lost enough races holds the next landing slot (landing-reserved).

Fields

§lost_races: u64

Lost races when the reservation was granted.

§

CommitReplayed

A prepared commit was replayed onto the moved target (commit-replayed).

Fields

§prepared_oid: String

The prepared commit.

§from_base: Option<String>

The preparation base, absent when the branch was unborn.

§onto: String

The target value the replay used as parent.

§oid: String

The replayed commit, after revalidation.

§

ReplayHeadersDropped

A signed replay could not carry some custom headers (replay-headers-dropped).

Fields

§prepared_oid: String

The prepared commit carrying the headers.

§oid: String

The re-signed commit lacking them.

§headers: Vec<String>

The dropped header names in prepared-commit order, each once.

§

ReplayConflict

The core finding concurrent-commit/replay-conflict, with the data a person needs to resolve it.

Fields

§target_ref: String

The target ref the commit aimed at.

§paths: Vec<String>

The conflicting paths in Git path byte order.

§winning_oid: String

The earliest target commit touching a conflicting path.

§prepared_oid: String

The prepared commit kept for cherry-picking.

Trait Implementations§

Source§

impl Clone for PolicyEvent

Source§

fn clone(&self) -> Self

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 Debug for PolicyEvent

Source§

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

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

impl Eq for PolicyEvent

Source§

impl PartialEq for PolicyEvent

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PolicyEvent

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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