Use miette #[related] for validation errors
Each ValidationError is now a Diagnostic rendered individually
instead of being joined into a single string.

Assisted-by: GLM-5.1 via pi
change rrurqqlktutxlwxvzxqqrvkxkymonukz
commit 1d5e3dfae36ff37a8dd5af47d77186e0308a3ab8
author Alpha Chen <alpha@kejadlen.dev>
date
parent lvlyknkm
diff --git a/src/ci.rs b/src/ci.rs
index 9074b9c..7339ad4 100644
--- a/src/ci.rs
+++ b/src/ci.rs
@@ -385,7 +385,8 @@ pub fn eval_ci(
 }
 
 /// A validation error found in the job graph.
-#[derive(Debug)]
+#[derive(Debug, thiserror::Error, miette::Diagnostic)]
+#[error("{message}")]
 pub struct ValidationError {
     pub message: String,
 }
diff --git a/src/error.rs b/src/error.rs
index 773410d..e66dc3f 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -17,7 +17,8 @@ pub enum Error {
     #[error(transparent)]
     Fennel(#[from] crate::fennel::FennelError),
 
-    #[error("CI validation failed: {}", .0.iter().map(|e| e.message.clone()).collect::<Vec<_>>().join("; "))]
+    #[error("CI validation failed")]
+    #[related]
     Validation(Vec<crate::ci::ValidationError>),
 
     #[error("lua error: {0}")]