pub struct Baseline {
pub schema_version: String,
pub pipeline_path: String,
pub pipeline_content_hash: String,
pub pipeline_identity_material_hash: Option<String>,
pub captured_at: DateTime<Utc>,
pub captured_by: String,
pub captured_with: CapturedWith,
pub baseline_findings: Vec<BaselineFinding>,
}Expand description
One baseline file = one pipeline. Keyed by pipeline_content_hash so
renames preserve state and merge conflicts only touch the affected file.
Fields§
§schema_version: String§pipeline_path: String§pipeline_content_hash: Stringsha256:<hex> of the pipeline file’s bytes at init time.
pipeline_identity_material_hash: Option<String>Optional additive hardening signal captured at init time.
Hashes parser-emitted dependency-like material (include/template/ repository declarations and delegation edges) so suppression can be disabled if that material drifts even when the baseline file still exists. Absent on legacy baseline files written before v1.1.0.
captured_at: DateTime<Utc>§captured_by: String§captured_with: CapturedWith§baseline_findings: Vec<BaselineFinding>Sorted by fingerprint ASC for stable git diffs.
Implementations§
Source§impl Baseline
impl Baseline
Sourcepub fn load(path: &Path) -> Result<Option<Self>, BaselineError>
pub fn load(path: &Path) -> Result<Option<Self>, BaselineError>
Load and parse a baseline from disk. Returns Ok(None) if path
does not exist (the OSS-friendly default — absent baseline is fine).
Sourcepub fn save(&self, path: &Path) -> Result<(), BaselineError>
pub fn save(&self, path: &Path) -> Result<(), BaselineError>
Write self to path as pretty JSON with stable key ordering and
fingerprint-sorted entries. Creates parent directories as needed.
§Atomicity contract
The write is atomic at the rename boundary on POSIX: bytes are
staged into a .<name>.tmp.<pid>.<nanos> file in the same parent
directory and then fs::renamed over the destination. POSIX
guarantees rename(2) is atomic within a single filesystem, so a
concurrent reader either sees the prior baseline content or the new
content — never a truncated/partial JSON.
If the process is SIGKILLed (or crashes) between the temp-file
write and the rename, the destination is unchanged and a
dot-prefixed temp file is left in the parent directory. This is
acceptable: the next successful save overwrites that temp slot,
and the temp prefix .tmp. makes manual cleanup trivial. We do
not call fsync here — durability against host crash is a
premature optimisation absent a measured requirement.
Sourcepub fn from_findings(
pipeline_path: &str,
content: &str,
graph: &AuthorityGraph,
findings: &[Finding],
captured_by: &str,
taudit_version: &str,
rules_version: &str,
now: DateTime<Utc>,
) -> Self
pub fn from_findings( pipeline_path: &str, content: &str, graph: &AuthorityGraph, findings: &[Finding], captured_by: &str, taudit_version: &str, rules_version: &str, now: DateTime<Utc>, ) -> Self
Produce a fresh baseline from current_findings against graph.
Each entry is a plain pre-existing finding (no waiver fields set).
pipeline_path should be the pipeline’s filesystem path as the user
sees it; content is the raw bytes used to derive the content hash.
Sourcepub fn accept(
&mut self,
fingerprint: &str,
rule_id: &str,
severity: Severity,
reason: &str,
severity_override: Option<Severity>,
expires_at: Option<DateTime<Utc>>,
now: DateTime<Utc>,
) -> Result<&BaselineFinding, BaselineError>
pub fn accept( &mut self, fingerprint: &str, rule_id: &str, severity: Severity, reason: &str, severity_override: Option<Severity>, expires_at: Option<DateTime<Utc>>, now: DateTime<Utc>, ) -> Result<&BaselineFinding, BaselineError>
Append a single waiver entry. Validates reason length and the
critical-waiver constraints. Returns the inserted/updated entry.
If an entry with the same fingerprint already exists, it is replaced
(idempotent re-acceptance with a refreshed reason / expiry).
Sourcepub fn identity_material_matches(&self, graph: &AuthorityGraph) -> bool
pub fn identity_material_matches(&self, graph: &AuthorityGraph) -> bool
Returns true when the captured identity material matches the current parsed graph. Legacy baselines that predate this field are considered compatible to preserve backward compatibility.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Baseline
impl<'de> Deserialize<'de> for Baseline
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Baseline
impl StructuralPartialEq for Baseline
Auto Trait Implementations§
impl Freeze for Baseline
impl RefUnwindSafe for Baseline
impl Send for Baseline
impl Sync for Baseline
impl Unpin for Baseline
impl UnsafeUnpin for Baseline
impl UnwindSafe for Baseline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.