Repository navigation
test(daemon): run the daemon server integration tests un-detached - #7592
Merged
oferchen merged 1 commit intoSep 1, 2026
Merged
Conversation
All 25 tests in tests/integration_daemon_server.rs started their daemon
without --no-detach, so run_daemon reached become_daemon() and the fork's
parent - the test binary - exited 0 before any assertion ran.
The window is not the spawn: thread::spawn returns before the daemon thread
reaches the fork, so a panic! placed straight after it still fires. It is
the first blocking socket call. With 14 unconditional panics placed after
connect_with_retries, all 25 tests still reported PASSED.
Making them execute surfaced four defect classes, none of which could have
been seen before:
1. Greeting. Nine sites sent a bare `@RSYNCD: 32.0`. The digest name list
is mandatory above protocol 31 (clientserver.c:229-241), so every probe
was refused before reaching the feature under test. Five more sites
jumped straight to `#list`, but exchange_protocols() runs at
clientserver.c:1534 and the command line is only read at :1538.
2. Listing shape. Six tests expected a CAP line and an OK line before the
module rows. send_listing() (clientserver.c:1374-1386) writes rows then
`@RSYNCD: EXIT` and nothing else, so those reads consumed the real rows.
In two tests the follow-on loop then spun on end-of-file rather than
ending, turning a wrong expectation into a hang.
3. Assertions that could not fire. server_lists_modules_with_comments
guarded its only assertions behind `if line.contains('\t')`, reached
with an empty line, and so asserted nothing even once executing;
server_enforces_max_connections hid the entire cap probe behind
`if line.contains("OK")`; server_handles_invalid_greeting_response
guarded on `result.is_ok() && !line.is_empty()`. Each is now
unconditional and pinned to the upstream payload.
4. Expectations upstream does not have. `@RSYNCD: EXIT` has exactly one
producer upstream (send_listing, clientserver.c:1385); the unknown-module
arm at :1567-1572 writes the error and drops the connection, so
server_sends_exit_after_error is renamed to
server_closes_connection_after_error and asserts EOF.
auth_flow_protocol_29_md4_succeeds computed plain MD4 where a client that
advertises no list lands on CSUM_MD4_OLD (compat.c:888-891); oc is
correct and the test encoded the wrong digest.
The auth cases also never negotiated anything: perform_auth_handshake took
a digest argument, used it for the client's own arithmetic, and advertised
no list, so the daemon stayed on the md5 fallback. It now advertises the
digest under test above protocol 31.
Mutation-proved across three classes: dropping the listing comment reddens
only server_lists_modules_with_comments (which previously asserted nothing);
altering the max-connections payload reddens only
server_enforces_max_connections; ignoring the client's advertised digest
list reddens the sha512 and sha256 cases while md5 stays green, because md5
is the fallback the old fixture silently relied on.
The no-detach guard ceiling drops to 1, leaving
tests/integration_daemon_max_connections_cap.rs.
oferchen
merged commit Sep 1, 2026
3dcca3f
into
test/daemon-filter-directives-inert
69 checks passed
oferchen
added a commit
that referenced
this pull request
Sep 2, 2026
* test(daemon): run the module filter-directive tests un-detached All three tests in tests/integration_daemon_filter_directives.rs started the daemon without --no-detach. RuntimeOptions::detach defaults to cfg!(unix), so run_daemon reached become_daemon() in the accept loop and the fork's parent - the test binary - exited 0 before any assertion ran. An unconditional panic! placed immediately after the daemon spawn still reported "3 tests run: 3 passed"; the tell was a 0.029s runtime for three full TCP transfers. Making them execute surfaced a second defect the vacuity had masked. The tests checked only that run_client returned Ok. A daemon-refused push does not return Err: generator.c:1669-1671 reports the refusal as FERROR_XFER, log.c:337-338 sets got_xfer_error on receipt, and cleanup.c:217-218 lifts the exit status to RERR_PARTIAL, which arrives on ClientSummary::io_error_exit_code rather than as an error. The push's actual status was therefore never asserted, and an absent .log file on its own is equally consistent with a transfer that achieved nothing - so each test now asserts exit 23 as the positive signal that the module directive fired. collect_files carries file contents alongside the names so a kept file has to arrive intact rather than merely exist, and the module header's upstream citations are moved onto the 3.5.0 pin (clientserver.c:934-951, receiver.c:889, generator.c:1663). Mutation-proved on both assertions: silencing the FERROR_XFER frame in receiver/transfer/candidates.rs leaves the on-disk state correct and reddens only the new exit-code assertion, while disabling the daemon filter check reddens the exclusion assertions with all four files landing. The no-detach guard grows a fourth check for root-level integration tests, which live outside the daemon crate and cannot reach its test-support helpers, with a shrink-only ceiling at the 2 files still to be migrated. * test(daemon): run the daemon server integration tests un-detached (#7592) All 25 tests in tests/integration_daemon_server.rs started their daemon without --no-detach, so run_daemon reached become_daemon() and the fork's parent - the test binary - exited 0 before any assertion ran. The window is not the spawn: thread::spawn returns before the daemon thread reaches the fork, so a panic! placed straight after it still fires. It is the first blocking socket call. With 14 unconditional panics placed after connect_with_retries, all 25 tests still reported PASSED. Making them execute surfaced four defect classes, none of which could have been seen before: 1. Greeting. Nine sites sent a bare `@RSYNCD: 32.0`. The digest name list is mandatory above protocol 31 (clientserver.c:229-241), so every probe was refused before reaching the feature under test. Five more sites jumped straight to `#list`, but exchange_protocols() runs at clientserver.c:1534 and the command line is only read at :1538. 2. Listing shape. Six tests expected a CAP line and an OK line before the module rows. send_listing() (clientserver.c:1374-1386) writes rows then `@RSYNCD: EXIT` and nothing else, so those reads consumed the real rows. In two tests the follow-on loop then spun on end-of-file rather than ending, turning a wrong expectation into a hang. 3. Assertions that could not fire. server_lists_modules_with_comments guarded its only assertions behind `if line.contains('\t')`, reached with an empty line, and so asserted nothing even once executing; server_enforces_max_connections hid the entire cap probe behind `if line.contains("OK")`; server_handles_invalid_greeting_response guarded on `result.is_ok() && !line.is_empty()`. Each is now unconditional and pinned to the upstream payload. 4. Expectations upstream does not have. `@RSYNCD: EXIT` has exactly one producer upstream (send_listing, clientserver.c:1385); the unknown-module arm at :1567-1572 writes the error and drops the connection, so server_sends_exit_after_error is renamed to server_closes_connection_after_error and asserts EOF. auth_flow_protocol_29_md4_succeeds computed plain MD4 where a client that advertises no list lands on CSUM_MD4_OLD (compat.c:888-891); oc is correct and the test encoded the wrong digest. The auth cases also never negotiated anything: perform_auth_handshake took a digest argument, used it for the client's own arithmetic, and advertised no list, so the daemon stayed on the md5 fallback. It now advertises the digest under test above protocol 31. Mutation-proved across three classes: dropping the listing comment reddens only server_lists_modules_with_comments (which previously asserted nothing); altering the max-connections payload reddens only server_enforces_max_connections; ignoring the client's advertised digest list reddens the sha512 and sha256 cases while md5 stays green, because md5 is the fallback the old fixture silently relied on. The no-detach guard ceiling drops to 1, leaving tests/integration_daemon_max_connections_cap.rs.
oferchen
added a commit
that referenced
this pull request
Sep 2, 2026
`## [Unreleased]` last covered the #7304-#7522 era. Measured against the 60 most recently merged pull requests, 44 were absent; of the most recent 45, 43 were absent. Nothing from #7574 onward was recorded at all. Each entry is derived from what the pull request actually landed - the merge commit and the body - not from its title. Three cases where those differ: * #7616 ships far more than the doc-alias correction its body describes: the `upstream_version` pin moves to 3.5.0 and `--version` starts naming `quic`, `sd-notify`, `vmsplice` and `send_zc`. * #7618 also adds the pull-request rustdoc-link job its body says was filed separately, which is what closes the master-only-gate recurrence. * #7602's squash carries the closed #7597 as its first commit, so the directory-obstacle half is recorded under #7602. #7587 is deliberately not recorded. Its merge commit is empty: the change had already landed as #7563, which the section already names. Entries extend the existing Keep a Changelog groups and the bold sub-groupings. Clusters that are one story carry one entry with several references: the FERROR_XFER routing and its two-phase drain (#7576, #7581), the connection-FSM close edge and the accept loop that outlives a session error (#7579, #7590), the three detaching daemon suites (#7578, #7588, #7592), the io_uring and SEND_ZC work (#7593, #7600, #7610), the citation retargets (#7601, #7603, #7604), and the accept-loop pin flake (#7615, #7620). Only `## [Unreleased]` is touched; every released section, including the 3.4.4 statements that were correct when written, is byte-identical.
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.
Stacked on #7588 — base is
test/daemon-filter-directives-inert, which GitHub will retarget tomasteronce that merges. See Ceiling below.The defect
All 25 tests in
tests/integration_daemon_server.rsstarted their daemon without--no-detach.RuntimeOptions::detachdefaults tocfg!(unix), sorun_daemonreachedbecome_daemon()and the parent of that fork — the test binary — exited 0 before any assertion ran.The window is worth stating precisely, because the obvious probe misleads.
thread::spawnreturns before the daemon thread reaches the fork, so an unconditionalpanic!placed straight after the spawn still fires. It is the first blocking socket call that hands the daemon its opportunity. With 14 unconditional panics placed afterconnect_with_retries:Baseline before the fix: 0.082s for 25 tests, each of which opens a TCP connection and drives a protocol exchange.
Four defect classes
Grouped by root cause rather than by symptom.
1 — The client greeting. Nine sites sent a bare
@RSYNCD: 32.0. The digest name list is mandatory above protocol 31 (clientserver.c:229-241), so every probe was answered@ERROR: your client omitted the digest name listand never reached the feature under test. Five more sites jumped straight to#listunder a comment claiming "no version handshake needed" — buthandle_daemon_connection()runsexchange_protocols()atclientserver.c:1534and only reads the command line at:1538. A sharedsend_client_greeting()now attaches the list above protocol 31 and omits it at or below, which is the legacy path the protocol-29/30 cases exercise.2 — The listing shape. Six tests expected a
CAPline and anOKline before the module rows.send_listing()(clientserver.c:1374-1386) writes one"%-15s\t%s\n"row per module and then@RSYNCD: EXIT— no capability line, no OK. Those reads consumed the real rows. In two tests the follow-on loop then spun on end-of-file instead of terminating, so a wrong expectation presented as a hang rather than a failure;read_linereturning 0 is now treated as EOF.3 — Assertions that could not fire even once executing. These are the ones that would have gone on proving nothing after a bare
--no-detachfix:server_lists_modules_with_commentsif line.contains('\t')server_enforces_max_connectionsif line.contains("OK")server_handles_invalid_greeting_responseif result.is_ok() && !line.is_empty()@ERROR:or@RSYNCD:disjunction accepts every line the daemon can writeAll three are now unconditional and pinned to the exact upstream payload.
4 — Expectations upstream does not have.
@RSYNCD: EXIThas exactly one producer upstream —send_listing()atclientserver.c:1385. The unknown-module arm at:1567-1572writes the error and returns -1, dropping the connection.server_sends_exit_after_erroris therefore renamedserver_closes_connection_after_errorand asserts a zero-length read, which is the discriminating check: a daemon that kept the session open would block there.auth_flow_protocol_29_md4_succeedscomputed plain MD4. A client advertising no list lands on themd4fallback withmd4_is_old = 1, andnegotiate_daemon_auth()rewrites the negotiated item toCSUM_MD4_OLD(compat.c:888-891), whichsum_init()seeds with four zero bytes. oc implements this correctly; the test encoded the wrong digest.The auth cases never negotiated anything
Worth separating out.
perform_auth_handshaketook adigestargument, used it for the client's own response arithmetic, and advertised no list — so the daemon stayed on theprotocol_version >= 30 ? "md5" : "md4"fallback (compat.c:868-871). The digest parameter never reached the daemon's choice.auth_flow_protocol_32_sha512_succeedspassed while negotiating md5. The handshake now advertises the digest under test above protocol 31.Mutation proofs — three classes, three distinct reddenings
Dropping the listing comment in
module_access/listing.rs— reddens only the test that previously asserted nothing:Altering the max-connections payload:
Ignoring the client's advertised digest list in
negotiate_server_daemon_digest:The md5 case stays green under that mutation — because md5 is the fallback. That is precisely why the old fixture, advertising nothing, could never have detected it.
Unmutated:
25 tests run: 25 passed, 0 skippedin 0.624s.Ceiling
ROOT_DETACHING_CEILINGgoes 2 → 1. The value 1 assumes #7588 has landed (it is this PR's base). The single remaining file istests/integration_daemon_max_connections_cap.rs, which #7578 fixes; whoever merges that should take the ceiling to 0 and can then delete the check's ceiling entirely.Residuals — captured, not fixed
tests/integration_daemon_filter_directives.rs(in test(daemon): run the module filter-directive tests un-detached #7588) has a module header claiminginclude fromcoverage that no test exercises.become_daemon()at 3.4.4 line numbers:server_runtime/accept_loop.rssaysclientserver.c:1568-1571andsections/daemonize.rssaysclientserver.c:1513. In the 3.5.0 pin the call site isclientserver.c:1758-1761and the definition is:1691.module_access/listing.rslikewise citesclientserver.c:1246-1272forsend_listing(), which is:1374-1386. Out of scope here; the citation gate passes because those lines exist, and only the drift audit would notice.Gates
cargo fmt --all -- --checkcleancargo clippy --workspace --all-targets --all-features --no-deps -- -D warningscleanbash tools/ci/check_daemon_no_detach.sh— no violations, 1 root test remaining against a ceiling of 1cargo xtask citations— exit 0, 8663 citations resolve against the rsync 3.5.0 pincargo nextest run -p bin --all-featuresover both daemon binaries: 28 tests, 28 passed