Author:
Hash:
Timestamp:
+34 -73 +/-9 browse
Kevin Schoon [me@kevinschoon.com]
4aa8281dd5ca346a35ab84aaef4f00c353414de8
Sun, 05 Oct 2025 19:47:21 +0000 (1 month ago)
| 1 | diff --git a/ayllu-build/src/error.rs b/ayllu-build/src/error.rs |
| 2 | index c91a359..ba64405 100644 |
| 3 | --- a/ayllu-build/src/error.rs |
| 4 | +++ b/ayllu-build/src/error.rs |
| 5 | @@ -25,7 +25,20 @@ pub enum Error { |
| 6 | |
| 7 | impl std::fmt::Display for Error { |
| 8 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 9 | - todo!() |
| 10 | + match self { |
| 11 | + Error::CannotReadManifest { path, io_err } => { |
| 12 | + write!(f, "Cannot read manifest: {path:?}, {io_err}") |
| 13 | + } |
| 14 | + Error::InvalidManifest { path, json_err } => { |
| 15 | + write!(f, "Manifest is invalid: {path:?}, {json_err}") |
| 16 | + } |
| 17 | + Error::EmptyWorkflow { name } => write!(f, "Workflow {name} is empty"), |
| 18 | + Error::CycleDetected => write!(f, "Cycle Detected!"), // FIXME: Where? |
| 19 | + Error::DuplicateStepNames { name } => write!(f, "Duplicate step detected: {name}"), |
| 20 | + Error::DuplicateWorkflows => write!(f, "Duplicate Workflows!"), // FIXME: Which? |
| 21 | + Error::Io(error) => write!(f, "Io Error: {error}"), |
| 22 | + Error::Db(error) => write!(f, "SQL Error: {error}"), |
| 23 | + } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | diff --git a/ayllu-build/src/executor.rs b/ayllu-build/src/executor.rs |
| 28 | index a97e2d7..ff8c100 100644 |
| 29 | --- a/ayllu-build/src/executor.rs |
| 30 | +++ b/ayllu-build/src/executor.rs |
| 31 | @@ -114,10 +114,7 @@ impl Executor for Local { |
| 32 | .filter(|(k, _)| k == "TERM" || k == "TZ" || k == "LANG" || k == "PATH") |
| 33 | .collect(); |
| 34 | // FIXME: If user specified None for an env it should override the defaults |
| 35 | - filtered_env.extend(context.environment.iter().filter_map(|env| match env.1 { |
| 36 | - Some(value) => Some((env.0.clone(), value.clone())), |
| 37 | - None => None, |
| 38 | - })); |
| 39 | + filtered_env.extend(context.environment.iter().filter_map(|env| env.1.as_ref().map(|value| (env.0.clone(), value.clone())))); |
| 40 | filtered_env.extend([ |
| 41 | (String::from("AYLLU_GIT_HASH"), context.git_hash.clone()), |
| 42 | (String::from("AYLLU_REPO_URL"), context.repo_url.clone()), |
| 43 | diff --git a/ayllu-build/src/models.rs b/ayllu-build/src/models.rs |
| 44 | index ee4e282..1f1a769 100644 |
| 45 | --- a/ayllu-build/src/models.rs |
| 46 | +++ b/ayllu-build/src/models.rs |
| 47 | @@ -101,7 +101,7 @@ impl Manifest { |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | - pub fn from_dir(path: &Path) -> Result<Self, Error> { |
| 52 | + pub fn from_dir(_path: &Path) -> Result<Self, Error> { |
| 53 | todo!() |
| 54 | // let mut files: Vec<PathBuf> = Vec::new(); |
| 55 | // for dir_entry in read_dir(path)? { |
| 56 | @@ -123,17 +123,3 @@ impl Manifest { |
| 57 | // } |
| 58 | } |
| 59 | } |
| 60 | - |
| 61 | - #[cfg(test)] |
| 62 | - mod tests { |
| 63 | - // use std::path::Path; |
| 64 | - |
| 65 | - // use super::*; |
| 66 | - |
| 67 | - // #[test] |
| 68 | - // fn test_manifest_simple() { |
| 69 | - // let manifest = |
| 70 | - // Manifest::from_file(Path::new("tests/simple.ncl")).expect("failed to load manifest"); |
| 71 | - // assert!(manifest.workflows.len() == 1); |
| 72 | - // } |
| 73 | - } |
| 74 | diff --git a/ayllu/src/config.rs b/ayllu/src/config.rs |
| 75 | index 202032b..c57f4dd 100644 |
| 76 | --- a/ayllu/src/config.rs |
| 77 | +++ b/ayllu/src/config.rs |
| 78 | @@ -67,11 +67,6 @@ pub struct Sites { |
| 79 | pub enabled: bool, |
| 80 | } |
| 81 | |
| 82 | - #[derive(Deserialize, Serialize, Clone, Debug)] |
| 83 | - pub struct Highlighting { |
| 84 | - pub names: Vec<String>, |
| 85 | - } |
| 86 | - |
| 87 | #[derive(Default, Deserialize, Serialize, Clone, Debug)] |
| 88 | pub struct Collection { |
| 89 | pub name: String, |
| 90 | @@ -195,31 +190,6 @@ impl TreeSitter { |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | - #[derive(Clone, Debug)] |
| 95 | - pub struct PublicKey { |
| 96 | - inner: openssh_keys::PublicKey, |
| 97 | - } |
| 98 | - |
| 99 | - impl Serialize for PublicKey { |
| 100 | - fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> |
| 101 | - where |
| 102 | - S: serde::Serializer, |
| 103 | - { |
| 104 | - self.inner.to_string().serialize(serializer) |
| 105 | - } |
| 106 | - } |
| 107 | - |
| 108 | - impl<'de> Deserialize<'de> for PublicKey { |
| 109 | - fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
| 110 | - where |
| 111 | - D: serde::Deserializer<'de>, |
| 112 | - { |
| 113 | - let key_str = String::deserialize(deserializer)?; |
| 114 | - let pub_key = openssh_keys::PublicKey::parse(&key_str).map_err(serde::de::Error::custom)?; |
| 115 | - Ok(PublicKey { inner: pub_key }) |
| 116 | - } |
| 117 | - } |
| 118 | - |
| 119 | #[derive(Deserialize, Serialize, Clone, Debug)] |
| 120 | pub struct Lfs { |
| 121 | pub url_template: String, |
| 122 | diff --git a/ayllu/src/web2/dag.rs b/ayllu/src/web2/dag.rs |
| 123 | index 39b9c6d..4cd7783 100644 |
| 124 | --- a/ayllu/src/web2/dag.rs |
| 125 | +++ b/ayllu/src/web2/dag.rs |
| 126 | @@ -1,8 +1,8 @@ |
| 127 | - use std::{collections::HashMap, pin::Pin}; |
| 128 | + use std::collections::HashMap; |
| 129 | |
| 130 | use ayllu_api::build::Unit; |
| 131 | use ayllu_database::build::{ManifestView, Step, Workflow}; |
| 132 | - use petgraph::{dot, graph::NodeIndex, Graph}; |
| 133 | + use petgraph::{dot, Graph}; |
| 134 | |
| 135 | #[derive(Debug)] |
| 136 | enum MappedUnit<'a> { |
| 137 | diff --git a/ayllu/src/web2/middleware/database.rs b/ayllu/src/web2/middleware/database.rs |
| 138 | index 8b5ccf2..dfa068e 100644 |
| 139 | --- a/ayllu/src/web2/middleware/database.rs |
| 140 | +++ b/ayllu/src/web2/middleware/database.rs |
| 141 | @@ -10,6 +10,7 @@ use crate::{config::Config, web2::error::Error}; |
| 142 | pub struct Builds(pub(crate) Option<ayllu_database::Wrapper>); |
| 143 | |
| 144 | impl Builds { |
| 145 | + #[allow(dead_code)] |
| 146 | pub fn enabled(&self) -> bool { |
| 147 | self.0.is_some() |
| 148 | } |
| 149 | diff --git a/ayllu/src/web2/routes/build.rs b/ayllu/src/web2/routes/build.rs |
| 150 | index 4c2cb14..f9a1075 100644 |
| 151 | --- a/ayllu/src/web2/routes/build.rs |
| 152 | +++ b/ayllu/src/web2/routes/build.rs |
| 153 | @@ -36,7 +36,7 @@ struct BuildTemplate<'a> { |
| 154 | } |
| 155 | |
| 156 | pub async fn build( |
| 157 | - Extension(cfg): Extension<Config>, |
| 158 | + Extension(_cfg): Extension<Config>, |
| 159 | Extension(builds): Extension<Builds>, |
| 160 | Extension(preamble): Extension<Preamble>, |
| 161 | Extension(highlighter): Extension<Highlighter>, |
| 162 | @@ -108,7 +108,7 @@ struct BuildsTemplate<'a> { |
| 163 | } |
| 164 | |
| 165 | pub async fn builds( |
| 166 | - Extension(cfg): Extension<Config>, |
| 167 | + Extension(_cfg): Extension<Config>, |
| 168 | Extension(builds): Extension<Builds>, |
| 169 | Extension(preamble): Extension<Preamble>, |
| 170 | Extension(mut base): Extension<Base>, |
| 171 | diff --git a/ayllu/src/web2/routes/repo.rs b/ayllu/src/web2/routes/repo.rs |
| 172 | index 68e2f3f..f17deb4 100644 |
| 173 | --- a/ayllu/src/web2/routes/repo.rs |
| 174 | +++ b/ayllu/src/web2/routes/repo.rs |
| 175 | @@ -56,12 +56,6 @@ fn chat_links(cfg: &GitConfig) -> Vec<ChatLink> { |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | - #[derive(Serialize, Clone)] |
| 180 | - pub struct EmailLink { |
| 181 | - pub url: String, |
| 182 | - pub description: Option<String>, |
| 183 | - } |
| 184 | - |
| 185 | #[derive(askama::Template)] |
| 186 | #[template(path = "repo.html")] |
| 187 | #[allow(dead_code)] |
| 188 | @@ -94,7 +88,7 @@ pub async fn serve( |
| 189 | Extension(cfg): Extension<Config>, |
| 190 | Extension(preamble): Extension<Preamble>, |
| 191 | Extension(adapter): Extension<TreeSitterAdapter>, |
| 192 | - Extension(builds): Extension<Builds>, |
| 193 | + Extension(_builds): Extension<Builds>, // FIXME: Actually hide the builds page |
| 194 | Extension(mut base): Extension<Base>, |
| 195 | ) -> Result<Html<String>, Error> { |
| 196 | let repository = Wrapper::new(preamble.repo_path.as_path())?; |
| 197 | diff --git a/ayllu/src/web2/template.rs b/ayllu/src/web2/template.rs |
| 198 | index 28a865c..44f63d3 100644 |
| 199 | --- a/ayllu/src/web2/template.rs |
| 200 | +++ b/ayllu/src/web2/template.rs |
| 201 | @@ -133,18 +133,18 @@ pub mod filters { |
| 202 | Ok(util::human_bytes(*bytes as f64)) |
| 203 | } |
| 204 | |
| 205 | - pub fn friendly_duration_i64( |
| 206 | - input: &Option<i64>, |
| 207 | - _: &dyn askama::Values, |
| 208 | - ) -> askama::Result<String> { |
| 209 | - match input { |
| 210 | - Some(value) => Ok(format!( |
| 211 | - "{:?}", |
| 212 | - std::time::Duration::from_millis(*value as u64) |
| 213 | - )), |
| 214 | - None => Ok("?".to_string()), |
| 215 | - } |
| 216 | - } |
| 217 | + // pub fn friendly_duration_i64( |
| 218 | + // input: &Option<i64>, |
| 219 | + // _: &dyn askama::Values, |
| 220 | + // ) -> askama::Result<String> { |
| 221 | + // match input { |
| 222 | + // Some(value) => Ok(format!( |
| 223 | + // "{:?}", |
| 224 | + // std::time::Duration::from_millis(*value as u64) |
| 225 | + // )), |
| 226 | + // None => Ok("?".to_string()), |
| 227 | + // } |
| 228 | + // } |
| 229 | |
| 230 | pub fn verified_class_name( |
| 231 | verified: &Option<bool>, |