test(transfer): pin the verify-failure name and the format-derived gate - #7251
Merged
Conversation
Both halves of upstream's `receiver.c:1071-1091` diagnostic are already
correct on the path that emits it - measured against rsync 3.4.4 rather
than assumed - but neither is pinned in the dimension that would catch a
regression.
The name. Every existing cell uses a FLAT `payload.bin`, where the flist
name, the basename and a name relativised against the wrong root all
collapse to one string. Only a nested file separates them. Upstream prints
`sub/deep/payload.bin` identically on a local copy, a remote-shell push and
a remote-shell pull, and an absolute destination OPERAND does not change it
because the receiver has already `change_dir()`ed into that root
(`main.c:815`). oc joins a destination root to reach the file on disk, so
the absolute path is the value most readily to hand, which is exactly why
it needs pinning. The new cell uses both discriminators: nested, and an
absolute destination.
The gate. `options.c:2345-2358` feeds `stdout_format_has_i` from two
sources, and `-i` REWRITES `stdout_format` to `"%i %n%L"`. So a bare
`--out-format='%i%n'` with no `-i` and no `-v` still enables the warning.
A gate implemented as "did the user pass -i" is silent there. That input is
the only one separating the two spellings, and nothing covered it - the
existing cells pin default-silent and `-v`-emits only.
Proven red, each by its own mutation and only its own:
- naming the joined destination instead of the flist name fails the
nested cell, leaving the gate cell green
- forcing the format-derived disjunct to false fails the gate cell,
leaving the nested cell green
Note for anyone repeating that: `test_support::oc_rsync_bin()` resolves
`target/debug/oc-rsync` at RUNTIME, so these integration tests carry no
build dependency on the binary they exercise. A mutation whose link step
fails leaves the previous binary in place and the test still passes. The
first attempt here did exactly that, against an OOM-killed link.
# Conflicts: # crates/transfer/tests/verify_redo_recovers_network_paths.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.
Tests only. No production change - both halves of #352 measure already
correct on the path that emits the diagnostic. What they were missing is a test
in the dimension that would catch a regression.
Measured first, against rsync 3.4.4
Forced a real verification failure the way upstream's own
--append-verifydoes: the destination holds a wrong 100 KiB prefix under a 200 KiB source, so
the whole-file checksum fails and a phase-2 redo follows. File nested at
sub/deep/payload.bin.Upstream prints the same name on every transport, so there is no per-transport
answer:
sub/deep/payload.binsub/deep/payload.binsub/deep/payload.binsub/deep/payload.binsub/deep/payload.binsub/deep/payload.binsub/deep/payload.binsub/deep/payload.binEvery cell recovered byte-correctly on both binaries. The gate matches too:
-v-i(no-v)--out-format=%i%n(no-v, no-i)The local cell is silent because the local-copy emit site is #7235, not merged.
That is an absence, not an absolute-path defect.
What was unpinned
Every existing cell in this file uses a FLAT
payload.bin, where threedifferent renderings collapse to one string: the flist name, the basename, and a
name relativised against the wrong root. A rendering that dropped the directory
prefix would pass all of them.
And the gate was pinned only for default-silent and
-v. The input thatactually separates the two possible implementations - a format carrying
%iwith no
-i- was untested.The two cells
Nested name. Uses both discriminators at once: a nested file, and an
ABSOLUTE destination operand. Upstream
change_dir()s into the destination root(
main.c:815) sofnameatreceiver.c:1089is the file-list name however theoperand was written; oc joins a destination root to reach the file on disk, so
the absolute path is the value most readily to hand. The absolute operand is
where a joined path leaks and nowhere else.
Format-derived gate.
options.c:2345-2358feedsstdout_format_has_ifromtwo sources, and
-iREWRITESstdout_formatto"%i %n%L":So
--out-format='%i%n'with no-iand no-vstill enables the warning. Agate implemented as "did the user pass
-i" is silent there.Proven red
Each mutation turns red its own cell and only its own:
falseA gate defect found while doing that
test_support::oc_rsync_bin()resolvestarget/debug/oc-rsyncat runtime;it is not
env!("CARGO_BIN_EXE_oc-rsync"). These integration tests thereforecarry no build dependency on the binary they exercise - a mutation whose
link step fails leaves the previous binary in place and the test still passes.
That is not hypothetical: my first mutation run reported green against an
OOM-killed link, and I only caught it because the standalone build reported
exit 101 while the test reported success. Every mutation result above was
re-taken after confirming
cargo build --bin oc-rsyncexited 0. Filedseparately - it makes this whole test family capable of validating a stale
binary.
Verification
cargo nextest run -p transfer --all-features -E 'test(nested_flist_name) or test(gate_reads_the_output_format)'- 2 passed, on a tree confirmed free ofboth mutations. Exit codes read directly, never through a pipe. GitHub Actions
has not validated this; it is not scheduling.