Make the CI checks say what they mean, and format the workspace
The Android job's "Verify minimum API level" step has never verified the minimum API level. It took the first `*.so` anywhere under the target directory, which is a host proc-macro from debug/deps — an x86-64 object built by the runner's gcc, whose .comment section cannot mention Android and so can never contradict the expected value. It now reads the artifact under the target triple, compares against MIN_API parsed from the Dockerfile rather than a second copy of the number, and fails on a mismatch. Both sides are checked non-empty first: two failed parses would otherwise compare equal and pass, which is the same silent success in a new costume. The Android image installs one SDK package per layer and keeps the output. sdkmanager is a JVM program that aborts when it cannot get memory, and the single `> /dev/null` step reported that as a bare "exit code 134" while a retry re-downloaded everything that had already succeeded. tools/ci-local.sh runs all four jobs — desktop, android, layering, traceability — against the host toolchain, which is pinned to the same 1.92.0 CI installs. Its matrix check compares regeneration against the working tree rather than against HEAD: CI starts from a clean checkout, so git's answer is the right one there and reports every local run stale here. The rest is rustfmt across the workspace, and the clippy findings that surfaced once it did: manual_contains in dr-thumbs and collections_ui, a map iterated as pairs for its keys, an index loop over a slice, and two runtime assertions on a constant now made at compile time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -316,9 +316,8 @@ fn remove_within(
|
||||
}
|
||||
let mut removed = 0;
|
||||
{
|
||||
let mut stmt = conn.prepare(
|
||||
"DELETE FROM collection_members WHERE collection_id = ?1 AND image_id = ?2",
|
||||
)?;
|
||||
let mut stmt = conn
|
||||
.prepare("DELETE FROM collection_members WHERE collection_id = ?1 AND image_id = ?2")?;
|
||||
for img in images {
|
||||
removed += stmt.execute(rusqlite::params![id.0 as i64, img.0 as i64])?;
|
||||
}
|
||||
@@ -397,7 +396,8 @@ pub fn save_smart(
|
||||
}
|
||||
}
|
||||
|
||||
let json = serde_json::to_string(selector).map_err(|e| CatalogError::BadSelector(e.to_string()))?;
|
||||
let json =
|
||||
serde_json::to_string(selector).map_err(|e| CatalogError::BadSelector(e.to_string()))?;
|
||||
let n = conn.execute(
|
||||
"UPDATE collections SET selector_json = ?2, kind = 1 WHERE id = ?1 AND deleted = 0",
|
||||
rusqlite::params![id.0 as i64, json],
|
||||
@@ -470,7 +470,9 @@ pub fn collections_for_image(
|
||||
ORDER BY c.name",
|
||||
)?;
|
||||
let rows = stmt
|
||||
.query_map([image.0 as i64], |r| Ok(CollectionId(r.get::<_, i64>(0)? as u64)))?
|
||||
.query_map([image.0 as i64], |r| {
|
||||
Ok(CollectionId(r.get::<_, i64>(0)? as u64))
|
||||
})?
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
Ok(rows)
|
||||
}
|
||||
@@ -492,9 +494,8 @@ pub fn descendants(
|
||||
let mut frontier = vec![root];
|
||||
let mut guard = 0usize;
|
||||
|
||||
let mut stmt = conn.prepare(
|
||||
"SELECT id FROM collections WHERE parent_id = ?1 AND deleted = 0",
|
||||
)?;
|
||||
let mut stmt =
|
||||
conn.prepare("SELECT id FROM collections WHERE parent_id = ?1 AND deleted = 0")?;
|
||||
|
||||
while let Some(next) = frontier.pop() {
|
||||
guard += 1;
|
||||
@@ -507,7 +508,9 @@ pub fn descendants(
|
||||
}
|
||||
|
||||
let children = stmt
|
||||
.query_map([next.0 as i64], |r| Ok(CollectionId(r.get::<_, i64>(0)? as u64)))?
|
||||
.query_map([next.0 as i64], |r| {
|
||||
Ok(CollectionId(r.get::<_, i64>(0)? as u64))
|
||||
})?
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
for child in children {
|
||||
@@ -668,7 +671,9 @@ fn require_exists(conn: &Connection, id: CollectionId) -> Result<(), CatalogErro
|
||||
|r| r.get(0),
|
||||
)
|
||||
.optional()?;
|
||||
found.map(|_| ()).ok_or(CatalogError::NoSuchCollection(id.0))
|
||||
found
|
||||
.map(|_| ())
|
||||
.ok_or(CatalogError::NoSuchCollection(id.0))
|
||||
}
|
||||
|
||||
/// A random UUID, formatted as the canonical 8-4-4-4-12.
|
||||
@@ -685,8 +690,22 @@ fn new_uuid() -> String {
|
||||
format!(
|
||||
"{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-\
|
||||
{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}",
|
||||
b[0], b[1], b[2], b[3], b[4], b[5], v6, b[7], v8, b[9], b[10], b[11], b[12], b[13],
|
||||
b[14], b[15]
|
||||
b[0],
|
||||
b[1],
|
||||
b[2],
|
||||
b[3],
|
||||
b[4],
|
||||
b[5],
|
||||
v6,
|
||||
b[7],
|
||||
v8,
|
||||
b[9],
|
||||
b[10],
|
||||
b[11],
|
||||
b[12],
|
||||
b[13],
|
||||
b[14],
|
||||
b[15]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -797,7 +816,10 @@ mod tests {
|
||||
let rows = tree(c).unwrap();
|
||||
assert_eq!(rows.len(), 2);
|
||||
assert_eq!(rows[0].collection.name, "Trips");
|
||||
assert!(rows[0].has_children, "a parent must draw a disclosure arrow");
|
||||
assert!(
|
||||
rows[0].has_children,
|
||||
"a parent must draw a disclosure arrow"
|
||||
);
|
||||
assert_eq!(rows[1].depth, 1, "the child is indented one level");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user