fix: align serde test cfg gate and unhang socketpair stderr test#3395
Merged
fix: align serde test cfg gate and unhang socketpair stderr test#3395
Conversation
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.
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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