Repository navigation
Conversation
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 a commit
that referenced
this pull request
Aug 24, 2026
…off-timeout test(receiver): EDG-GOODBYE.4 partial-cutoff + hung-sender goodbye tests
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
Locks the receiver-side half of the EDG-GOODBYE contract introduced by #5600. EDG-GOODBYE.1/.2/.3 in
crates/protocol/tests/goodbye_contract.rspin the wire shape the sender must emit; this PR adds EDG-GOODBYE.4, which pins what the receiver must do when the sender misbehaves.crates/transfer/src/receiver/tests/errors_and_timeouts/goodbye_partial_cutoff.rscovering 8 scenarios.docs/audits/edg-goodbye-contract.md(introduced by test(protocol): lock daemon-sender goodbye NDX_DONE contract #5600) with a newTimeout + partial-cutoff (EDG-GOODBYE.4)section.Stacked on top of #5600 - merge that one first.
Scenarios (each asserts the receiver returns a typed
io::Error, never panics):UnexpectedEoffromread_expected_ndx_doneon proto 29).0xFFprefix on proto 32handle_goodbye(UnexpectedEof).UnexpectedEof).InvalidDatawith the expected NDX_DONE message preserved).read_expected_ndx_doneon proto 29 (InvalidDatawith the context string preserved).mpsc::recv_timeout(2s); guards against a receiver that silently declares success on zero input. AcceptsTimedOutorUnexpectedEofif a future change adds an internal deadline (does not lock implementation choice).NDX_DEL_STATSvarint payload (UnexpectedEoffromDeleteStats::read_from).NDX_DONEstill drives the handshake cleanly.Protocol-coverage rationale
handle_goodbyeonly reads on proto >= 31; on proto 28/29 the read-side counterpart isread_expected_ndx_donecalled byexchange_phase_done. The legacy-codec EOF and garbage tests therefore targetread_expected_ndx_donedirectly; the modern-codec tests targethandle_goodbyedirectly. Audit doc explains this.Upstream reference
main.c:893-924 read_final_goodbye()- exits withRERR_PROTOCOLon a non-NDX_DONE final read, and propagates I/O errors fromread_int/read_ndx_and_attrson short reads. Our equivalents areio::ErrorKind::InvalidDataandio::ErrorKind::UnexpectedEof.Test plan
crate::transfer::receiver::tests::errors_and_timeouts::goodbye_partial_cutoff::*.Cursor/ a parked thread; no platform-specific paths.mpsc::recv_timeout) so a regression that silently succeeds fails fast.handle_goodbye_proto32_accepts_well_formed_ndx_donestill passes (happy-path sanity).