Skip to content

Fixed multipart upload abort logic and missing BucketName in cleanup#56

Merged
MatteoDelOmbra merged 3 commits into
mainfrom
FSPES-107
Apr 21, 2026
Merged

Fixed multipart upload abort logic and missing BucketName in cleanup#56
MatteoDelOmbra merged 3 commits into
mainfrom
FSPES-107

Conversation

@MichalFrends1

@MichalFrends1 MichalFrends1 commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Please review my changes :)

Task Update PR template

Review Checklist

  • Task version updated (x.x.0)
  • CHANGELOG.md updated
  • Solution builds
  • Warnings resolved (if possible)
  • Typos resolved
  • Tests cover new code
  • Description how to run tests locally added to README.md (if needed)
  • All tests pass locally

Summary by CodeRabbit

Version 3.3.0

  • Bug Fixes

    • Corrected multipart upload abort cleanup to require bucket/key and perform a single abort call.
    • Fixed exception handling so upload errors are properly propagated instead of being suppressed.
  • Chores

    • Set default multipart part size to 10 MB.
  • Documentation

    • Added changelog entry for version 3.3.0.

@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown

Walkthrough

Bumps package to v3.3.0, updates changelog, sets default multipart part size to 10 MB, and simplifies multipart-upload error handling by replacing a parts-enumeration cleanup with a single AbortMultipartUploadAsync call and rethrowing the original exception.

Changes

Cohort / File(s) Summary
Changelog
Frends.AmazonS3.UploadObject/CHANGELOG.md
Added v3.3.0 entry documenting fixes to abort cleanup, rethrow behavior, and default part size.
Package Version
Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject.csproj
Incremented package <Version> from 3.2.0 to 3.3.0.
Multipart Abort Logic
Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs
Replaced multi-iteration ListPartsAsync + per-part abort loop with a single AbortMultipartUploadAsync(initResponse.UploadId); added nested try/catch around abort and throw; to rethrow original exception.
Default Part Size
Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Definitions/Connection.cs
Added [DefaultValue(10)] and default initializer = 10 to Connection.PartSize (default 10 MB).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Caller
    participant UploadObject
    participant S3 as "AmazonS3 Service"
    Caller->>UploadObject: Start UploadMultipart(...)
    UploadObject->>S3: CreateMultipartUpload (Init)
    S3-->>UploadObject: UploadId
    UploadObject->>S3: UploadPart(s)...
    S3-->>UploadObject: Error (exception thrown)
    UploadObject->>S3: AbortMultipartUpload(UploadId)
    S3-->>UploadObject: Abort response (or error swallowed)
    UploadObject-->>Caller: Rethrow original exception
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • MatteoDelOmbra
  • jefim

Poem

🐇 A multipart hop, then a sigh,
One tidy abort waved goodbye,
Parts no longer counted round and round,
A thrown exception freed, unbound —
Ten-meg beats drum, uploads stay sound. 🎶

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main changes: fixing multipart upload abort logic and addressing missing BucketName in cleanup, which are the core fixes documented in the changelog.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch FSPES-107

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Frends.AmazonS3.UploadObject/CHANGELOG.md`:
- Around line 3-5: Update the 3.3.0 changelog entry to follow the repository's
Keep a Changelog format: add the missing space after the dash so the line reads
"- Fixed missing BucketName/Key in abort cleanup..." (locate the "## [3.3.0] -
2025-10-17" block and the line starting with "-Fixed"), and correct the release
date for 3.3.0 so the release history is monotonic (replace the erroneous
"2025-10-17" with the proper 2026-04-xx date corresponding to this PR or the
actual release date).

In `@Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs`:
- Around line 260-275: The catch block currently attempts to call
client.AbortMultipartUploadAsync using initResponse and then rethrows, but if
AbortMultipartUploadAsync throws it will overwrite the original exception and
lose the root cause; also initResponse is effectively always non-null because
InitiateMultipartUploadAsync runs before the try. Wrap the abort call in its own
try/catch so any exception from AbortMultipartUploadAsync is logged/ignored and
does not replace the original (use a nested try/catch around
AbortMultipartUploadAsync and swallow or log the abort error), and either remove
the redundant initResponse null-check or move the InitiateMultipartUploadAsync
call inside the outer try so the initResponse guard is meaningful; reference
AbortMultipartUploadAsync, AbortMultipartUploadRequest, initResponse and
InitiateMultipartUploadAsync when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5bb6a628-9752-4518-be96-4c8c757e0afd

📥 Commits

Reviewing files that changed from the base of the PR and between bca5420 and 066acee.

📒 Files selected for processing (3)
  • Frends.AmazonS3.UploadObject/CHANGELOG.md
  • Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject.csproj
  • Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs

Comment thread Frends.AmazonS3.UploadObject/CHANGELOG.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs`:
- Around line 262-277: The abort block currently passes the same
cancellationToken (used for UploadPartAsync/CompleteMultipartUploadAsync) to
client.AbortMultipartUploadAsync which can be already canceled; change the call
to use a fresh non-canceled token (e.g. CancellationToken.None or a new
CancellationToken) when invoking client.AbortMultipartUploadAsync so the
AbortMultipartUploadRequest (constructed with input.BucketName, Key = path,
UploadId = initResponse.UploadId) is sent to S3 even if the original token was
canceled; keep the surrounding try/catch that swallows abort errors to allow the
original exception to be rethrown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c3dfbb9-a8af-4de0-8411-a784c6073176

📥 Commits

Reviewing files that changed from the base of the PR and between 066acee and bba1169.

📒 Files selected for processing (3)
  • Frends.AmazonS3.UploadObject/CHANGELOG.md
  • Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/Definitions/Connection.cs
  • Frends.AmazonS3.UploadObject/Frends.AmazonS3.UploadObject/UploadObject.cs
✅ Files skipped from review due to trivial changes (1)
  • Frends.AmazonS3.UploadObject/CHANGELOG.md

@MatteoDelOmbra MatteoDelOmbra merged commit c6f6432 into main Apr 21, 2026
7 checks passed
@MatteoDelOmbra MatteoDelOmbra deleted the FSPES-107 branch April 21, 2026 11:54
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