Skip to content

Commit 07b1547

Browse files
committed
fixup: allow clippy lints in tests, skip unparseable build products
Address CI failures and review feedback: - Add #[allow(clippy::unwrap_used, clippy::expect_used)] to the test module — the crate-level deny triggers on test helpers using unwrap(). - Replace collect::<anyhow::Result<_>>()? with filter_map + warn log for build product parsing. A single corrupt DB row (e.g. legacy product with a non-store path) should not abort the entire cached build — log and skip instead, consistent with how malformed build outputs are already skipped via `let Ok(mut res) ... else { continue }` on the line above. - Fix import ordering (rustfmt).
1 parent fd3543d commit 07b1547

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

subprojects/hydra-queue-runner/src/state/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::BTreeMap;
22
use std::hash::Hash;
3-
use std::sync::Arc;
43
use std::sync::atomic::{AtomicBool, AtomicI32, Ordering};
4+
use std::sync::Arc;
55

66
use anyhow::Context;
77
use hashbrown::{HashMap, HashSet};
@@ -744,6 +744,7 @@ impl Builds {
744744
}
745745

746746
#[cfg(test)]
747+
#[allow(clippy::unwrap_used, clippy::expect_used)]
747748
mod tests {
748749
use super::*;
749750

subprojects/hydra-queue-runner/src/state/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,8 +2060,18 @@ impl State {
20602060
.get_build_products_for_build_id(build_id)
20612061
.await?
20622062
.into_iter()
2063-
.map(|p| build::BuildProduct::from_db(self.store.store_dir(), p))
2064-
.collect::<anyhow::Result<_>>()?;
2063+
.filter_map(|p| {
2064+
match build::BuildProduct::from_db(self.store.store_dir(), p) {
2065+
Ok(bp) => Some(bp),
2066+
Err(e) => {
2067+
tracing::warn!(
2068+
"Skipping build product with unparseable path: {e:#}"
2069+
);
2070+
None
2071+
}
2072+
}
2073+
})
2074+
.collect();
20652075
res.metrics = db
20662076
.get_build_metrics_for_build_id(build_id)
20672077
.await?

0 commit comments

Comments
 (0)