gate-contract
Fail-closed gate contracts for staged build pipelines, in dependency-free Rust.
A pipeline that only knows PASS and FAIL has a third state hiding inside it: the gate that could not be evaluated, because a credential was missing, an API timed out, or the value it needed was never produced. Treating that as a pass is how a run reaches deploy having checked nothing.
The rule this crate enforces:
A blocking gate halts the run when it fails and when it cannot be evaluated. "Could not check" is not "fine".
use ;
let run = new
.with_stage
.with_stage
.with_stage
.run;
assert!;
assert_eq!;
assert_eq!; // never ran, so it has no outcome
// An unknown input cannot pass a gate by accident
let coverage: = Unknown;
let g = check_known;
assert!;
Outcome—Pass/Fail/Unevaluable, each with a reason.Known<T>—Unknownpropagates throughmapandzip_withinstead of decaying to a default.Severity— blocking or advisory; advisory failures are warnings in the report.Stage::evaluatevisits every gate, so one run reports every problem, and names the first that halts.Pipeline::runstops at the first halting stage and reports how many stages never ran.
Install
[]
= "0.1"
#![forbid(unsafe_code)], no dependencies, MSRV 1.63.
Licence
MIT OR Apache-2.0.
Extracted from the build pipeline described at https://aiwebsitepipeline.com/.