Skip to content

test(protocol): lock daemon-sender goodbye NDX_DONE contract - #5600

Merged
oferchen merged 4 commits into
masterfrom
test/edg-goodbye-contract
Jun 11, 2026
Merged

oferchen merged 4 commits into
masterfrom
test/edg-goodbye-contract

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • EDG-GOODBYE.1 wire-byte golden tests for the canonical daemon-sender goodbye emissions on protocol 28-32 (plain push, push + --delete, push + -z, proto-30 gate, proto-29 legacy 4-byte form). Goldens are built in-process via the same codec primitives the production GeneratorContext::handle_goodbye uses, so the test is deterministic and self-contained -- no external .bin fixtures.
  • EDG-GOODBYE.2 100-iteration stress test that rotates through five scenarios and emits/parses each goodbye stream through an in-process buffer. Asserts zero drops of the final NDX_DONE sentinel across all iterations -- gives ~1% sensitivity to flakes that would surface as the UTS-9.REOPEN / UTS-15.c failure mode. Full-daemon stress is intentionally out of scope here; this loop pins the codec invariant those tasks build on.
  • EDG-GOODBYE.3 proptest coverage for arbitrary (protocol in 28..=32, send_del_stats, DeleteStats) combinations. The headline contract is that the last protocol-frame must always be NDX_DONE with no trailing bytes; additional cases pin that NDX_DEL_STATS is always followed by exactly five varints + NDX_DONE, and that protocol < 31 never emits NDX_DEL_STATS regardless of the request flag.
  • Contract doc at docs/audits/edg-goodbye-contract.md describing the wire contract, the failure modes the test set guards against, and the upstream main.c / generator.c / rsync.c / io.c line references each clause maps to. UTS-9.REOPEN and UTS-15.c can land regressions against this machine-checked invariant.

Test plan

  • cargo nextest run -p protocol --all-features -E 'test(goodbye_contract::)' -- new contract tests pass.
  • Existing goodbye_handshake.rs tests continue to pass (covers raw write_goodbye/read_goodbye codec; no overlap with the contract tests in this PR).
  • cargo nextest run -p protocol --all-features full crate suite green -- catches any regression from the new file.
  • CI fmt + clippy clean.

oferchen added 2 commits June 10, 2026 20:46
Locks in the daemon-sender goodbye-phase wire contract via three
complementary tests in crates/protocol/tests/goodbye_contract.rs:

- EDG-GOODBYE.1: golden bytes for plain push, push + --delete, and the
  compression-is-orthogonal invariant on protocol 28-32. Goldens are
  built in-process via the same codec primitives the production
  generator uses, so the test is deterministic and self-contained.
- EDG-GOODBYE.2: 100-iteration stress loop that rotates through five
  scenarios and asserts zero drops of the final NDX_DONE sentinel
  through an emit/parse round-trip. Mirrors UTS-9.REOPEN / UTS-15.c
  failure mode at codec scope (full-daemon stress is left to those
  tasks).
- EDG-GOODBYE.3: proptest covering (protocol in 28..=32, delete-flag,
  arbitrary DeleteStats) - last protocol-frame must always be NDX_DONE
  with no trailing bytes; NDX_DEL_STATS is always followed by exactly
  five varints + NDX_DONE; protocol < 31 never emits NDX_DEL_STATS.

Adds docs/audits/edg-goodbye-contract.md describing the wire contract
and pointing UTS-9.REOPEN and UTS-15.c at the machine-checked invariant
they can rely on.
Locks the receiver-side half of the EDG-GOODBYE contract. While
EDG-GOODBYE.1/.2/.3 in crates/protocol/tests/goodbye_contract.rs pin
the wire shape the sender must emit, EDG-GOODBYE.4 pins what the
receiver must do when the sender misbehaves.

Eight scenarios are covered by tests in
crates/transfer/src/receiver/tests/errors_and_timeouts/goodbye_partial_cutoff.rs,
each asserting the receiver returns a typed io::Error rather than
panic:

