Skip to content

fix: drop head after complete in multipart uploads#1105

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/multipart-head
May 13, 2026
Merged

fix: drop head after complete in multipart uploads#1105
ferhatelmas merged 1 commit into
masterfrom
ferhat/multipart-head

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

@ferhatelmas ferhatelmas commented May 13, 2026

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

We do headObject after multipart upload to get object metadata. It adds latency to uploads.

What is the new behavior?

Count bytes locally, get etag from multipart complete, set last modified similar to single upload, then drop head object call.

Additional context

Upload abort handler is cleaned up in success as well.
This will improve tail latency in uploads.

Copilot AI review requested due to automatic review settings May 13, 2026 09:38
@ferhatelmas ferhatelmas requested a review from a team as a code owner May 13, 2026 09:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the post-multipart HeadObject request in the S3 backend upload flow by deriving upload metadata locally (ETag from multipart completion, lastModified set at completion time, and content length tracked via multipart progress). This targets reduced latency (especially tail latency) for multipart uploads.

Changes:

  • Drop HeadObject call after multipart upload completion and construct ObjectMetadata from multipart completion + local progress tracking.
  • Track uploaded byte count during multipart uploads via httpUploadProgress.loaded and return it as contentLength/size.
  • Update and extend S3 backend tests to assert the new metadata behavior and absence of HeadObject requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/storage/backend/s3/adapter.ts Removes HeadObject after multipart completion; returns metadata using multipart completion output and locally tracked uploaded bytes.
src/storage/backend/s3/adapter.test.ts Updates multipart upload tests to stop expecting HeadObject, and adds coverage for unknown-size multipart uploads with/without progress events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/storage/backend/s3/adapter.ts
@coveralls
Copy link
Copy Markdown

coveralls commented May 13, 2026

Coverage Report for CI Build 25805067938

Coverage increased (+0.2%) to 75.048%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 7 uncovered changes across 1 file (20 of 27 lines covered, 74.07%).
  • 2 coverage regressions across 1 file.

Uncovered Changes

File Changed Covered %
src/storage/backend/s3/adapter.ts 27 20 74.07%

Coverage Regressions

2 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/storage/backend/s3/adapter.ts 2 62.68%

Coverage Stats

Coverage Status
Relevant Lines: 10312
Covered Lines: 8165
Line Coverage: 79.18%
Relevant Branches: 5955
Covered Branches: 4043
Branch Coverage: 67.89%
Branches in Coverage %: Yes
Coverage Strength: 413.41 hits per line

💛 - Coveralls

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/storage/backend/s3/adapter.ts Outdated
Comment thread src/storage/backend/s3/adapter.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/storage/backend/s3/adapter.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/storage/backend/s3/adapter.ts Outdated
Comment thread src/storage/backend/s3/adapter.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread src/storage/backend/s3/adapter.test.ts Outdated
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@ferhatelmas ferhatelmas merged commit 028b5ba into master May 13, 2026
22 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/multipart-head branch May 13, 2026 18:08
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.

4 participants