Skip to content

feat: add TokenReader for plain/compressed delta token dispatch - #2373

Merged
oferchen merged 1 commit into
masterfrom
feat/token-reader
Feb 21, 2026
Merged

oferchen merged 1 commit into
masterfrom
feat/token-reader

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Implement Strategy pattern for reading delta tokens in both plain (4-byte LE i32) and compressed (DEFLATED_DATA) wire formats
  • Mirrors upstream recv_token() dispatch from token.c:271
  • Includes 13 unit tests covering roundtrips, block references, EOF, and edge cases

Test plan

  • Unit tests in module pass
  • cargo fmt passes

@github-actions github-actions Bot added the enhancement New feature or request label Feb 21, 2026
@oferchen
oferchen merged commit 77197f8 into master Feb 21, 2026
5 of 9 checks passed
@oferchen
oferchen deleted the feat/token-reader branch February 21, 2026 08:09
oferchen added a commit that referenced this pull request May 18, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request May 18, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request May 18, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request May 18, 2026
Implements SSE-4 from docs/design/socketpair-stderr-channel.md: when both
async-ssh and ssh-socketpair-stderr features are enabled, AsyncSshTransport
installs a socketpair-backed stderr channel and drains it via a tokio task
into a bounded 8 KiB RingBuffer, emitting tracing::warn! per line.

- New module async_stderr_drain.rs gated on both features
  - RingBuffer<const N: usize> with sliding-window semantics
  - AsyncStderrDrain::spawn(reader) wires a tokio::spawn drain loop
  - stderr_capture() snapshot accessor; join() awaits clean EOF
  - Drop aborts the task safely (it only owns reader + Arc buffer clone)
- Wire into AsyncSshTransport::execute_remote_rsync: replace Stdio::inherit
  with configure_stderr_channel when both features are enabled on Unix; fall
  back to inherit on FD exhaustion per the design doc
- AsyncSshTransport::stderr_capture() returns the bounded snapshot
- Unit tests (Unix-only): 1 KiB write/snapshot equality, multi-line
  capture, clean EOF after sender drop, capture cap enforcement, ring
  buffer math

# Conflicts:
#	crates/rsync_io/Cargo.toml
oferchen added a commit that referenced this pull request May 18, 2026
…4363)

Implements SSE-4 from docs/design/socketpair-stderr-channel.md: when both
async-ssh and ssh-socketpair-stderr features are enabled, AsyncSshTransport
installs a socketpair-backed stderr channel and drains it via a tokio task
into a bounded 8 KiB RingBuffer, emitting tracing::warn! per line.

- New module async_stderr_drain.rs gated on both features
  - RingBuffer<const N: usize> with sliding-window semantics
  - AsyncStderrDrain::spawn(reader) wires a tokio::spawn drain loop
  - stderr_capture() snapshot accessor; join() awaits clean EOF
  - Drop aborts the task safely (it only owns reader + Arc buffer clone)
- Wire into AsyncSshTransport::execute_remote_rsync: replace Stdio::inherit
  with configure_stderr_channel when both features are enabled on Unix; fall
  back to inherit on FD exhaustion per the design doc
- AsyncSshTransport::stderr_capture() returns the bounded snapshot
- Unit tests (Unix-only): 1 KiB write/snapshot equality, multi-line
  capture, clean EOF after sender drop, capture cap enforcement, ring
  buffer math

# Conflicts:
#	crates/rsync_io/Cargo.toml
oferchen added a commit that referenced this pull request May 18, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request May 18, 2026
…4363)

Implements SSE-4 from docs/design/socketpair-stderr-channel.md: when both
async-ssh and ssh-socketpair-stderr features are enabled, AsyncSshTransport
installs a socketpair-backed stderr channel and drains it via a tokio task
into a bounded 8 KiB RingBuffer, emitting tracing::warn! per line.

- New module async_stderr_drain.rs gated on both features
  - RingBuffer<const N: usize> with sliding-window semantics
  - AsyncStderrDrain::spawn(reader) wires a tokio::spawn drain loop
  - stderr_capture() snapshot accessor; join() awaits clean EOF
  - Drop aborts the task safely (it only owns reader + Arc buffer clone)
- Wire into AsyncSshTransport::execute_remote_rsync: replace Stdio::inherit
  with configure_stderr_channel when both features are enabled on Unix; fall
  back to inherit on FD exhaustion per the design doc
- AsyncSshTransport::stderr_capture() returns the bounded snapshot
- Unit tests (Unix-only): 1 KiB write/snapshot equality, multi-line
  capture, clean EOF after sender drop, capture cap enforcement, ring
  buffer math

# Conflicts:
#	crates/rsync_io/Cargo.toml
oferchen added a commit that referenced this pull request May 18, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request May 18, 2026
…4363)

Implements SSE-4 from docs/design/socketpair-stderr-channel.md: when both
async-ssh and ssh-socketpair-stderr features are enabled, AsyncSshTransport
installs a socketpair-backed stderr channel and drains it via a tokio task
into a bounded 8 KiB RingBuffer, emitting tracing::warn! per line.

- New module async_stderr_drain.rs gated on both features
  - RingBuffer<const N: usize> with sliding-window semantics
  - AsyncStderrDrain::spawn(reader) wires a tokio::spawn drain loop
  - stderr_capture() snapshot accessor; join() awaits clean EOF
  - Drop aborts the task safely (it only owns reader + Arc buffer clone)
- Wire into AsyncSshTransport::execute_remote_rsync: replace Stdio::inherit
  with configure_stderr_channel when both features are enabled on Unix; fall
  back to inherit on FD exhaustion per the design doc
- AsyncSshTransport::stderr_capture() returns the bounded snapshot
- Unit tests (Unix-only): 1 KiB write/snapshot equality, multi-line
  capture, clean EOF after sender drop, capture cap enforcement, ring
  buffer math

# Conflicts:
#	crates/rsync_io/Cargo.toml
oferchen added a commit that referenced this pull request Aug 24, 2026
SSE-7: cover the contract that the socketpair-backed stderr drain
landed in SSE-3 (#2372) and SSE-4 (#2373) surfaces both the child's
non-zero ExitStatus and the captured stderr bytes intact. Gated on
unix + the ssh-socketpair-stderr feature so the parity test only runs
on the path the feature wires up. Verifies both the SshConnection
wait_with_stderr and the SshChildHandle wait_with_stderr code paths.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4363)

Implements SSE-4 from docs/design/socketpair-stderr-channel.md: when both
async-ssh and ssh-socketpair-stderr features are enabled, AsyncSshTransport
installs a socketpair-backed stderr channel and drains it via a tokio task
into a bounded 8 KiB RingBuffer, emitting tracing::warn! per line.

- New module async_stderr_drain.rs gated on both features
  - RingBuffer<const N: usize> with sliding-window semantics
  - AsyncStderrDrain::spawn(reader) wires a tokio::spawn drain loop
  - stderr_capture() snapshot accessor; join() awaits clean EOF
  - Drop aborts the task safely (it only owns reader + Arc buffer clone)
- Wire into AsyncSshTransport::execute_remote_rsync: replace Stdio::inherit
  with configure_stderr_channel when both features are enabled on Unix; fall
  back to inherit on FD exhaustion per the design doc
- AsyncSshTransport::stderr_capture() returns the bounded snapshot
- Unit tests (Unix-only): 1 KiB write/snapshot equality, multi-line
  capture, clean EOF after sender drop, capture cap enforcement, ring
  buffer math

# Conflicts:
#	crates/rsync_io/Cargo.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant