Expand description
Strongly-typed risk event envelope, per-type payloads, and the folded
RiskState.
Every type here maps 1:1 to risk-event.schema.json /
risk-index.schema.json. Keep field names aligned with the schemas —
serde is the load path, and the on-disk line is the chained, hashed
source of truth, so the JSON shape is a contract, not an implementation
detail.
Structs§
- Agent
{ model, skill }when an agent appended the event;Nonefor a direct operator action.- Event
Envelope - One line of
events.jsonl: the immutable envelope plus its hash-chain fields.datais flattened so the on-disk shape is{seq, ts, actor, agent, type, prev_sha256, data}(thetype/datapair is produced byEventData’s adjacent tagging). - External
Link - A tracker mirror created by sync-out, recorded by
external-linked. - Finding
Ref - Binds a risk to immutable evidence by content hash. The fingerprint
<control_id>:<finding_id>is the risk’s cross-run identity. - Risk
State - The current state of a risk, produced by folding its events in
seqorder. Nothing here is stored on disk — it is always recomputed from the log. Seecrate::risks::fold::fold.
Enums§
- Event
Data - The per-
typepayload. Adjacently tagged so it serialises as{"type": "...", "data": { ... }}, matchingrisk-event.schema.json. - Severity
- Risk severity. Ordered most- to least-severe in declaration order so callers can compare and sort.
- Status
- Lifecycle status. The legal transitions between these are enforced by
crate::risks::fold::validate_transition; seedocs/risks.md.
Type Aliases§
- Risk
Event - Back-compat alias: the envelope is the event. Callers may use either
name;
RiskEventreads better at use sites that talk about “events”.