pub struct GateOutcome {
pub status: GateStatus,
pub enforced: bool,
pub observed: Option<f64>,
pub threshold: Option<f64>,
pub threshold_label: Option<String>,
pub files: Vec<GateFile>,
}Expand description
One gate’s verdict on one run.
status and enforced answer different questions and legitimately
disagree. status is what the rule concluded; enforced is whether a
fail from this gate would make the run exit non-zero. A
health --report-only run is an explicit request never to fail, so a
failing gate there reports status: fail with enforced: false, and a
stale-baseline verdict published without --fail-on-stale-baseline reports
the same pair.
A gate fails the build when status is fail AND enforced is true.
Neither member decides it alone: enforced is true on every armed gate,
including the ones that passed, so gating on it by itself fails every run
that armed anything. Read status on its own to decide what to say, and
remember that warn and skipped are neither a pass nor a failure.
Fields§
§status: GateStatusWhat the rule concluded.
enforced: boolTrue when a fail from this gate makes the run exit non-zero. False
when the verdict is published for information only: the gate was never
armed, the run was told never to fail, or the combined machine formats
exit 0 for the gate.
observed: Option<f64>The measured value the gate compared, when there is one: the duplication
percentage, the health score, the number of findings at or above the
severity floor, or the number of files in files. Whole numbers are
carried as JSON numbers, so a count of three reads as 3.0. Absent for
gates that compare no number.
threshold: Option<f64>The configured limit observed was compared against, when there is one.
Absent for gates that compare no number.
threshold_label: Option<String>How the limit was spelled, for a gate whose threshold number does not
carry its own unit. health-min-severity sets it to the severity floor
(moderate, high or critical); regression sets it to the
tolerance as the user wrote it ("50%" or "5"), because threshold
there is the allowance in issues and the percentage would otherwise be
unrecoverable on the grouped envelope, which carries no regression
object. Absent for gates whose numbers speak for themselves.
files: Vec<GateFile>The files the gate judged, for a gate that judges files rather than a
number. Only parse-error sets it: one item per file that did not
parse cleanly, sorted by path. Absent when the list is empty.
Implementations§
Source§impl GateOutcome
impl GateOutcome
Sourcepub const fn new(status: GateStatus, enforced: bool) -> Self
pub const fn new(status: GateStatus, enforced: bool) -> Self
A gate that ran, compared no number, and was armed.
Sourcepub const fn measured(
status: GateStatus,
enforced: bool,
observed: f64,
threshold: f64,
) -> Self
pub const fn measured( status: GateStatus, enforced: bool, observed: f64, threshold: f64, ) -> Self
A gate that compared observed against threshold.
Sourcepub fn counted(
status: GateStatus,
enforced: bool,
observed: f64,
threshold_label: &str,
) -> Self
pub fn counted( status: GateStatus, enforced: bool, observed: f64, threshold_label: &str, ) -> Self
A gate that counted observed items at or above a named floor.
Sourcepub fn with_files(
status: GateStatus,
enforced: bool,
files: Vec<GateFile>,
) -> Self
pub fn with_files( status: GateStatus, enforced: bool, files: Vec<GateFile>, ) -> Self
A gate that judged files: observed is the number of files it named.