From 1f1fe338f44c230553e1b5ab579f578ca99b978d Mon Sep 17 00:00:00 2001 From: John Coffey Date: Tue, 10 Nov 2026 11:43:43 -0700 Subject: [PATCH] Blob store cleanup: say the bytes differ when the sizes match A different copy of the same size was reported as "the current blob store has 12054 bytes, the old one 12054", which reads as a match. --- crates/services/src/inbuxa_blob_cleanup.rs | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/crates/services/src/inbuxa_blob_cleanup.rs b/crates/services/src/inbuxa_blob_cleanup.rs index c1145360..62da8407 100644 --- a/crates/services/src/inbuxa_blob_cleanup.rs +++ b/crates/services/src/inbuxa_blob_cleanup.rs @@ -113,6 +113,16 @@ pub async fn start( Ok(Ok(())) } +/// OC-4: what a `different` problem says. Two copies of the same size +/// differ in their bytes, so the sizes alone would read as a match. +fn different_detail(current: usize, old: usize) -> String { + if current == old { + format!("the current blob store's {current} bytes differ from the old one's") + } else { + format!("the current blob store has {current} bytes, the old one {old}") + } +} + /// OC-3: whether the two stores share a place: one a sharded set with the /// other among its members, or a probe written to the current store found /// in the old one. @@ -320,11 +330,7 @@ impl Run<'_> { ProblemKind::Different, key, &holder, - format!( - "the current blob store has {} bytes, the old one {}", - kept.len(), - old.len() - ), + different_detail(kept.len(), old.len()), ); return self.save(false).await; } @@ -528,4 +534,16 @@ mod tests { let _ = std::fs::remove_dir_all(&dir); let _ = std::fs::remove_dir_all(format!("{path}-other")); } + + #[test] + fn a_different_copy_of_the_same_size_says_the_bytes_differ() { + assert_eq!( + different_detail(12, 12), + "the current blob store's 12 bytes differ from the old one's" + ); + assert_eq!( + different_detail(12, 10), + "the current blob store has 12 bytes, the old one 10" + ); + } } -- 2.54.0