Skip to content

test(rsync_io): SSH stderr socketpair error propagation (#2375) - #4384

Merged
oferchen merged 1 commit into
masterfrom
test/sse-stderr-socketpair-propagation
May 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
test/sse-stderr-socketpair-propagation

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds crates/rsync_io/tests/ssh_stderr_socketpair_propagation.rs (SSE-6, feat: wire --dparam values to daemon config override #2375): three integration tests that drive the SSE-3 make_stderr_socketpair primitive end-to-end and assert error-message propagation from a spawned subprocess back through the parent end of the socketpair.
  • Each captured line additionally fires a tracing::warn! event so the test exercises the observable contract the SSE-4 async drain (PR feat(rsync_io): async stderr drain task for SSH socketpair (#2373) #4363) is staging - the production drain shape is mirrored line-by-line.
  • Wires tracing and tracing-subscriber into rsync_io dev-dependencies and installs a custom Layer that records WARN events, with thread-local dispatch propagated to the spawned drain thread via tracing::dispatcher::with_default.

Scenarios

  • single_error_line_propagates_through_socketpair: /bin/sh -c 'echo "test error message" >&2'; parent end yields exactly test error message\n and one WARN event carrying that payload.
  • multi_error_lines_propagate_and_fire_one_warn_each: three sequential echo calls; all three lines surface in order and one WARN event fires per line.
  • drain_returns_after_child_exit_closes_child_end: confirms the drain observes EOF cleanly after the subprocess exits (guards the "drain task survives past child reap" risk called out in the design doc).

Gated cfg(all(unix, feature = "ssh-socketpair-stderr")) so the file no-ops on Windows and on default builds, matching the staging plan in docs/design/socketpair-stderr-channel.md.

Test plan

  • cargo nextest run -p rsync_io --features ssh-socketpair-stderr --test ssh_stderr_socketpair_propagation -> 3 passed
  • cargo clippy -p rsync_io --tests --features ssh-socketpair-stderr --no-deps -- -D warnings -> clean
  • cargo fmt --all -- --check -> clean

@github-actions github-actions Bot added the test label May 18, 2026
@oferchen
oferchen force-pushed the test/sse-stderr-socketpair-propagation branch from 0a8d6ea to f245d78 Compare May 18, 2026 00:12
SSE-6 from docs/design/socketpair-stderr-channel.md. Drives the SSE-3
`make_stderr_socketpair` primitive end-to-end by wiring the child end
into a real subprocess as fd 2 and asserting the parent end surfaces
the bytes verbatim. Each captured line additionally fires a
`tracing::warn!` event, mirroring the production drain shape staged
in SSE-4 (#4363) so this test continues to exercise the observable
contract once the async path lands.

Scenarios:
- single_error_line_propagates_through_socketpair: one echo writes
  `test error message\n`; parent buffer matches byte-for-byte and a
  single WARN event fires with the captured payload.
- multi_error_lines_propagate_and_fire_one_warn_each: three separate
  echo calls produce three ordered lines; all three are captured in
  order and one WARN event fires per line.
- drain_returns_after_child_exit_closes_child_end: confirms the drain
  observes EOF cleanly when the subprocess exits and the child end
  closes, guarding the failure mode the design doc calls out under
  "Tokio drain task survives past child reap".

Gated `cfg(all(unix, feature = "ssh-socketpair-stderr"))` so the file
no-ops on Windows and on default builds. Adds `tracing` and
`tracing-subscriber` as dev-dependencies of `rsync_io`; a custom
`Layer` records WARN events with thread-local dispatch propagated to
the spawned drain thread.
@oferchen
oferchen force-pushed the test/sse-stderr-socketpair-propagation branch from f245d78 to af84709 Compare May 18, 2026 00:57
@oferchen
oferchen merged commit d2f50ba into master May 18, 2026
5 of 16 checks passed
oferchen added a commit that referenced this pull request May 18, 2026
SSE-6 from docs/design/socketpair-stderr-channel.md. Drives the SSE-3
`make_stderr_socketpair` primitive end-to-end by wiring the child end
into a real subprocess as fd 2 and asserting the parent end surfaces
the bytes verbatim. Each captured line additionally fires a
`tracing::warn!` event, mirroring the production drain shape staged
in SSE-4 (#4363) so this test continues to exercise the observable
contract once the async path lands.

Scenarios:
- single_error_line_propagates_through_socketpair: one echo writes
  `test error message\n`; parent buffer matches byte-for-byte and a
  single WARN event fires with the captured payload.
- multi_error_lines_propagate_and_fire_one_warn_each: three separate
  echo calls produce three ordered lines; all three are captured in
  order and one WARN event fires per line.
- drain_returns_after_child_exit_closes_child_end: confirms the drain
  observes EOF cleanly when the subprocess exits and the child end
  closes, guarding the failure mode the design doc calls out under
  "Tokio drain task survives past child reap".

Gated `cfg(all(unix, feature = "ssh-socketpair-stderr"))` so the file
no-ops on Windows and on default builds. Adds `tracing` and
`tracing-subscriber` as dev-dependencies of `rsync_io`; a custom
`Layer` records WARN events with thread-local dispatch propagated to
the spawned drain thread.
oferchen added a commit that referenced this pull request May 18, 2026
SSE-6 from docs/design/socketpair-stderr-channel.md. Drives the SSE-3
`make_stderr_socketpair` primitive end-to-end by wiring the child end
into a real subprocess as fd 2 and asserting the parent end surfaces
the bytes verbatim. Each captured line additionally fires a
`tracing::warn!` event, mirroring the production drain shape staged
in SSE-4 (#4363) so this test continues to exercise the observable
contract once the async path lands.

Scenarios:
- single_error_line_propagates_through_socketpair: one echo writes
  `test error message\n`; parent buffer matches byte-for-byte and a
  single WARN event fires with the captured payload.
- multi_error_lines_propagate_and_fire_one_warn_each: three separate
  echo calls produce three ordered lines; all three are captured in
  order and one WARN event fires per line.
- drain_returns_after_child_exit_closes_child_end: confirms the drain
  observes EOF cleanly when the subprocess exits and the child end
  closes, guarding the failure mode the design doc calls out under
  "Tokio drain task survives past child reap".

Gated `cfg(all(unix, feature = "ssh-socketpair-stderr"))` so the file
no-ops on Windows and on default builds. Adds `tracing` and
`tracing-subscriber` as dev-dependencies of `rsync_io`; a custom
`Layer` records WARN events with thread-local dispatch propagated to
the spawned drain thread.
@oferchen
oferchen deleted the test/sse-stderr-socketpair-propagation branch May 19, 2026 15:13
oferchen added a commit that referenced this pull request Aug 24, 2026
SSE-6 from docs/design/socketpair-stderr-channel.md. Drives the SSE-3
`make_stderr_socketpair` primitive end-to-end by wiring the child end
into a real subprocess as fd 2 and asserting the parent end surfaces
the bytes verbatim. Each captured line additionally fires a
`tracing::warn!` event, mirroring the production drain shape staged
in SSE-4 (#4363) so this test continues to exercise the observable
contract once the async path lands.

Scenarios:
- single_error_line_propagates_through_socketpair: one echo writes
  `test error message\n`; parent buffer matches byte-for-byte and a
  single WARN event fires with the captured payload.
- multi_error_lines_propagate_and_fire_one_warn_each: three separate
  echo calls produce three ordered lines; all three are captured in
  order and one WARN event fires per line.
- drain_returns_after_child_exit_closes_child_end: confirms the drain
  observes EOF cleanly when the subprocess exits and the child end
  closes, guarding the failure mode the design doc calls out under
  "Tokio drain task survives past child reap".

Gated `cfg(all(unix, feature = "ssh-socketpair-stderr"))` so the file
no-ops on Windows and on default builds. Adds `tracing` and
`tracing-subscriber` as dev-dependencies of `rsync_io`; a custom
`Layer` records WARN events with thread-local dispatch propagated to
the spawned drain thread.
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