From a7deef15a9f42affc9f51393f58806b4e6c96cd4 Mon Sep 17 00:00:00 2001 From: discord9 Date: Tue, 4 Aug 2026 20:05:26 +0800 Subject: [PATCH] fix(object-store): skip removed-entry lister test on Windows (#8735) DirEntry on Windows is a snapshot from FindFirstFileW: file_type() and metadata() keep returning cached data after the file is removed, so read_list_entry() cannot observe the deletion. The test asserts the Unix behavior (lstat returns ENOENT) and fails deterministically on Windows nightly CI (4/4 tries). Gate it with #[cfg(not(windows))]. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- src/object-store/src/secure_fs.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/object-store/src/secure_fs.rs b/src/object-store/src/secure_fs.rs index cb58f6b2ad..496ae34d27 100644 --- a/src/object-store/src/secure_fs.rs +++ b/src/object-store/src/secure_fs.rs @@ -622,6 +622,14 @@ mod tests { assert!(operator.list("file/").await.unwrap().is_empty()); } + // On Windows, `std::fs::DirEntry` is a snapshot taken by + // `FindFirstFileW`: `file_type()` and `metadata()` keep returning the + // cached data even after the file is removed, so `read_list_entry` + // cannot observe the deletion and returns `Some` instead of `None`. + // This test only applies to platforms where metadata is fetched from + // the live filesystem (e.g. Unix `lstat` returns `ENOENT` after + // removal, which `read_list_entry` turns into `None`). + #[cfg(not(windows))] #[test] fn test_lister_skips_entry_removed_during_iteration() { let temp_dir = create_temp_dir("secure_fs_lister_removed_entry");