docs(transfer): document detecting upload interruptions#641
Merged
Conversation
…tection Clarify, in the godoc and README, that the FileTransferError interface is the supported way to detect an interrupted upload (issue #635): TransferError fires before Close on ABOR, a dropped data/control connection, or an I/O error, while a graceful mid-upload close is indistinguishable from completion due to the lack of a STOR length header. Add TestFileTransferErrorNotification covering clean upload, write failure, ABOR mid-upload, and a dropped connection mid-upload (the #635 scenario). The test driver now tracks the files it hands out and guards errTransfer with a mutex so the connection-drop case can be polled race-free. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
golangci-lint v2.12.2 (CI) flags the new raw.SendCommand(getABORCmd()) line as a non-constant printf format string; pass the command as an argument instead. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #641 +/- ##
=======================================
Coverage 87.22% 87.22%
=======================================
Files 13 13
Lines 2090 2090
=======================================
Hits 1823 1823
Misses 180 180
Partials 87 87 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Clarifies and tests how drivers detect an interrupted upload via the existing
FileTransferErrorinterface, in response to #635.FileTransferErrorgodoc and in the README thatTransferErrorfires beforeCloseon ABOR, a dropped data/control connection, or an I/O error — and that a graceful mid-upload close is indistinguishable from completion (FTP has noSTORlength header), so onlyCloseruns in that case.TestFileTransferErrorNotificationcovering: clean upload (noTransferError), write failure, ABOR mid-upload, and a dropped connection mid-upload (the Is it possible to detect an upload interruption event? #635 scenario).errTransferis mutex-guarded so the connection-drop case can be polled race-free.No production behaviour change — the interface already worked; this documents the contract and locks it in with tests.
Test plan
go test -race -count=1 .passes (full suite)TestFileTransferErrorNotificationpasses under-race(clean / write-error / ABOR / dropped-connection)golangci-lint runintroduces no new findings vs. baseRefs #635
🤖 Generated with Claude Code