Expand description
Risk register: an append-only, hash-chained event log per risk, plus a
derived risks/index.json cache.
The register lives inside the store at risks/<risk-id>/events.jsonl
(one immutable JSON Lines event per line) and is the authoritative
source of a risk’s state — current state is never stored, it is folded
from the events. index.json is a regenerable projection, the same role
state.json plays for runs. Full design in docs/risks.md; the on-disk
contract in docs/storage.md (the “Risk register (risks/)” section).
The integrity model mirrors evidence manifests:
- Each event carries
prev_sha256, the SHA-256 of the previous canonicalised line (compact JSON), forming a per-risk hash chain — exactly likeprior_run.manifest_sha256chains manifests. Lines are only ever appended; corrections are new events, never edits. index.jsonis mutable, outside the chain, and rebuilt from the logs withstore::rebuild.
Module layout (mirrors evidence):
Re-exports§
pub use fold::fold;pub use fold::validate_transition;pub use fold::TransitionError;pub use model::Agent;pub use model::EventData;pub use model::EventEnvelope;pub use model::ExternalLink;pub use model::FindingRef;pub use model::RiskEvent;pub use model::RiskState;pub use model::Severity;pub use model::Status;pub use store::append;pub use store::build_index;pub use store::load_events;pub use store::open;pub use store::rebuild;pub use store::verify_finding_ref;pub use store::AppendOutcome;pub use store::OpenOutcome;pub use store::RiskIndex;pub use store::RiskIndexEntry;
Modules§
- fold
- The deterministic left-fold over a risk’s events and the status machine that governs lifecycle transitions.
- model
- Strongly-typed risk event envelope, per-type payloads, and the folded
RiskState. - store
- On-disk risk register: the append protocol, id allocation, log loading,
and the derived
index.jsonbuild/rebuild.