Skip to content

Conversation

GarrettBeatty
Copy link
Contributor

@GarrettBeatty GarrettBeatty commented Oct 18, 2025

Stacked PRs:


Description

This change adds progress listeners for "initiated", "complete", and "failed" lifecycle events for the MultiUploadCommand. Consumers can subscribe to these callbacks to receive notifications when a simple upload starts, finishes successfully, or fails. this is similar to #4059 but for multi part upload command.

Example usage

// Create a TransferUtilityUploadRequest
TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();

// Subscribe to the progress events
request.UploadInitiatedEvent += Request_UploadInitiatedEvent;
request.UploadCompletedEvent += Request_UploadCompletedEvent;
request.UploadFailedEvent += Request_UploadFailedEvent;

// Use the Transfer Utility to upload the file
using (var transferUtility = new TransferUtility(s3Client))
{
    transferUtility.UploadAsync(request);
}

private void Request_UploadInitiatedEvent(object sender, UploadInitiatedEventArgs e)
{
    Console.WriteLine($"Upload initiated for file: {e.FilePath}");
    Console.WriteLine($"Total bytes to transfer: {e.TotalBytes}");
}

private void Request_UploadCompletedEvent(object sender, UploadCompletedEventArgs e)
{
    Console.WriteLine($"Upload completed for file: {e.FilePath}");
    Console.WriteLine($"Transferred bytes: {e.TransferredBytes}");
    Console.WriteLine($"ETag: {e.Response.ETag}");
    Console.WriteLine($"Version ID: {e.Response.VersionId}");
}

private void Request_UploadFailedEvent(object sender, UploadFailedEventArgs e)
{
    Console.WriteLine($"Upload failed for file: {e.FilePath}");
    Console.WriteLine($"Transferred bytes: {e.TransferredBytes} / {e.TotalBytes}");
}


Motivation and Context

  1. To adhere to the SEP

Testing

1 .84f23e9a-f014-44a6-b129-5d10e7aea8d6 - pass
2. Integration tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

GarrettBeatty added a commit that referenced this pull request Oct 18, 2025
add dev config

fix unseekable stream failure initial request

update try catch

fix null pointer

add comment

stack-info: PR: #4061, branch: GarrettBeatty/stacked/3
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/2 branch from dfea2d8 to ff96820 Compare October 18, 2025 03:14
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/3 branch from 103979e to 7c7699c Compare October 18, 2025 03:14
@GarrettBeatty GarrettBeatty requested a review from Copilot October 18, 2025 04:01
Copy link
Contributor

@Copilot 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 adds multipart upload event lifecycles to the AWS S3 Transfer Utility, enabling tracking of upload initiation, completion, and failure events during multipart uploads.

  • Adds lifecycle event firing (initiated, completed, failed) to the multipart upload command
  • Implements comprehensive integration tests for all event scenarios including unseekable streams
  • Includes proper dev config for patch-level changes

Reviewed Changes

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

File Description
MultipartUploadCommand.async.cs Adds event firing for transfer lifecycle events during async multipart uploads
MultipartUploadCommand.cs Implements helper methods to fire transfer lifecycle events and updates progress callback signature
TransferUtilityTests.cs Adds comprehensive integration tests for multipart upload lifecycle events
433a9a6d-b8ea-4676-b763-70711e8288e3.json Dev config file specifying patch-level changes with appropriate changelog messages

[TestCategory("S3")]
public void MultipartUploadUnseekableStreamFailedEventTest()
{
var fileName = UtilityMethods.GenerateName(@"MultipartUploadTest\UnseekableStreamFailedEvent");
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

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

The fileName variable is declared but never used in these unseekable stream test methods. Since these tests work with streams rather than files, this variable should be removed.

Copilot uses AI. Check for mistakes.

FireTransferFailedEvent();

// Can't do async invocation in the catch block, doing cleanup synchronously.
Cleanup(initResponse.UploadId, pendingUploadPartTasks);
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

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

Potential null reference exception when initResponse is null. The code should check if initResponse is not null before accessing UploadId, or pass initResponse?.UploadId to handle the null case properly.

Suggested change
Cleanup(initResponse.UploadId, pendingUploadPartTasks);
Cleanup(initResponse?.UploadId, pendingUploadPartTasks);

Copilot uses AI. Check for mistakes.

@GarrettBeatty GarrettBeatty changed the base branch from GarrettBeatty/stacked/2 to gcbeatty/tuuploadresponse October 18, 2025 15:42
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/3 branch from 7c7699c to 89d3e3d Compare October 18, 2025 15:42
@GarrettBeatty GarrettBeatty changed the base branch from gcbeatty/tuuploadresponse to GarrettBeatty/stacked/2 October 18, 2025 15:42
@GarrettBeatty GarrettBeatty changed the base branch from GarrettBeatty/stacked/2 to gcbeatty/tuuploadresponse October 18, 2025 19:54
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/3 branch from 89d3e3d to ffc4c2d Compare October 18, 2025 19:54
@GarrettBeatty GarrettBeatty changed the base branch from gcbeatty/tuuploadresponse to GarrettBeatty/stacked/2 October 18, 2025 19:54
@GarrettBeatty GarrettBeatty changed the title multipart upload event lifecycles Add Progress listeners for initiated, complete, and failed for multipart upload Oct 18, 2025
@GarrettBeatty GarrettBeatty changed the base branch from GarrettBeatty/stacked/2 to gcbeatty/tuuploadresponse October 19, 2025 18:13
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/3 branch from ffc4c2d to e2a809c Compare October 19, 2025 18:13
@GarrettBeatty GarrettBeatty changed the title Add Progress listeners for initiated, complete, and failed for multipart upload multipart upload event lifecycles Oct 19, 2025
@GarrettBeatty GarrettBeatty changed the base branch from gcbeatty/tuuploadresponse to GarrettBeatty/stacked/2 October 19, 2025 18:13
stack-info: PR: #4061, branch: GarrettBeatty/stacked/3
@GarrettBeatty GarrettBeatty changed the base branch from GarrettBeatty/stacked/2 to gcbeatty/tuuploadresponse October 19, 2025 18:15
@GarrettBeatty GarrettBeatty force-pushed the GarrettBeatty/stacked/3 branch from e2a809c to c645a1f Compare October 19, 2025 18:15
@GarrettBeatty GarrettBeatty changed the base branch from gcbeatty/tuuploadresponse to GarrettBeatty/stacked/2 October 19, 2025 18:15
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.

1 participant