From a15af6bef9857f87883e4f6d66de6944a3523412 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sun, 29 Nov 2026 22:37:02 +0100 Subject: [PATCH 1/2] WIP: fix two timing-dependent ui-egui tests (#18011) Co-Authored-By: Claude Opus 5.5 From b22eb7be0034e1641a59b7eafc9b799067531446 Mon Sep 17 00:00:00 2001 From: David Mann Date: Sun, 29 Nov 2026 22:53:37 +0100 Subject: [PATCH 2/2] test(ui): make two timing-dependent tests deterministic (#18011) The recent-thumbnail invalidation test let a stale 10 ms file stat expire between its two passes, so the finished replacement decoder no longer matched the revision. It now waits out the old stat after rewriting the file. The background fill test drops its own 30 s deadline, which a loaded runner overran; nextest's CI timeout still catches a hang. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/dialogs/caf_ui/tests.rs | 4 ++-- crates/ui-egui/src/home_recent_ui.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs/caf_ui/tests.rs b/crates/ui-egui/src/dialogs/caf_ui/tests.rs index e2d2031ac38..de280dfdc2d 100644 --- a/crates/ui-egui/src/dialogs/caf_ui/tests.rs +++ b/crates/ui-egui/src/dialogs/caf_ui/tests.rs @@ -314,9 +314,9 @@ fn a_background_fill_remembers_its_settings_only_when_its_job_is_applied() { assert_eq!(saved(&app), Some(remembered), "nothing is remembered while the fill runs"); assert_eq!(app.jobs.caf_settings.len(), 1, "the fill runs as a background job"); let ctx = ctx(&app); - let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30); + // No deadline of its own: a loaded runner can take over a minute for the fill, and the test runner's + // timeout catches a job that never ends. while app.session.has_jobs() { - assert!(std::time::Instant::now() < deadline, "the fill job did not end"); crate::jobs_ui::tick(&mut app, &ctx); std::thread::sleep(std::time::Duration::from_millis(1)); } diff --git a/crates/ui-egui/src/home_recent_ui.rs b/crates/ui-egui/src/home_recent_ui.rs index 73bf1966447..650a1c07a6a 100644 --- a/crates/ui-egui/src/home_recent_ui.rs +++ b/crates/ui-egui/src/home_recent_ui.rs @@ -559,6 +559,10 @@ mod tests { assert_ne!(before, revision_of(&app, &path_string), "invalidation must change the real source's revision"); // Check invalidation with unchanged metadata first, then make stale and fresh decoder pixels distinct. std::fs::write(&path_string, flat_png([20, 100, 60, 255])).unwrap(); + // The revision read above statted the old file. Let that stat expire and read the new file now, so no + // stat between the passes below changes the revision under the replacement decoder (#18011). + std::thread::sleep(RECHECK_INTERVAL); + revision_of(&app, &path_string); // The former picture may be a stand-in, but it cannot satisfy the invalidated revision as Ready. assert!(