Repository navigation
fix: retry chunk uploads when the error response has a JSON body - #75
Conversation
getResponseErrorFromDioRespose did not handle a response body that Dio had already decoded from JSON, and threw while reading it. Because the throw was an Error rather than an Exception, the chunk retry did not run and the upload stopped after its first chunk attempt. - read the error from a Map, List, String or empty body without throwing - tests for each body shape, and for a chunk upload that retries after a JSON error response - version 4.0.3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
uploadTransactionChunks posts only the chunks, for a transaction the network already has. Posting the header of a mined transaction again is refused, so a caller resuming an upload needs a way to send the chunks on their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
…weave A node answers 400 "Transaction is already on the weave." to the header of a mined transaction. uploadTransaction treated that as a failed upload and sent no chunks, so resending a transaction that had just been mined failed even though only its chunks were missing. That answer now counts as a posted header, as 208 for a pending one already did, and the chunks are sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
From review of the chunk retry fix. - a node answers 400 "Transaction is already in the mempool." to a header it has had pending for more than ten minutes, after its 208 lapses; that now counts as a posted header too, so a resent upload posts its chunks - the first chunk is sent alone, and the rest fan out once it is accepted. Until the header reaches the nodes every chunk is rejected and retried, and the gateway posts each attempt to several peers, so retrying all of them at once multiplied that traffic for nothing - doc comments say how long a node recognises a resent header - version 4.1.0, since uploadTransactionChunks is new API Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
Moves the pin to the head of ardriveapp/arweave-dart#75 after review: a header pending for more than ten minutes now counts as posted, and the first chunk is sent alone before the rest fan out. The pin moves to v4.1.0 once that is tagged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
ardriveapp/arweave-dart#75 is merged and tagged v4.1.0 (c5afb66), so the pins move from the reviewed commit 1573dae to the tag. The tag's tree is the same as that commit's; it adds only the merge commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ZiqyGae4T1gJLGGB29pR9
getResponseErrorFromDioResposethrew when Dio had already decoded a JSON error body into a Map. The throw was anError, not anException, so the chunk retry added in 4.0.1 did not run, and the upload stopped after its first chunk attempt.Changes
getResponseErrorFromDioResposereads the error from a Map, List, String or empty body, and no longer throws.uploadTransactioncounts a header the network already has as posted, and sends the chunks:uploadTransactionChunksposts a transaction's chunks without posting its header. It covers transactions too old for a re-posted header to be recognised. This is an addition; existing functions are unchanged.Testing
test/chunk_upload_retry_test.dartcovers:transactions_test.dartcases fail onmastertoo, because they need arweave.net.Follow-ups, not in this PR
_fatalChunkUploadErrorsnever matches through a gateway. A truly fatal chunk is retried for about 10 minutes before failing. That is slow, but it is not data loss.lib/src/models/transaction_uploader.dart(the http-package path) is unchanged.After merge, tag
v4.1.0so ardrive-web can pin it.🤖 Generated with Claude Code
https://claude.ai/code/session_01XxK9v6SqyxtV5g4yaXSkB1
Summary by CodeRabbit