agileplus-trace-validator 0.3.0

Typed intent graphs for engineering work — convert prompts into validated DAGs of intents, features, tasks, tests, and edges, then store, query, and serve them from Rust, HTTP, or MCP.
Documentation
//! Canonical-map field validation on edges.

use crate::{ValidationError, ValidationResult};
use agileplus_domain::intent_graph::*;

/// Validate canonical_map fields on edges.
/// Checks that `direction` is not set without `link_type`.
pub fn validate_canonical_map(graph: &IntentGraph) -> ValidationResult {
    let mut errors = Vec::new();

    for edge in &graph.edges {
        if let Some(cm) = &edge.canonical_map {
            if cm.link_type.is_none() && cm.direction.is_some() {
                errors.push(ValidationError::CanonicalMapError(format!(
                    "Edge {} has canonical_map.direction without link_type",
                    edge.id
                )));
            }
        }
    }

    if errors.is_empty() {
        Ok(())
    } else {
        Err(errors)
    }
}