Weave Compliance
Governance
Governance hooks for Weave Compliance: policy enforcement, access reviews, and decision logging tied to evidence IDs.
Purpose
Audit trails, regulatory reports, ethics checks, governance, evidence IDs, and compliance documentation.
This page follows the real source shape for Weave Compliance and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
Primary types to know
AIDecision— libs/weave-compliance/src/ethics.rsAIOperation— libs/weave-compliance/src/compliance.rsApiDocumentation— libs/weave-compliance/src/docs.rsAuditEvent— libs/weave-compliance/src/audit.rsAuditEventId— libs/weave-compliance/src/audit.rsAuditReport— libs/weave-compliance/src/audit.rsAuditReportCriteria— libs/weave-compliance/src/audit.rsBiasAnalysis— libs/weave-compliance/src/ethics.rsDataAsset— libs/weave-compliance/src/governance.rsDataGovernanceResult— libs/weave-compliance/src/governance.rsDataOperation— libs/weave-compliance/src/lib.rsDataOperationRecord— libs/weave-compliance/src/governance.rs
Example shape
use chrono::Utc;
use weave_compliance::governance::{
DataAsset, DataGovernanceManager, DataOperationRecord, ProductionDataGovernanceManager,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// ProductionDataGovernanceManager applies the platform's data classification
// and retention rules to every operation that touches user data.
let manager = ProductionDataGovernanceManager::new();
let asset = DataAsset {
id: "asset-customer-profile-123".into(),
classification: Some("PII".into()),
};
let classified = manager.classify_and_protect_data(&asset).await?;
let lineage = DataOperationRecord {
operation_id: "op-7c2".into(),
source_data: asset.id.clone(),
target_data: "analytics.customer-profile.v3".into(),
transformation_type: "mask-and-aggregate".into(),
actor: "did:l1fe:agent:analytics".into(),
timestamp: Utc::now(),
};
let tracked = manager.track_data_lineage(&lineage).await?;
println!(
"classification={} controls={} lineage_id={}",
classified.classification, classified.privacy_controls, tracked.operation_id,
);
Ok(())
}