WeaveDocs
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.rs
  • AIOperation — libs/weave-compliance/src/compliance.rs
  • ApiDocumentation — libs/weave-compliance/src/docs.rs
  • AuditEvent — libs/weave-compliance/src/audit.rs
  • AuditEventId — libs/weave-compliance/src/audit.rs
  • AuditReport — libs/weave-compliance/src/audit.rs
  • AuditReportCriteria — libs/weave-compliance/src/audit.rs
  • BiasAnalysis — libs/weave-compliance/src/ethics.rs
  • DataAsset — libs/weave-compliance/src/governance.rs
  • DataGovernanceResult — libs/weave-compliance/src/governance.rs
  • DataOperation — libs/weave-compliance/src/lib.rs
  • DataOperationRecord — 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(())
}