- EOF mid-byte inside the legacy 4-byte NDX_DONE (UnexpectedEof from
  read_expected_ndx_done on proto 29).
- EOF after a modern 0xFF prefix on proto 32 handle_goodbye
  (UnexpectedEof).
- Immediate EOF before any goodbye byte on both proto 29 and 32
  (UnexpectedEof).
- Well-framed positive NDX (5) in place of NDX_DONE on proto 32
  (InvalidData with the expected NDX_DONE message preserved).
- Legacy garbage rejection via read_expected_ndx_done on proto 29
  (InvalidData with the context string preserved).
- Hung sender that never produces bytes - bounded with
  mpsc::recv_timeout(2s); guards against a receiver that silently
  declares success on zero input, and accepts TimedOut or
  UnexpectedEof if a future change adds an internal deadline.
- EOF inside the NDX_DEL_STATS varint payload (UnexpectedEof from
  DeleteStats::read_from).
- Happy-path sanity check that well-formed NDX_DONE still drives the
  handshake cleanly.

Protocol-coverage note: handle_goodbye only reads on proto >= 31; on
proto 28/29 the read-side counterpart is read_expected_ndx_done
called by exchange_phase_done. The legacy-codec EOF / garbage tests
therefore target read_expected_ndx_done directly; the modern-codec
tests target handle_goodbye directly.

Updates docs/audits/edg-goodbye-contract.md with a new
"Timeout + partial-cutoff (EDG-GOODBYE.4)" section that enumerates
the covered cases and the regressions they guard against.

Upstream reference: main.c:893-924 read_final_goodbye() - exits
with RERR_PROTOCOL on a non-NDX_DONE final read and propagates I/O
errors from read_int / read_ndx_and_attrs on short reads.
oferchen added 2 commits June 11, 2026 03:42
…off-timeout

test(receiver): EDG-GOODBYE.4 partial-cutoff + hung-sender goodbye tests
@oferchen
oferchen merged commit 2cf6036 into master Jun 11, 2026
16 of 17 checks passed
@oferchen
oferchen deleted the test/edg-goodbye-contract branch June 11, 2026 03:10
oferchen added a commit that referenced this pull request Jun 19, 2026
UTS-NEXTEST-EDGE.e: native nextest port of upstream's
testsuite/daemon-gzip-download.test and daemon-gzip-upload.test, which
exercise the -zz (zlibx) per-block codec over a daemon transfer in both
directions. Asserts byte-identical round-trip, intact goodbye envelope
(no UTS-9 'connection unexpectedly closed' signature past the ~615KB
cutoff), and codec-engaged evidence via --stats. Adds a -z vs -zz
negotiation pin so silent codec collapse trips a regression.

Companion to PRs #5520, #5600, #5619 and the UTS-V3 cluster A drain;
the upstream tests run under continue-on-error in CI, so this nextest
port runs as a required check on every PR.
oferchen added a commit that referenced this pull request Jun 19, 2026
* test(uts): port daemon-gzip download/upload -zz to nextest

UTS-NEXTEST-EDGE.e: native nextest port of upstream's
testsuite/daemon-gzip-download.test and daemon-gzip-upload.test, which
exercise the -zz (zlibx) per-block codec over a daemon transfer in both
directions. Asserts byte-identical round-trip, intact goodbye envelope
(no UTS-9 'connection unexpectedly closed' signature past the ~615KB
cutoff), and codec-engaged evidence via --stats. Adds a -z vs -zz
negotiation pin so silent codec collapse trips a regression.

Companion to PRs #5520, #5600, #5619 and the UTS-V3 cluster A drain;
the upstream tests run under continue-on-error in CI, so this nextest
port runs as a required check on every PR.

* test: fix doc-lazy-continuation lint in daemon-gzip-zz module doc

