Skip to content

fix: align serde test cfg gate and unhang socketpair stderr test#3395

Merged
oferchen merged 3 commits intomasterfrom
fix/feature-flag-and-aux-channel-tests
Apr 26, 2026
Merged

fix: align serde test cfg gate and unhang socketpair stderr test#3395
oferchen merged 3 commits intomasterfrom
fix/feature-flag-and-aux-channel-tests

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

Fixes two CI failures inherited by every open PR (#3391, #3392, #3393, #3394, etc.).

1. capabilities_preferred_compression (serde matrix)

The protocol crate's `zstd` feature is independent from the compress crate's `zstd` feature. The test asserted against `cfg(feature = "zstd")` evaluated in protocol, but `preferred_compression()` delegates to `compress::ProtocolCompressionProfile::preferred_codec_name()` which evaluates the compress crate's own feature.

Replace the duplicated cfg gate with a query against the same authoritative source so the test always agrees with the implementation regardless of feature-matrix combinations.

2. `configure_stderr_channel_installs_socketpair_when_possible` (no-default-features matrix)

`command.stderr(Stdio::from(fd))` stores the child socketpair end inside `Command`. `command.spawn()` takes `&mut self` and only dups the fd into the child without consuming the stored `Stdio`, so the parent process keeps a writer reference. The drain thread then blocks on EOF that never arrives (test timed out > 60s in CI).

Drop `command` after `child.wait()` so the only remaining writer is the (now-closed) child fd.

Test plan

  • `cargo nextest run -p protocol --features serde -E 'test(capabilities_preferred_compression)'` (CI)
  • `cargo nextest run -p rsync_io --no-default-features -E 'test(configure_stderr_channel_installs_socketpair_when_possible)'` (CI)
  • All required CI checks

Two CI failures inherited by all open PRs:

1. `capabilities_preferred_compression` (serde matrix): the protocol
   crate's `zstd` feature is independent from the compress crate's
   `zstd` feature. The test asserted against `cfg(feature = "zstd")`
   evaluated in protocol, but `preferred_compression()` delegates to
   `compress::ProtocolCompressionProfile::preferred_codec_name()`
   which evaluates the compress crate's own feature. Replace the
   duplicated cfg gate with a query against the same authoritative
   source.

2. `configure_stderr_channel_installs_socketpair_when_possible`
   (no-default-features matrix): `command.stderr(Stdio::from(fd))`
   stored the child socketpair end inside `Command`. `command.spawn()`
   takes `&mut self` and only dups the fd into the child without
   consuming the stored Stdio, so the parent process kept a writer
   reference. The drain thread then blocked on EOF that never
   arrived. Drop `command` after `child.wait()` so the only remaining
   writer is the (now-closed) child fd.
@github-actions github-actions Bot added the bug Something isn't working label Apr 26, 2026
The `_b` named binding in `channel_join_is_idempotent` extends the writer
half's lifetime to end-of-scope, so the drain thread on `a` blocks
forever waiting for EOF. Switch to the wildcard pattern `_` which drops
immediately. Diagnosed via the no-default-features matrix timing out at
360s on this exact test.

The previous serde test compared `caps.preferred_compression()` against
`ProtocolCompressionProfile::for_protocol(version).preferred_codec_name()`,
which is exactly how `preferred_compression()` is implemented - a
tautology that vacuously passes. Replace with hard invariants: legacy
peers always advertise zlib; modern peers select between zstd and zlibx
depending on whether the codec is compiled in. This catches drift in
the negotiation table without coupling the test to either crate's
feature graph.
Zero-copy reflink methods (clonefile, FICLONE, ReFS DUPLICATE_EXTENTS)
return bytes_copied=0 from the platform_copy dispatch layer because no
data physically traversed userspace. The user-facing copy_file_optimized_with
wrapper was passing this through unchanged, causing macOS test failures
(test_copy_large_file, test_copy_file_optimized_result_type) and
under-reporting transfer statistics.

Substitute the source file size_hint when CopyResult::is_zero_copy() so
progress and statistics reflect the data made available at the destination.
The lower-layer dispatch contract is preserved (it still reports 0 for
zero-copy methods, as required by platform_copy/tests.rs).
@oferchen oferchen merged commit 759edc8 into master Apr 26, 2026
40 of 41 checks passed
@oferchen oferchen deleted the fix/feature-flag-and-aux-channel-tests branch April 26, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant