1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # incident-correlation
//!
//! Walks the Kinetic Gain Protocol Suite document graph starting from an
//! AI Incident Card and emits a structured remediation plan.
//!
//! ## What it answers
//!
//! When something goes wrong with a deployed AI system, the operator writes
//! an **AI Incident Card** that references the affected pieces — usually a
//! tool, an agent, or a specific vendor's AEO entity. The honest question
//! after that is: *what else does this incident touch?*
//!
//! - Which **agent-cards** depend on the affected tool?
//! - Which **decision-cards** approved the affected vendor?
//! - Which **AEO entities** declare the affected entity in their authority chain?
//! - Which **active conditions** on those decisions might now be in breach?
//!
//! `IncidentCorrelator::correlate` walks the graph and returns a
//! [`RemediationPlan`] with each affected node + a suggested action.
//!
//! ## Design
//!
//! - The graph is a `petgraph::Graph` of [`SuiteNode`]s.
//! - Edges are typed ([`SuiteEdge::DependsOn`], [`SuiteEdge::ApprovedBy`],
//! [`SuiteEdge::Mentions`]), so the correlator can answer "what depends on
//! X" with one BFS over a typed edge filter.
//! - The whole pipeline is synchronous because graph work doesn't need an
//! executor. `tokio` only shows up in dev-deps for the test harness.
//!
//! ## Composes with
//!
//! - **[procurement-decision-api](https://github.com/mizcausevic-dev/procurement-decision-api)** —
//! the Decision Cards this crate walks across.
//! - **[policy-as-code-engine](https://github.com/mizcausevic-dev/policy-as-code-engine)** —
//! the remediation plan can drive `force_recheck` calls against the
//! PolicyBundles those cards produce.
//! - **[aeo-validator-service](https://github.com/mizcausevic-dev/aeo-validator-service)** —
//! re-validate the affected AEO docs with one call each.
/// Optional audit-stream-py producer. Gated behind the `audit-stream`
/// Cargo feature so the core graph crate stays sync and HTTP-free.
pub use IncidentCorrelator;
pub use CorrelationError;
pub use ;
pub use ;
pub use ;