Make the CI checks say what they mean, and format the workspace
Build and test / Desktop (Linux) (push) Successful in 1h23m26s
Build and test / Android (aarch64) (push) Failing after 2s
Build and test / Layer separation (push) Successful in 50s
Traceability / Requirement traces (push) Failing after 1m9s

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:
2026-08-16 12:02:51 +02:00
co-authored by Claude Opus 5
parent 94a2686dcb
commit 03326242a1
31 changed files with 927 additions and 387 deletions
+18 -13
View File
@@ -429,10 +429,9 @@ impl ThumbStore {
for (file_id, shard) in in_unsealed {
match self.open_shard(shard, false) {
Ok(conn) => {
if let Err(e) = conn.execute(
"DELETE FROM thumbs WHERE file_id = ?1",
[file_id as i64],
) {
if let Err(e) =
conn.execute("DELETE FROM thumbs WHERE file_id = ?1", [file_id as i64])
{
log::debug!("forgetting thumbnail {file_id} in shard {shard}: {e}");
}
}
@@ -502,7 +501,7 @@ impl ThumbStore {
// fallback below assumes.
let has_size = src
.prepare("SELECT * FROM thumbs LIMIT 0")
.map(|stmt| stmt.column_names().iter().any(|c| *c == "size"))
.map(|stmt| stmt.column_names().contains(&"size"))
.unwrap_or(false);
let sql = if has_size {
@@ -594,7 +593,7 @@ CREATE TABLE IF NOT EXISTS thumbs (
fn migrate_size_column(conn: &Connection, table: &str) -> Result<(), ThumbError> {
let has_size: bool = conn
.prepare(&format!("SELECT * FROM {table} LIMIT 0"))
.map(|stmt| stmt.column_names().iter().any(|c| *c == "size"))
.map(|stmt| stmt.column_names().contains(&"size"))
.unwrap_or(true);
if has_size {
return Ok(());
@@ -748,7 +747,6 @@ mod tests {
assert!(s.get(1, ThumbSize::Grid).unwrap().is_some());
}
#[test]
fn the_two_size_classes_coexist() {
// Adding the large class must not evict or shadow the grid one: the
@@ -800,7 +798,6 @@ mod tests {
assert_eq!(ThumbSize::for_cell(400), ThumbSize::Large);
}
#[test]
fn a_shard_written_before_the_size_class_accepts_new_thumbnails() {
// The index is not the only table with a `size` column: every shard
@@ -969,8 +966,16 @@ mod tests {
let original = s.shard_of(0, ThumbSize::Grid).unwrap();
s.put(0, ThumbSize::Grid, &thumb(32)).unwrap();
assert_eq!(s.shard_of(0, ThumbSize::Grid), Some(original), "must stay put");
assert_eq!(s.get(0, ThumbSize::Grid).unwrap().unwrap().bytes.len(), 32, "but update");
assert_eq!(
s.shard_of(0, ThumbSize::Grid),
Some(original),
"must stay put"
);
assert_eq!(
s.get(0, ThumbSize::Grid).unwrap().unwrap().bytes.len(),
32,
"but update"
);
}
#[test]
@@ -997,7 +1002,8 @@ mod tests {
mine.put(1, ThumbSize::Grid, &thumb(64)).unwrap();
// A second store standing in for another device's downloaded shard.
let other_dir = std::env::temp_dir().join(format!("dr-thumbs-other-{}", std::process::id()));
let other_dir =
std::env::temp_dir().join(format!("dr-thumbs-other-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&other_dir);
let mut theirs = ThumbStore::open(&other_dir).unwrap();
theirs.put(1, ThumbSize::Grid, &thumb(999)).unwrap(); // we already have this one
@@ -1017,8 +1023,7 @@ mod tests {
#[test]
fn merging_is_idempotent() {
let (mut mine, _d1) = store();
let other_dir =
std::env::temp_dir().join(format!("dr-thumbs-idem-{}", std::process::id()));
let other_dir = std::env::temp_dir().join(format!("dr-thumbs-idem-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&other_dir);
let mut theirs = ThumbStore::open(&other_dir).unwrap();
theirs.put(10, ThumbSize::Grid, &thumb(64)).unwrap();