PhotoCraft: An open-source, photo editor written by scratch in pure Rust
test(autosave): align retry coverage with upstream
augrclkb851ca341762
diff --git a/apps/photocraft/src/services.rs b/apps/photocraft/src/services.rsindex b7a5a4cb8..e6c882d19 100644--- a/apps/photocraft/src/services.rs+++ b/apps/photocraft/src/services.rs@@ -907,6 +907,7 @@ mod tests {let mut app = launch(&recovery);new_doc(&mut app, "#ff0000");let revision = app.session.active().unwrap().revision;+ assert_ne!(revision, 0, "a sidecar-less bundle lists as revision 0");autosave(&mut app, &ctx);let mut failed = false;@@ -927,14 +928,16 @@ mod tests {std::fs::remove_file(&recovery).unwrap();std::fs::create_dir(&recovery).unwrap();autosave(&mut app, &ctx);+ // The worker commits the bundle's manifest before it publishes the sidecar, and+ // `list_recovery` lists a committed sidecar-less bundle (revision 0) on its own, so+ // the first non-empty listing can come from the middle of the write. Wait for the write+ // to finish: the entry then carries the sidecar's revision.let mut recovered = Vec::new();let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);while std::time::Instant::now() < deadline {prefs_ui::tick(&mut app, &ctx);recovered = list_recovery(&recovery);- // A committed bundle is recoverable before its sidecar is published. Wait for- // the sidecar's revision, not the early fallback entry (revision 0).- if recovered.len() == 1 && recovered[0].info.revision == revision {+ if recovered.iter().any(|e| e.info.revision == revision) {break;}std::thread::sleep(std::time::Duration::from_millis(10));