Conversation
This was referenced May 26, 2026
This was referenced May 26, 2026
The abort/termination retry loop now comes from the shared statement-IR procedure (terminate-upload-with-retry): tusclient/abort_generated.py owns the algorithm, and TusClient.terminate_upload delegates to it with an empty retry budget to keep its historical single-attempt behavior. The HTTP terminate request stays a handwritten transport shim. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The uploader's per-chunk patch-with-retry now runs on the generated upload_chunk_with_retry (tusclient/upload_chunks_generated.py), emitted from the shared TUS protocol contract retry core. The handwritten _do_request/_retry_or_cry recursion is delegated: the patch transport stays in _perform_patch_request (TusRequest machinery, accepted-state absorption), offset recovery failures re-enter the retry decision iteratively exactly as the recursion did, and the no-status-filter retry semantics plus the _retried counter surface are preserved. The legacy retries/retry_delay options map onto the delays-indexed budget via _upload_retry_delays_ms. The async uploader keeps its own loop for now. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AsyncUploader's handwritten _do_request/_retry_or_cry recursion delegates to the generated async upload_chunk_with_retry, the same walked per-chunk retry procedure as the sync runtime with await at the patch and sleep effects. The retry decision helpers stay imported from the sync modules, and the legacy _retry_limit/_retry_delay_seconds/_should_retry helpers leave baseuploader with their last consumer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Method-override interpretation is keyed by operationId, and the contract derives each override's sourceMethod from that same operation (tusClientMethodOverrideModels), so after an operationId match the source_method comparison could never fire for contract-consistent callers — both generated call sites pass the UPLOAD_CHUNK constants derived from the very operation the override names. This converges the Python interpretation with the TypeScript runtime (tusMethodOverrideForOperation over the sourceMethod-less tusClientRuntimeMethodOverrideModels). source_method stays the no-override fallback method, mirroring the TS plan-method fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Why
This is the Python companion canary for the generated TUS protocol SDK work. It proves tus-py-client can consume contract-owned protocol facts, generated conformance fixtures, and checked devdock examples without duplicating TUS wire knowledge in the Python repo.
Experimental Status
Experimental work: this PR is part of an exploratory contract/generated SDK effort, and is intentionally kept as a Draft while the approach is validated across TUS clients.
What
Locationresolution from contract-owned request/response fixtures.override_patch_methodwith POST plusX-HTTP-Method-Override: PATCH.FileStorageto use them for new records while preserving legacy raw-key lookup/update behavior.abortUploadby aborting an active create request and aborting a patch request followed by DELETE termination of a known upload.tusNodePathInputSourcescenario by writing the scenario content to a temporary file and uploading it through Python'sfile_pathsurface.tusRetryStateTransitionsscenario:retry_delaysdrives retry count/delay in milliseconds,on_should_retry(error, retry_attempt)observes/overrides retry decisions, and retry attempts reset after offset recovery observes server-side progress.tusParallelUploadConcatscenario: Python creates partial uploads, uploads file ranges, reports aggregate callbacks, then creates the final concat upload from the partial URLs.Latest Verification
tus-genis pushed at0969ad6.python3 -m py_compile examples/api2-devdock-tus-parallel-upload-concat/main.py tusclient/uploader/baseuploader.py tusclient/uploader/uploader.py tusclient/protocol_generated.pypassed.python3 -m pytest tests/test_uploader.py -qpassed with 34 tests.python3 -m pytest -qpassed with 73 tests.tusParallelUploadConcat,tusRetryStateTransitions,tusNodePathInputSource,tusAbortUpload,tusAbortUploadAfterStoredUrl,tusProtocolVersionSelectionDraft05CreationWithUpload,transloaditTusAssemblyFileUrlStorageBackend,tusOverridePatchMethod, andtusRelativeLocationResolution.0969ad6across ubuntu/windows Python 3.8-3.13.Related TUS PRs