Skip to content

Adapt OpenURI progress and content length callbacks to SCP - #91

Open
OskarEichler wants to merge 1 commit into
net-ssh:masterfrom
OskarEichler:codex/uri-progress-callback
Open

Adapt OpenURI progress and content length callbacks to SCP#91
OskarEichler wants to merge 1 commit into
net-ssh:masterfrom
OskarEichler:codex/uri-progress-callback

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Adapt SCP's four-argument progress callback to OpenURI's one-argument byte count, and invoke content_length_proc once even for empty files.

Reproduction and evidence

The adapter previously forwarded a strict OpenURI ->(bytes) { ... } directly to SCP. SCP calls it with channel, filename, received and total, raising ArgumentError: wrong number of arguments (given 4, expected 1). The focused reproduction now passes. Combined models verify empty, one-byte, binary and 20,000-byte transfers, first/final progress and exactly one content-length callback. The extra empty-file progress event does not duplicate content length.

Compatibility / breaking changes

Intentional callback correction: callers that relied on the undocumented four-argument SCP signature through OpenURI must instead use OpenURI's byte-count signature or the direct SCP API. content_length_proc, previously ignored, is now honored. Direct Net::SCP progress callbacks are unchanged.

Verification and limits

  • This focused branch passes the existing upstream suite: 36 tests / 70 assertions, Ruby 4.0.6, net-ssh 7.3.3, test-unit 3.7.8 and Mocha 2.1.0; all Ruby commands used rbenv.
  • The combined release-based consumer candidate passes the suite with frozen string literals enabled, 10 focused cases, 2,906 model assertions, 24 URI-component assertions and 19 local scp/URI assertions. Combined evidence includes other separately proposed fixes and existing upstream frozen-string corrections; it is not attributed to this patch alone.
  • No repository tests added/modified under the consuming project's explicit no-new-tests policy. Reproductions/models ran externally. No deployed servers, SSH connections or production data were used.
  • All seven runtime files parse with the Ruby 2.6 parser; actual older-Ruby/Windows/remote-server matrices were not run locally. No upstream lint config exists; targeted lint has the same eight pre-existing warnings, with no new warnings.
  • Existing upstream PRs/issues and contribution guidance were checked. Maintainer CI results are pending; no CI pass is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant