fix: preserve SFTP targets after stat failures - #147
Draft
robjarawan wants to merge 2 commits into
Draft
Conversation
Owner
Author
|
I ran the fork CI and checked the failures instead of treating the red matrix as an SFTP regression.
Neither completed product-level failure reports a remote |
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.
Closes #59.
I changed
Sftp.put()so it creates a multipart destination only when the remotestat()reports that the file does not exist. An I/O error, permission error or timeout now reachesSender.send()as a failed attempt without opening the destination.I reproduced the original corruption through
Sender.send()and real Paramiko SFTP traffic over a local socket pair. The destination starts asAAAABBBBCCCC, and the sender tries to replace bytes 4–7 withxxxx. On the baseline, each metadata failure opens the existing file withwb, changes it to four zero bytes plusxxxx, and returns success. With this change the original bytes remain untouched, the attempt returns failure, and a second send succeeds after the temporary error clears.84f3f2377f810224c46 failedwith target corruption4 passed4 passed6 failed, 4 passed10 passed14 passed352 passed, 1 skippedThe regression starts an in-process Paramiko SFTP server over
socket.socketpair(). It exposes no port and uses only temporary files and synthetic fixture authentication. The timeout case delays the firstSTATreply while the parsed sender config hastimeout 1. The test verifies complete destination bytes, the file-open calls, the sender result and the retry after recovery.This is stacked on #138 because that PR fixes the separate healthy middle-block truncation and gives this regression a correct success control. The runtime change here is one focused commit,
f810224c4. I also carried the fork-only CI commit from #140 so opening this draft does not run the live-feeddynamic_flowjobs. Once #138 and #140 are resolved, this can be rebased or retargeted todevelopmentwithout changing the SFTP fix.The old upstream proposal MetPX#1739 closed without merging because it lacked a running caller/protocol reproduction. This PR stays in my fork and remains draft pending the applicable flow matrix and independent review.