Skip to content

Fix Clippy warnings in transport and walk tests#1717

Merged
oferchen merged 1 commit into
masterfrom
fix-clippy-error-for-err.expect
Oct 30, 2025
Merged

Fix Clippy warnings in transport and walk tests#1717
oferchen merged 1 commit into
masterfrom
fix-clippy-error-for-err.expect

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • replace a deprecated .err().expect() pattern in the transport negotiation tests with expect_err
  • adjust the walk error tests to use io::Error::other in accordance with Clippy guidance

Testing

  • cargo clippy --workspace --all-targets --all-features --locked -- -Dwarnings

https://chatgpt.com/codex/tasks/task_e_690393f229d08323be99fe6f15e714a3

@oferchen oferchen merged commit 491a640 into master Oct 30, 2025
@oferchen oferchen deleted the fix-clippy-error-for-err.expect branch October 30, 2025 16:41
oferchen added a commit that referenced this pull request May 4, 2026
Add two windows-latest CI jobs to close beta-blocking gaps:

- windows-iocp: builds and tests with --features iocp explicitly so the
  IOCP code path (PRs #1717-#1721) gets pinned coverage rather than
  relying on default-features inclusion masking regressions.
- windows-acl-xattr: builds and tests the metadata crate on Windows with
  --features acl,xattr so Win32 GetSecurityInfo/SetSecurityInfo and NTFS
  Alternate Data Stream code paths are validated by master CI.

Both jobs depend on the lint job and run on stable, matching the
existing windows-test convention.

Closes #1900
Closes #1869
oferchen added a commit that referenced this pull request May 4, 2026
Add two windows-latest CI jobs to close beta-blocking gaps:

- windows-iocp: builds and tests with --features iocp explicitly so the
  IOCP code path (PRs #1717-#1721) gets pinned coverage rather than
  relying on default-features inclusion masking regressions.
- windows-acl-xattr: builds and tests the metadata crate on Windows with
  --features acl,xattr so Win32 GetSecurityInfo/SetSecurityInfo and NTFS
  Alternate Data Stream code paths are validated by master CI.

Both jobs depend on the lint job and run on stable, matching the
existing windows-test convention.

Closes #1900
Closes #1869
oferchen added a commit that referenced this pull request May 5, 2026
* ci: add Windows IOCP and ACL/xattr matrix entries (#1900, #1869)

Add two windows-latest CI jobs to close beta-blocking gaps:

- windows-iocp: builds and tests with --features iocp explicitly so the
  IOCP code path (PRs #1717-#1721) gets pinned coverage rather than
  relying on default-features inclusion masking regressions.
- windows-acl-xattr: builds and tests the metadata crate on Windows with
  --features acl,xattr so Win32 GetSecurityInfo/SetSecurityInfo and NTFS
  Alternate Data Stream code paths are validated by master CI.

Both jobs depend on the lint job and run on stable, matching the
existing windows-test convention.

Closes #1900
Closes #1869

* fix: cross-platform IOCP and metadata test build on Windows

- Drop redundant `use std::io::Write as _;` from disk_batch tests; the
  trait is already in scope via `use std::io::{self, Write};` and the
  re-export through `use super::*;`. `-D warnings` flagged the duplicate.
- Ungate `use super::*;` and `use std::fs;` in metadata::special tests so
  the `#[cfg(not(unix))]` no-op tests can resolve `create_fifo`,
  `create_device_node`, and `fs::File` on Windows.
- Gate `test_is_device_file` with `#[cfg(unix)]` to match the helper's
  own gate; the test referenced `is_device_file` unconditionally.

Exposed for the first time by the Windows IOCP and ACL/xattr CI matrix
entries added in 42f6f15 (#1900, #1869).

* fix: open IOCP test files with shared write/delete access

The `open_writable` test helper in disk_batch.rs opened files with
`FILE_SHARE_READ` only. `IocpDiskBatch::begin_file` calls
`reopen_overlapped` which uses `ReOpenFile` to obtain a second
write handle with `FILE_FLAG_OVERLAPPED`. Because the original
handle did not permit shared write access, the second open failed
with ERROR_SHARING_VIOLATION (Windows OS error 32), causing four
tests to panic at the first `begin_file` call:

- commit_with_fsync_calls_flush_file_buffers
- begin_file_flushes_previous
- batched_submission_submits_n_chunks
- completion_ordering_independent_of_submission_order

Adding `FILE_SHARE_WRITE | FILE_SHARE_DELETE` to the original
handle lets `ReOpenFile` succeed and lets `tempfile::tempdir` clean
up the directory after the handles drop.

Refs #1900, #1869.

* fix: gate Path import and apply_symlink_metadata on Unix

The Windows ACL/xattr CI matrix entry compiles the metadata crate with
--features acl,xattr under -D warnings. On Windows, std::path::Path was
unused (only consumed by the cfg(unix) current_mode helper) and
apply_symlink_metadata was unused (only the cfg(unix) symlink test calls
it). Both flagged as unused-import errors.

Gate both imports with cfg(unix) so they only appear on platforms that
consume them.

* style: rustfmt-compliant import order in timestamp_2038 test

* fix(ci): unblock Windows IOCP and ACL/xattr matrix entries

Two unrelated Windows-only failures surfaced by the new matrix entries:

1. IOCP reopen_overlapped requested FILE_SHARE_READ only, but the
   handle being reopened has FILE_GENERIC_WRITE access. Win32 sharing
   checks are symmetric, so the new handle's share mode must permit
   the original handle's access mode. Widen to
   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE to match
   the access of the handle being converted. The negative-path test
   still triggers via access-mode mismatch, not share-mode mismatch.

2. metadata::apply timestamp tests used FileTime::seconds(), which
   returns platform-native epoch seconds (Unix epoch on Unix, Windows
   FILETIME 1601 epoch on Windows). Switch to unix_seconds() to match
   the production code in apply/timestamps.rs. Gate the sub-100ns
   nanosecond exact-equality test #[cfg(unix)] because NTFS FILETIME
   has 100ns granularity and cannot roundtrip 89 trailing nanoseconds.

* fix(metadata): cross-platform timestamp tests for Windows ACL/xattr CI

NTFS FILETIME has 100ns granularity, so sub-100ns nanosecond fields
cannot round-trip through the filesystem. Gate the two equality-based
sub-100ns tests on Unix only.

filetime::FileTime::seconds() returns Windows FILETIME 1601-epoch on
Windows but Unix epoch on Unix; switch the remaining mtime/atime
equality assertions to unix_seconds() so they hold on both platforms.

* fix(tests): IOCP socket pump unwrap and NTFS sub-100ns timestamp gate

The IOCP socket tests called Arc::try_unwrap(pump) while reader/writer
still held an Arc clone, causing "pump uniquely owned" panics on the new
Windows IOCP CI job. Drop reader/writer before unwrapping the pump.

The metadata epoch_timestamp_with_nanoseconds_is_preserved test used
123_456_789ns which truncates to 123_456_700ns on NTFS (100ns
granularity); gate it Unix-only matching the other sub-100ns tests.

* fix(tests): gate unix-only mmap/adaptive tests and NTFS-truncating timestamp tests

map_file/tests.rs: gate 78 tests that reference MmapStrategy /
AdaptiveMapStrategy / open_mmap / open_adaptive(_with_threshold|_buffered) /
is_mmap / is_buffered with #[cfg(unix)]. These types and methods are
unix-only in mod.rs/wrapper.rs so the unconditional references break
the Windows IOCP build with E0412/E0433/E0599 (89 errors).

timestamp_2038.rs: gate 10 round-trip tests that pass sub-second
nanosecond values to FileTime::from_unix_time(). NTFS FILETIME stores
100-nanosecond ticks so values like 999_999_999, 123_456_789, 444_555_666
truncate and break equality on Windows. Whole-second tests
(no_overflow_just_past_i32_max, negative_timestamps_are_handled_correctly)
remain cross-platform.

Addresses CI failures on PR #3607:
- Windows IOCP --features iocp (89 compile errors)
- Windows ACL/xattr (file_metadata_preserves_timestamp_at_2038_boundary
  and directory_metadata_preserves_timestamp_beyond_2038 panics)

* fix(tests): unblock Windows IOCP and ACL/xattr CI matrix

Two distinct cross-platform regressions surfaced by the new Windows
matrix entries:

1. ACL/xattr matrix failed to compile on Windows: gating sub-second
   nanosecond timestamp tests behind cfg(unix) made apply_directory_metadata
   and the YEAR_*/BEFORE_*/AFTER_* named constants unused on Windows under
   -D dead-code -D unused-imports. Gate them behind cfg(unix) too. The two
   cross-platform tests (no_overflow_just_past_i32_max,
   negative_timestamps_are_handled_correctly) only need apply_file_metadata.

2. IOCP matrix failed in generator_merge_filters_properly_scoped: the
   assertion compared collected paths against literals using forward
   slashes, but Path::display() emits backslashes on Windows. Normalize
   to forward slashes before comparison; the wire format itself uses
   forward slashes so the comparison reflects actual user-visible paths.

* fix(tests): gate Seek/Write imports for sparse tests on unix only

The integration_sparse tests use Seek, SeekFrom, and Write only inside
#[cfg(unix)] and #[cfg(target_os = "linux")] tests. On Windows ACL/xattr
matrix builds with -D warnings, the unconditional import triggered an
unused-imports error and broke the test binary.

Gate the import with #[cfg(unix)] to match the test gating.

* fix(daemon): gate name_converter tests to unix only

The name_converter_tests module is exercised only on Unix because every
test inside is #[cfg(unix)]-gated. On Windows the module expanded with a
`use super::*;` import and no consumers, tripping unused-imports under
-D warnings in the ACL/xattr matrix entry. Move the gate to the module
itself so the whole block disappears on Windows.

* fix(daemon): gate fuzzy2_generate_content helper to unix only

The fuzzy level 2 daemon test is `#[cfg(unix)]`-gated, but its
`fuzzy2_generate_content` helper was ungated. On Windows under
`-D warnings`, the unused helper produced a dead-code error and
broke the Windows ACL/xattr matrix entry.

Matches the existing gating pattern of the sibling
`fuzzy2_backdate_file` helper in the same file.

* fix(tests): gate unix-only test items for Windows ACL/xattr CI compilation

The windows-acl-xattr CI step runs `cargo nextest run --workspace --features
acl,xattr -E '...'`, which compiles every test crate. Workspace defaults
remain enabled (including iconv), so test code that depends on unix-only
APIs (`OsStrExt::from_bytes`) must be cfg-gated even when its enclosing
test fns already are - otherwise the surrounding `use` items become unused
on Windows and `-D warnings` fails the build.

- `crates/flist/tests/special_characters.rs`: add file-level `#![cfg(unix)]`;
  every test in the file builds non-UTF8 names via `OsStrExt::from_bytes`.
- `crates/flist/tests/unicode_comprehensive.rs`: gate the top-level
  `use std::ffi::OsStr;` with `#[cfg(unix)]` (its only callsites are
  inside `#[cfg(unix)]` invalid-UTF8 tests).
- `crates/protocol/src/flist/read/tests.rs`: tighten the iconv test mod
  cfg from `feature = "iconv"` to `all(feature = "iconv", unix)`; every
  helper inside also constructs non-UTF8 filenames via OsStrExt.

* fix(tests): gate Windows-incompatible chroot defaults in daemon loads_* tests

Daemon module config defaults `use chroot = true` on every platform.
The validator rejects relative module paths when chroot is enabled, and
on Windows `Path::is_absolute()` rejects POSIX paths like /srv/docs.
The 17 loads_*_from_config chunks that pin /srv/docs (or /srv/staging)
therefore panicked under the windows-acl-xattr matrix entry on PR #3607.

Fix: declare `use chroot = no` inline in each affected test config so
the path validator skips the absolute-path check on Windows. The single
chunk that asserts `module.use_chroot()` is gated `#[cfg(unix)]` instead.
This preserves existing semantics on Unix and unblocks the Windows
matrix for #1900 (IOCP) and #1869 (ACL/xattr).
oferchen added a commit that referenced this pull request May 5, 2026
* ci: add Windows IOCP and ACL/xattr matrix entries (#1900, #1869)

Add two windows-latest CI jobs to close beta-blocking gaps:

- windows-iocp: builds and tests with --features iocp explicitly so the
  IOCP code path (PRs #1717-#1721) gets pinned coverage rather than
  relying on default-features inclusion masking regressions.
- windows-acl-xattr: builds and tests the metadata crate on Windows with
  --features acl,xattr so Win32 GetSecurityInfo/SetSecurityInfo and NTFS
  Alternate Data Stream code paths are validated by master CI.

Both jobs depend on the lint job and run on stable, matching the
existing windows-test convention.

Closes #1900
Closes #1869

* fix: cross-platform IOCP and metadata test build on Windows

- Drop redundant `use std::io::Write as _;` from disk_batch tests; the
  trait is already in scope via `use std::io::{self, Write};` and the
  re-export through `use super::*;`. `-D warnings` flagged the duplicate.
- Ungate `use super::*;` and `use std::fs;` in metadata::special tests so
  the `#[cfg(not(unix))]` no-op tests can resolve `create_fifo`,
  `create_device_node`, and `fs::File` on Windows.
- Gate `test_is_device_file` with `#[cfg(unix)]` to match the helper's
  own gate; the test referenced `is_device_file` unconditionally.

Exposed for the first time by the Windows IOCP and ACL/xattr CI matrix
entries added in 42f6f15 (#1900, #1869).

* fix: open IOCP test files with shared write/delete access

The `open_writable` test helper in disk_batch.rs opened files with
`FILE_SHARE_READ` only. `IocpDiskBatch::begin_file` calls
`reopen_overlapped` which uses `ReOpenFile` to obtain a second
write handle with `FILE_FLAG_OVERLAPPED`. Because the original
handle did not permit shared write access, the second open failed
with ERROR_SHARING_VIOLATION (Windows OS error 32), causing four
tests to panic at the first `begin_file` call:

- commit_with_fsync_calls_flush_file_buffers
- begin_file_flushes_previous
- batched_submission_submits_n_chunks
- completion_ordering_independent_of_submission_order

Adding `FILE_SHARE_WRITE | FILE_SHARE_DELETE` to the original
handle lets `ReOpenFile` succeed and lets `tempfile::tempdir` clean
up the directory after the handles drop.

Refs #1900, #1869.

* fix: gate Path import and apply_symlink_metadata on Unix

The Windows ACL/xattr CI matrix entry compiles the metadata crate with
--features acl,xattr under -D warnings. On Windows, std::path::Path was
unused (only consumed by the cfg(unix) current_mode helper) and
apply_symlink_metadata was unused (only the cfg(unix) symlink test calls
it). Both flagged as unused-import errors.

Gate both imports with cfg(unix) so they only appear on platforms that
consume them.

* style: rustfmt-compliant import order in timestamp_2038 test

* fix(ci): unblock Windows IOCP and ACL/xattr matrix entries

Two unrelated Windows-only failures surfaced by the new matrix entries:

1. IOCP reopen_overlapped requested FILE_SHARE_READ only, but the
   handle being reopened has FILE_GENERIC_WRITE access. Win32 sharing
   checks are symmetric, so the new handle's share mode must permit
   the original handle's access mode. Widen to
   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE to match
   the access of the handle being converted. The negative-path test
   still triggers via access-mode mismatch, not share-mode mismatch.

2. metadata::apply timestamp tests used FileTime::seconds(), which
   returns platform-native epoch seconds (Unix epoch on Unix, Windows
   FILETIME 1601 epoch on Windows). Switch to unix_seconds() to match
   the production code in apply/timestamps.rs. Gate the sub-100ns
   nanosecond exact-equality test #[cfg(unix)] because NTFS FILETIME
   has 100ns granularity and cannot roundtrip 89 trailing nanoseconds.

* fix(metadata): cross-platform timestamp tests for Windows ACL/xattr CI

NTFS FILETIME has 100ns granularity, so sub-100ns nanosecond fields
cannot round-trip through the filesystem. Gate the two equality-based
sub-100ns tests on Unix only.

filetime::FileTime::seconds() returns Windows FILETIME 1601-epoch on
Windows but Unix epoch on Unix; switch the remaining mtime/atime
equality assertions to unix_seconds() so they hold on both platforms.

* fix(tests): IOCP socket pump unwrap and NTFS sub-100ns timestamp gate

The IOCP socket tests called Arc::try_unwrap(pump) while reader/writer
still held an Arc clone, causing "pump uniquely owned" panics on the new
Windows IOCP CI job. Drop reader/writer before unwrapping the pump.

The metadata epoch_timestamp_with_nanoseconds_is_preserved test used
123_456_789ns which truncates to 123_456_700ns on NTFS (100ns
granularity); gate it Unix-only matching the other sub-100ns tests.

* fix(tests): gate unix-only mmap/adaptive tests and NTFS-truncating timestamp tests

map_file/tests.rs: gate 78 tests that reference MmapStrategy /
AdaptiveMapStrategy / open_mmap / open_adaptive(_with_threshold|_buffered) /
is_mmap / is_buffered with #[cfg(unix)]. These types and methods are
unix-only in mod.rs/wrapper.rs so the unconditional references break
the Windows IOCP build with E0412/E0433/E0599 (89 errors).

timestamp_2038.rs: gate 10 round-trip tests that pass sub-second
nanosecond values to FileTime::from_unix_time(). NTFS FILETIME stores
100-nanosecond ticks so values like 999_999_999, 123_456_789, 444_555_666
truncate and break equality on Windows. Whole-second tests
(no_overflow_just_past_i32_max, negative_timestamps_are_handled_correctly)
remain cross-platform.

Addresses CI failures on PR #3607:
- Windows IOCP --features iocp (89 compile errors)
- Windows ACL/xattr (file_metadata_preserves_timestamp_at_2038_boundary
  and directory_metadata_preserves_timestamp_beyond_2038 panics)

* fix(tests): unblock Windows IOCP and ACL/xattr CI matrix

Two distinct cross-platform regressions surfaced by the new Windows
matrix entries:

1. ACL/xattr matrix failed to compile on Windows: gating sub-second
   nanosecond timestamp tests behind cfg(unix) made apply_directory_metadata
   and the YEAR_*/BEFORE_*/AFTER_* named constants unused on Windows under
   -D dead-code -D unused-imports. Gate them behind cfg(unix) too. The two
   cross-platform tests (no_overflow_just_past_i32_max,
   negative_timestamps_are_handled_correctly) only need apply_file_metadata.

2. IOCP matrix failed in generator_merge_filters_properly_scoped: the
   assertion compared collected paths against literals using forward
   slashes, but Path::display() emits backslashes on Windows. Normalize
   to forward slashes before comparison; the wire format itself uses
   forward slashes so the comparison reflects actual user-visible paths.

* fix(tests): gate Seek/Write imports for sparse tests on unix only

The integration_sparse tests use Seek, SeekFrom, and Write only inside
#[cfg(unix)] and #[cfg(target_os = "linux")] tests. On Windows ACL/xattr
matrix builds with -D warnings, the unconditional import triggered an
unused-imports error and broke the test binary.

Gate the import with #[cfg(unix)] to match the test gating.

* fix(daemon): gate name_converter tests to unix only

The name_converter_tests module is exercised only on Unix because every
test inside is #[cfg(unix)]-gated. On Windows the module expanded with a
`use super::*;` import and no consumers, tripping unused-imports under
-D warnings in the ACL/xattr matrix entry. Move the gate to the module
itself so the whole block disappears on Windows.

* fix(daemon): gate fuzzy2_generate_content helper to unix only

The fuzzy level 2 daemon test is `#[cfg(unix)]`-gated, but its
`fuzzy2_generate_content` helper was ungated. On Windows under
`-D warnings`, the unused helper produced a dead-code error and
broke the Windows ACL/xattr matrix entry.

Matches the existing gating pattern of the sibling
`fuzzy2_backdate_file` helper in the same file.

* fix(tests): gate unix-only test items for Windows ACL/xattr CI compilation

The windows-acl-xattr CI step runs `cargo nextest run --workspace --features
acl,xattr -E '...'`, which compiles every test crate. Workspace defaults
remain enabled (including iconv), so test code that depends on unix-only
APIs (`OsStrExt::from_bytes`) must be cfg-gated even when its enclosing
test fns already are - otherwise the surrounding `use` items become unused
on Windows and `-D warnings` fails the build.

- `crates/flist/tests/special_characters.rs`: add file-level `#![cfg(unix)]`;
  every test in the file builds non-UTF8 names via `OsStrExt::from_bytes`.
- `crates/flist/tests/unicode_comprehensive.rs`: gate the top-level
  `use std::ffi::OsStr;` with `#[cfg(unix)]` (its only callsites are
  inside `#[cfg(unix)]` invalid-UTF8 tests).
- `crates/protocol/src/flist/read/tests.rs`: tighten the iconv test mod
  cfg from `feature = "iconv"` to `all(feature = "iconv", unix)`; every
  helper inside also constructs non-UTF8 filenames via OsStrExt.

* fix(tests): gate Windows-incompatible chroot defaults in daemon loads_* tests

Daemon module config defaults `use chroot = true` on every platform.
The validator rejects relative module paths when chroot is enabled, and
on Windows `Path::is_absolute()` rejects POSIX paths like /srv/docs.
The 17 loads_*_from_config chunks that pin /srv/docs (or /srv/staging)
therefore panicked under the windows-acl-xattr matrix entry on PR #3607.

Fix: declare `use chroot = no` inline in each affected test config so
the path validator skips the absolute-path check on Windows. The single
chunk that asserts `module.use_chroot()` is gated `#[cfg(unix)]` instead.
This preserves existing semantics on Unix and unblocks the Windows
matrix for #1900 (IOCP) and #1869 (ACL/xattr).
oferchen added a commit that referenced this pull request May 7, 2026
Adds a focused plan for benchmarking the IOCP file I/O path
(crates/fast_io/src/iocp/, #1717-#1721) against synchronous
std::fs::File writes. Covers small (4K-64K) and large (1M-100M)
file workloads with 1/4/16/64 concurrent streams, cross-references
matched io_uring workloads (#1868), specifies the windows-latest
runner with --features iocp via xtask windows-bench, and defines
seven decision criteria gating the flip of IocpPolicy::Auto to
IOCP-as-default.

Refs: #1899, #1868, #1717-#1721
oferchen added a commit that referenced this pull request May 18, 2026
* ci: add Windows IOCP and ACL/xattr matrix entries (#1900, #1869)

Add two windows-latest CI jobs to close beta-blocking gaps:

- windows-iocp: builds and tests with --features iocp explicitly so the
  IOCP code path (PRs #1717-#1721) gets pinned coverage rather than
  relying on default-features inclusion masking regressions.
- windows-acl-xattr: builds and tests the metadata crate on Windows with
  --features acl,xattr so Win32 GetSecurityInfo/SetSecurityInfo and NTFS
  Alternate Data Stream code paths are validated by master CI.

Both jobs depend on the lint job and run on stable, matching the
existing windows-test convention.

Closes #1900
Closes #1869

* fix: cross-platform IOCP and metadata test build on Windows

- Drop redundant `use std::io::Write as _;` from disk_batch tests; the
  trait is already in scope via `use std::io::{self, Write};` and the
  re-export through `use super::*;`. `-D warnings` flagged the duplicate.
- Ungate `use super::*;` and `use std::fs;` in metadata::special tests so
  the `#[cfg(not(unix))]` no-op tests can resolve `create_fifo`,
  `create_device_node`, and `fs::File` on Windows.
- Gate `test_is_device_file` with `#[cfg(unix)]` to match the helper's
  own gate; the test referenced `is_device_file` unconditionally.

Exposed for the first time by the Windows IOCP and ACL/xattr CI matrix
entries added in 42f6f15 (#1900, #1869).

* fix: open IOCP test files with shared write/delete access

The `open_writable` test helper in disk_batch.rs opened files with
`FILE_SHARE_READ` only. `IocpDiskBatch::begin_file` calls
`reopen_overlapped` which uses `ReOpenFile` to obtain a second
write handle with `FILE_FLAG_OVERLAPPED`. Because the original
handle did not permit shared write access, the second open failed
with ERROR_SHARING_VIOLATION (Windows OS error 32), causing four
tests to panic at the first `begin_file` call:

- commit_with_fsync_calls_flush_file_buffers
- begin_file_flushes_previous
- batched_submission_submits_n_chunks
- completion_ordering_independent_of_submission_order

Adding `FILE_SHARE_WRITE | FILE_SHARE_DELETE` to the original
handle lets `ReOpenFile` succeed and lets `tempfile::tempdir` clean
up the directory after the handles drop.

Refs #1900, #1869.

* fix: gate Path import and apply_symlink_metadata on Unix

The Windows ACL/xattr CI matrix entry compiles the metadata crate with
--features acl,xattr under -D warnings. On Windows, std::path::Path was
unused (only consumed by the cfg(unix) current_mode helper) and
apply_symlink_metadata was unused (only the cfg(unix) symlink test calls
it). Both flagged as unused-import errors.

Gate both imports with cfg(unix) so they only appear on platforms that
consume them.

* style: rustfmt-compliant import order in timestamp_2038 test

* fix(ci): unblock Windows IOCP and ACL/xattr matrix entries

Two unrelated Windows-only failures surfaced by the new matrix entries:

1. IOCP reopen_overlapped requested FILE_SHARE_READ only, but the
   handle being reopened has FILE_GENERIC_WRITE access. Win32 sharing
   checks are symmetric, so the new handle's share mode must permit
   the original handle's access mode. Widen to
   FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE to match
   the access of the handle being converted. The negative-path test
   still triggers via access-mode mismatch, not share-mode mismatch.

2. metadata::apply timestamp tests used FileTime::seconds(), which
   returns platform-native epoch seconds (Unix epoch on Unix, Windows
   FILETIME 1601 epoch on Windows). Switch to unix_seconds() to match
   the production code in apply/timestamps.rs. Gate the sub-100ns
   nanosecond exact-equality test #[cfg(unix)] because NTFS FILETIME
   has 100ns granularity and cannot roundtrip 89 trailing nanoseconds.

* fix(metadata): cross-platform timestamp tests for Windows ACL/xattr CI

NTFS FILETIME has 100ns granularity, so sub-100ns nanosecond fields
cannot round-trip through the filesystem. Gate the two equality-based
sub-100ns tests on Unix only.

filetime::FileTime::seconds() returns Windows FILETIME 1601-epoch on
Windows but Unix epoch on Unix; switch the remaining mtime/atime
equality assertions to unix_seconds() so they hold on both platforms.

* fix(tests): IOCP socket pump unwrap and NTFS sub-100ns timestamp gate

The IOCP socket tests called Arc::try_unwrap(pump) while reader/writer
still held an Arc clone, causing "pump uniquely owned" panics on the new
Windows IOCP CI job. Drop reader/writer before unwrapping the pump.

The metadata epoch_timestamp_with_nanoseconds_is_preserved test used
123_456_789ns which truncates to 123_456_700ns on NTFS (100ns
granularity); gate it Unix-only matching the other sub-100ns tests.

* fix(tests): gate unix-only mmap/adaptive tests and NTFS-truncating timestamp tests

map_file/tests.rs: gate 78 tests that reference MmapStrategy /
AdaptiveMapStrategy / open_mmap / open_adaptive(_with_threshold|_buffered) /
is_mmap / is_buffered with #[cfg(unix)]. These types and methods are
unix-only in mod.rs/wrapper.rs so the unconditional references break
the Windows IOCP build with E0412/E0433/E0599 (89 errors).

timestamp_2038.rs: gate 10 round-trip tests that pass sub-second
nanosecond values to FileTime::from_unix_time(). NTFS FILETIME stores
100-nanosecond ticks so values like 999_999_999, 123_456_789, 444_555_666
truncate and break equality on Windows. Whole-second tests
(no_overflow_just_past_i32_max, negative_timestamps_are_handled_correctly)
remain cross-platform.

Addresses CI failures on PR #3607:
- Windows IOCP --features iocp (89 compile errors)
- Windows ACL/xattr (file_metadata_preserves_timestamp_at_2038_boundary
  and directory_metadata_preserves_timestamp_beyond_2038 panics)

* fix(tests): unblock Windows IOCP and ACL/xattr CI matrix

Two distinct cross-platform regressions surfaced by the new Windows
matrix entries:

1. ACL/xattr matrix failed to compile on Windows: gating sub-second
   nanosecond timestamp tests behind cfg(unix) made apply_directory_metadata
   and the YEAR_*/BEFORE_*/AFTER_* named constants unused on Windows under
   -D dead-code -D unused-imports. Gate them behind cfg(unix) too. The two
   cross-platform tests (no_overflow_just_past_i32_max,
   negative_timestamps_are_handled_correctly) only need apply_file_metadata.

2. IOCP matrix failed in generator_merge_filters_properly_scoped: the
   assertion compared collected paths against literals using forward
   slashes, but Path::display() emits backslashes on Windows. Normalize
   to forward slashes before comparison; the wire format itself uses
   forward slashes so the comparison reflects actual user-visible paths.

* fix(tests): gate Seek/Write imports for sparse tests on unix only

The integration_sparse tests use Seek, SeekFrom, and Write only inside
#[cfg(unix)] and #[cfg(target_os = "linux")] tests. On Windows ACL/xattr
matrix builds with -D warnings, the unconditional import triggered an
unused-imports error and broke the test binary.

Gate the import with #[cfg(unix)] to match the test gating.

* fix(daemon): gate name_converter tests to unix only

The name_converter_tests module is exercised only on Unix because every
test inside is #[cfg(unix)]-gated. On Windows the module expanded with a
`use super::*;` import and no consumers, tripping unused-imports under
-D warnings in the ACL/xattr matrix entry. Move the gate to the module
itself so the whole block disappears on Windows.

* fix(daemon): gate fuzzy2_generate_content helper to unix only

The fuzzy level 2 daemon test is `#[cfg(unix)]`-gated, but its
`fuzzy2_generate_content` helper was ungated. On Windows under
`-D warnings`, the unused helper produced a dead-code error and
broke the Windows ACL/xattr matrix entry.

Matches the existing gating pattern of the sibling
`fuzzy2_backdate_file` helper in the same file.

* fix(tests): gate unix-only test items for Windows ACL/xattr CI compilation

The windows-acl-xattr CI step runs `cargo nextest run --workspace --features
acl,xattr -E '...'`, which compiles every test crate. Workspace defaults
remain enabled (including iconv), so test code that depends on unix-only
APIs (`OsStrExt::from_bytes`) must be cfg-gated even when its enclosing
test fns already are - otherwise the surrounding `use` items become unused
on Windows and `-D warnings` fails the build.

- `crates/flist/tests/special_characters.rs`: add file-level `#![cfg(unix)]`;
  every test in the file builds non-UTF8 names via `OsStrExt::from_bytes`.
- `crates/flist/tests/unicode_comprehensive.rs`: gate the top-level
  `use std::ffi::OsStr;` with `#[cfg(unix)]` (its only callsites are
  inside `#[cfg(unix)]` invalid-UTF8 tests).
- `crates/protocol/src/flist/read/tests.rs`: tighten the iconv test mod
  cfg from `feature = "iconv"` to `all(feature = "iconv", unix)`; every
  helper inside also constructs non-UTF8 filenames via OsStrExt.

* fix(tests): gate Windows-incompatible chroot defaults in daemon loads_* tests

Daemon module config defaults `use chroot = true` on every platform.
The validator rejects relative module paths when chroot is enabled, and
on Windows `Path::is_absolute()` rejects POSIX paths like /srv/docs.
The 17 loads_*_from_config chunks that pin /srv/docs (or /srv/staging)
therefore panicked under the windows-acl-xattr matrix entry on PR #3607.

Fix: declare `use chroot = no` inline in each affected test config so
the path validator skips the absolute-path check on Windows. The single
chunk that asserts `module.use_chroot()` is gated `#[cfg(unix)]` instead.
This preserves existing semantics on Unix and unblocks the Windows
matrix for #1900 (IOCP) and #1869 (ACL/xattr).
oferchen added a commit that referenced this pull request May 18, 2026
Adds a focused plan for benchmarking the IOCP file I/O path
(crates/fast_io/src/iocp/, #1717-#1721) against synchronous
std::fs::File writes. Covers small (4K-64K) and large (1M-100M)
file workloads with 1/4/16/64 concurrent streams, cross-references
matched io_uring workloads (#1868), specifies the windows-latest
runner with --features iocp via xtask windows-bench, and defines
seven decision criteria gating the flip of IocpPolicy::Auto to
IOCP-as-default.

Refs: #1899, #1868, #1717-#1721
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant