From c0ab617e61dc9586cee7c3e361070296abcdf12a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 16:17:45 +0200 Subject: [PATCH] cultcache-rs: pin that only a cultcache.store header claims a format A file that opens like a store but carries some other string where the header goes is undecodable, not a store in a format this runtime does not read. cargo-mutants left the guard's `true` mutant alive without this case. The size-limited child's stdout and stderr now travel with the parent's failure message, so a child that fails for another reason says which. Co-Authored-By: Claude Opus 5.5 --- packages/cultcache-rs/src/lib.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/cultcache-rs/src/lib.rs b/packages/cultcache-rs/src/lib.rs index e1ceae55..794f2699 100644 --- a/packages/cultcache-rs/src/lib.rs +++ b/packages/cultcache-rs/src/lib.rs @@ -4800,7 +4800,14 @@ mod tests { let temp = tempfile::tempdir()?; let path = temp.path().join("store.cc"); let store = SingleFileMessagePackBackingStore::new(&path); - for bytes in [&b"not a store at all"[..], &[0x92, 0xa3, b'a', b'b'][..], &[0xc1][..]] { + // The last opens like a store, with a string where the header goes, but only a + // `cultcache.store.*` header claims a format this runtime might not read. + for bytes in [ + &b"not a store at all"[..], + &[0x92, 0xa3, b'a', b'b'][..], + &[0xc1][..], + &[0x92, 0xa2, b'a', b'b', 0x90][..], + ] { fs::write(&path, bytes)?; let error = store.pull_all().unwrap_err(); assert_eq!(unreadable_kind(&error), Some(CultCacheStoreUnreadableKind::Undecodable), "{bytes:?}: {error:#}"); @@ -4875,13 +4882,20 @@ mod tests { let temp = tempfile::tempdir()?; let path = temp.path().join("store.cc"); let (store, before) = written_store(&path)?; - let status = std::process::Command::new("sh") + let child = std::process::Command::new("sh") .arg("-c") .arg("trap '' XFSZ; ulimit -f 64; exec \"$0\" --exact --test-threads=1 --quiet tests::a_write_that_fails_part_way_leaves_no_staging_file_and_keeps_the_store") .arg(std::env::current_exe()?) .env(CHILD_STORE, &path) - .status()?; - assert!(status.success(), "the size-limited child did not fail its write as expected: {status}"); + .output()?; + assert!( + child.status.success(), + "the size-limited child did not fail its write as expected: {} +{}{}", + child.status, + String::from_utf8_lossy(&child.stdout), + String::from_utf8_lossy(&child.stderr) + ); let staging: Vec<_> = fs::read_dir(temp.path())? .map(|entry| entry.map(|entry| entry.file_name().to_string_lossy().into_owned()))