diff --git a/lib/crates/fabro-validate/src/rules.rs b/lib/crates/fabro-validate/src/rules.rs index 1bae5f571..b62b59e3d 100644 --- a/lib/crates/fabro-validate/src/rules.rs +++ b/lib/crates/fabro-validate/src/rules.rs @@ -3,6 +3,7 @@ use std::str::FromStr; use fabro_graphviz::condition::parse_condition; use fabro_graphviz::graph::{is_llm_handler_type, AttrValue, Graph}; +use fabro_graphviz::stylesheet::{parse_stylesheet, Selector}; use crate::{Diagnostic, LintRule, Severity}; @@ -348,7 +349,7 @@ impl LintRule for StylesheetSyntaxRule { if stylesheet.is_empty() { return Vec::new(); } - match fabro_graphviz::stylesheet::parse_stylesheet(stylesheet) { + match parse_stylesheet(stylesheet) { Ok(_) => Vec::new(), Err(e) => vec![Diagnostic { rule: self.name().to_string(), @@ -902,12 +903,12 @@ impl LintRule for ScriptAbsoluteCdRule { struct StylesheetModelKnownRule; impl StylesheetModelKnownRule { - fn selector_label(selector: &fabro_graphviz::stylesheet::Selector) -> String { + fn selector_label(selector: &Selector) -> String { match selector { - fabro_graphviz::stylesheet::Selector::Universal => "*".to_string(), - fabro_graphviz::stylesheet::Selector::Shape(s) => s.clone(), - fabro_graphviz::stylesheet::Selector::Class(c) => format!(".{c}"), - fabro_graphviz::stylesheet::Selector::Id(id) => format!("#{id}"), + Selector::Universal => "*".to_string(), + Selector::Shape(s) => s.clone(), + Selector::Class(c) => format!(".{c}"), + Selector::Id(id) => format!("#{id}"), } } } @@ -922,7 +923,7 @@ impl LintRule for StylesheetModelKnownRule { if stylesheet_str.is_empty() { return Vec::new(); } - let stylesheet = match fabro_graphviz::stylesheet::parse_stylesheet(stylesheet_str) { + let stylesheet = match parse_stylesheet(stylesheet_str) { Ok(ss) => ss, Err(_) => return Vec::new(), // syntax errors caught by stylesheet_syntax rule }; diff --git a/lib/crates/fabro-workflows/src/condition.rs b/lib/crates/fabro-workflows/src/condition.rs index 9df445867..13745f624 100644 --- a/lib/crates/fabro-workflows/src/condition.rs +++ b/lib/crates/fabro-workflows/src/condition.rs @@ -261,18 +261,6 @@ mod tests { )); } - #[test] - fn parse_condition_validates() { - assert!(parse_condition("outcome=success").is_ok()); - assert!(parse_condition("outcome=success && context.x=y").is_ok()); - assert!(parse_condition("").is_ok()); - } - - #[test] - fn parse_condition_accepts_bare_key() { - assert!(parse_condition("some_flag").is_ok()); - } - #[test] fn context_dotted_fallback() { let outcome = make_outcome(StageStatus::Success); diff --git a/lib/crates/fabro-workflows/src/context/keys.rs b/lib/crates/fabro-workflows/src/context/keys.rs index 391521d87..3289914bd 100644 --- a/lib/crates/fabro-workflows/src/context/keys.rs +++ b/lib/crates/fabro-workflows/src/context/keys.rs @@ -1,7 +1,7 @@ -// Static context key constants and helper functions for dynamic keys. -// -// All context keys used across the engine, handlers, and preamble are -// defined here to prevent typos and improve discoverability. +//! Static context key constants and helper functions for dynamic keys. +//! +//! All context keys used across the engine, handlers, and preamble are +//! defined here to prevent typos and improve discoverability. // --- Top-level keys --- pub const CURRENT_NODE: &str = "current_node"; diff --git a/lib/crates/fabro-workflows/src/error.rs b/lib/crates/fabro-workflows/src/error.rs index a9991623c..b649205f3 100644 --- a/lib/crates/fabro-workflows/src/error.rs +++ b/lib/crates/fabro-workflows/src/error.rs @@ -426,6 +426,12 @@ impl From for FabroError { } } +impl From for FabroError { + fn from(e: fabro_validate::ValidationError) -> Self { + Self::Validation(e.0) + } +} + pub type Result = std::result::Result; #[cfg(test)] diff --git a/lib/crates/fabro-workflows/src/handler/manager_loop.rs b/lib/crates/fabro-workflows/src/handler/manager_loop.rs index f8e6ba25d..9d19570d4 100644 --- a/lib/crates/fabro-workflows/src/handler/manager_loop.rs +++ b/lib/crates/fabro-workflows/src/handler/manager_loop.rs @@ -61,7 +61,7 @@ fn parse_child_graph(node: &Node) -> Result { .and_then(|v| v.as_str()) { let (graph, diagnostics) = prepare_from_file(std::path::Path::new(path))?; - fabro_validate::raise_on_errors(&diagnostics).map_err(|e| FabroError::Validation(e.0))?; + fabro_validate::raise_on_errors(&diagnostics)?; return Ok(graph); } Err(FabroError::handler("No child workflow source".to_string())) diff --git a/lib/crates/fabro-workflows/src/workflow.rs b/lib/crates/fabro-workflows/src/workflow.rs index 508a5ba2d..b2b386fb1 100644 --- a/lib/crates/fabro-workflows/src/workflow.rs +++ b/lib/crates/fabro-workflows/src/workflow.rs @@ -106,7 +106,7 @@ pub fn prepare_from_file(path: &Path) -> Result<(Graph, Vec), FabroE pub fn prepare_from_source(dot_source: &str) -> Result { let builder = WorkflowBuilder::new(); let (graph, diagnostics) = builder.prepare(dot_source)?; - fabro_validate::raise_on_errors(&diagnostics).map_err(|e| FabroError::Validation(e.0))?; + fabro_validate::raise_on_errors(&diagnostics)?; Ok(graph) }