Expand description
Trust-layer checks for Open Knowledge Format bundles.
This crate recomputes trust tiers from current verifications
only, checks verification currency, and walks superseded_by
chains. It performs no writes. Every instant comes from a pinned
AuditClock, so the same bundle and the same clock always give
the same findings.
The public surface includes the four locked calls consumed by
downstream upkeep engines: recompute_tier, check_currency,
walk_supersession, and check_supersession. Finding codes
live in the closed FindingCode enum and never change meaning
once published.
§Example
use perishables_core::{
AuditClock, Bundle, Concept, Tier, VerifiedEvent, check_currency, recompute_tier,
};
let clock = AuditClock::parse("2026-11-20").expect("valid date");
let concept = Concept {
id: "metrics/revenue".to_string(),
concept_type: "Metric".to_string(),
status: "stable".to_string(),
superseded_by: None,
generated_at: AuditClock::parse("2026-06-20T14:00:00Z").map(|c| c.epoch_seconds),
generated_text: Some("2026-06-20T14:00:00Z".to_string()),
stale_after_text: Some("2026-12-31T00:00:00Z".to_string()),
stale_after: AuditClock::parse("2026-12-31T00:00:00Z").map(|c| c.epoch_seconds),
verified: vec![VerifiedEvent {
by: Some("human:reviewer".to_string()),
at_text: Some("2026-06-25T09:00:00Z".to_string()),
at: AuditClock::parse("2026-06-25T09:00:00Z").map(|c| c.epoch_seconds),
}],
sources: Vec::new(),
citations: Vec::new(),
runtime: None,
parameters: Vec::new(),
code_blocks: Vec::new(),
file_code: None,
claimed_result: None,
};
let report = recompute_tier(&concept, &clock);
assert_eq!(report.recomputed_tier, Tier::HumanReviewed);
let bundle = Bundle::from_concepts(vec![concept]);
assert!(check_currency(&bundle, &clock).is_empty());Structs§
- Audit
Clock - A pinned instant. The library never reads the system clock.
- Bundle
- A loaded bundle.
- Chain
Report - The result of walking one supersession chain.
- Concept
- One concept and the trust fields the checks read.
- Event
Report - The classification of one verification event, with its reason.
- Finding
- One finding, tied to one concept and one rule.
- Info
Note - One piece of information reported without tripping the audit gate.
- Parameter
- One declared parameter of an Attested Computation.
- Source
Ref - One entry of a concept
sourceslist. - Tier
Report - The result of recomputing one concept tier.
- Verified
Event - One verification event as recorded in frontmatter, before any judgement about its currency or shape.
Enums§
- Chain
Terminal - How a supersession chain ends.
- Event
Class - How one verification event classifies against its concept.
- Finding
Code - A closed set of finding codes, shared with the corpus labels.
- Tier
- A trust tier, derived and never stored.
Functions§
- check_
currency - Check verification currency across a whole bundle. Call two of the locked interface.
- check_
drift - Check source drift against recorded SHA-256 content hashes.
- check_
freshness - Check freshness against the pinned clock.
- check_
provenance - Check provenance completeness.
- check_
supersession - Check every supersession chain in a bundle. Call four of the locked interface.
- info_
notes - Information notes for a bundle, covering stale deprecated concepts, concepts with no recorded provenance, SPEC 12.1 fallback targets, and explicit source modification ordering facts.
- recompute_
tier - Recompute the trust tier of one concept from its current verifications only. Call one of the locked interface.
- sha256_
hex - The SHA-256 digest of a byte string, as lowercase hex.
- sort_
findings - Sort findings into deterministic report order by concept id, then rule id, then detail.
- walk_
supersession - Walk one supersession chain to its end. Call three of the locked interface.