Reword 'capability advertise + compress' to 'capability advertise and compress'
so clippy doesn't parse the wrapped '+' as a markdown list marker.
oferchen added a commit that referenced this pull request Jun 19, 2026
Adds the cross-binary upstream-compat harness primitives specified by
NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`,
`upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test`
goodbye-flush invariant into nextest.

The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon
over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the
UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender
goodbye envelope reaches the upstream client without a premature
connection drop - the regression family fixed by PRs #5520 / #5600 /
#5619 / #5725.

Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var
unset (default for PR cells), upstream rsync 3.4.4 binary not present
at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync
binary cannot be located. Wall-time impact on the standard PR cell is
a single early-return.

NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up
step that flips the env var on. That cell does not exist yet; this PR
ships the test and harness only, and a follow-up will add the matrix
entry to the existing nextest workflow.

Refs: docs/design/nxt-1-nextest-harness.md
oferchen added a commit that referenced this pull request Jun 19, 2026
…6002)

Adds the cross-binary upstream-compat harness primitives specified by
NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`,
`upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test`
goodbye-flush invariant into nextest.

The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon
over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the
UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender
goodbye envelope reaches the upstream client without a premature
connection drop - the regression family fixed by PRs #5520 / #5600 /
#5619 / #5725.

Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var
unset (default for PR cells), upstream rsync 3.4.4 binary not present
at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync
binary cannot be located. Wall-time impact on the standard PR cell is
a single early-return.

NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up
step that flips the env var on. That cell does not exist yet; this PR
ships the test and harness only, and a follow-up will add the matrix
entry to the existing nextest workflow.

Refs: docs/design/nxt-1-nextest-harness.md
oferchen added a commit that referenced this pull request Aug 24, 2026
test(protocol): lock daemon-sender goodbye NDX_DONE contract
oferchen added a commit that referenced this pull request Aug 24, 2026
* test(uts): port daemon-gzip download/upload -zz to nextest

UTS-NEXTEST-EDGE.e: native nextest port of upstream's
testsuite/daemon-gzip-download.test and daemon-gzip-upload.test, which
exercise the -zz (zlibx) per-block codec over a daemon transfer in both
directions. Asserts byte-identical round-trip, intact goodbye envelope
(no UTS-9 'connection unexpectedly closed' signature past the ~615KB
cutoff), and codec-engaged evidence via --stats. Adds a -z vs -zz
negotiation pin so silent codec collapse trips a regression.

Companion to PRs #5520, #5600, #5619 and the UTS-V3 cluster A drain;
the upstream tests run under continue-on-error in CI, so this nextest
port runs as a required check on every PR.

* test: fix doc-lazy-continuation lint in daemon-gzip-zz module doc

Reword 'capability advertise + compress' to 'capability advertise and compress'
so clippy doesn't parse the wrapped '+' as a markdown list marker.
oferchen added a commit that referenced this pull request Aug 24, 2026
…6002)

Adds the cross-binary upstream-compat harness primitives specified by
NXT-1 (`UpstreamVersion`, `locate_upstream_rsync`, `require_upstream_rsync`,
`upstream_compat_enabled`) and ports the upstream `daemon-gzip-download.test`
goodbye-flush invariant into nextest.

The test pairs an upstream rsync 3.4.4 client against an oc-rsync daemon
over TCP and pulls a ~1 MB `-zz`-compressed fixture sized to clear the
UTS-9 ~615 KB cutoff. The invariant pinned is that the daemon-sender
goodbye envelope reaches the upstream client without a premature
connection drop - the regression family fixed by PRs #5520 / #5600 /
#5619 / #5725.

Self-skips on three conditions: `OC_RSYNC_UPSTREAM_COMPAT` env var
unset (default for PR cells), upstream rsync 3.4.4 binary not present
at `target/interop/upstream-install/3.4.4/bin/rsync`, or the oc-rsync
binary cannot be located. Wall-time impact on the standard PR cell is
a single early-return.

NXT-1 calls out that the new `upstream-compat` CI cell is the wire-up
step that flips the env var on. That cell does not exist yet; this PR
ships the test and harness only, and a follow-up will add the matrix
entry to the existing nextest workflow.

Refs: docs/design/nxt-1-nextest-harness.md
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