Skip to content

Refactor FilesExt: deduplicate complete-upload and simplify resumable upload headers#1279

Merged
parthban-db merged 2 commits intomainfrom
parthban-db/stack/refactor-files-client
Feb 23, 2026
Merged

Refactor FilesExt: deduplicate complete-upload and simplify resumable upload headers#1279
parthban-db merged 2 commits intomainfrom
parthban-db/stack/refactor-files-client

Conversation

@parthban-db
Copy link
Contributor

@parthban-db parthban-db commented Feb 19, 2026

🥞 Stacked PR

Use this link to review incremental changes.


What changes are proposed in this pull request?

This PR makes two small, behavior-preserving refactors to the FilesExt upload internals:

  1. Deduplicate _complete_multipart_upload logic. The _perform_multipart_upload method had an inline copy of the complete-upload HTTP request that was identical to the existing _complete_multipart_upload method (already used by the parallel upload paths). The inline code is replaced with a call to the shared method. The shared method's body construction is also simplified from a loop to a list comprehension.
  2. Simplify _abort_resumable_upload header handling. The resumable upload URL response returns headers as a list of {"name": ..., "value": ...} dicts. Previously, this list was converted to a flat dict in three separate places: once per upload-loop iteration and once inside _abort_resumable_upload. Now the conversion happens once after parsing the response, and the resulting dict is reused everywhere. The _abort_resumable_upload signature changes from required_headers: list to headers: dict[str, str], removing its internal conversion loop.

Why: These refactors reduce code duplication and make the upload internals easier to follow, preparing for a larger refactor that will introduce a _RequestBuilder abstraction to support both presigned-URL and storage-proxy upload paths.

How is this tested?

  • Existing test with the following modification.
  • Added two new assertions in the resumable upload test mock to verify that cloud-provider headers from the resumable URL response are correctly forwarded to both upload-part requests and abort requests. These assertions did not exist before, strengthening the test coverage for the header-passing contract that this refactor touches.

NO_CHANGELOG=true

@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1279
  • Commit SHA: 03635fefee05aab5d366b8fe82e8160d249a7348

Checks will be approved automatically on success.

@parthban-db parthban-db added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit bdefecb Feb 23, 2026
17 checks passed
@parthban-db parthban-db deleted the parthban-db/stack/refactor-files-client branch February 23, 2026 10:03
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.

2 participants