Skip to content

feat: Add CancellationToken support to AWS S3 methods#1718

Merged
thomhurst merged 1 commit into
mainfrom
fix/s3-cancellation-token
Jan 1, 2026
Merged

feat: Add CancellationToken support to AWS S3 methods#1718
thomhurst merged 1 commit into
mainfrom
fix/s3-cancellation-token

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • Adds CancellationToken cancellationToken = default parameter to all S3 bucket operation methods
  • Propagates cancellation tokens to AWS SDK async calls
  • Adds ConfigureAwait(false) for consistent async behavior

Why

Previously, S3 operations could not be cancelled - if a pipeline was cancelled, in-flight AWS API calls would continue until completion. This change allows proper cancellation propagation.

Backward Compatibility

All methods use CancellationToken cancellationToken = default, so existing code without cancellation tokens will continue to work without modification.

Test plan

  • Build succeeds
  • CI pipeline passes

Fixes #1544

🤖 Generated with Claude Code

Add CancellationToken parameter (with default value) to all S3 bucket
operation methods, allowing pipeline cancellation to propagate to
AWS SDK calls. Also adds ConfigureAwait(false) for consistency.

Affected methods:
- Bucket, BucketEncryption, BucketLogging, BucketPolicy
- BucketWebsite, BucketNotification, BucketReplication
- BucketTagging, BucketVersioning, BucketAccelerateConfiguration
- BucketAnalyticsConfiguration, BucketInventoryConfiguration
- BucketMetricsConfiguration, BucketOwnershipControls
- BucketRequestPayment, BucketIntelligentTieringConfiguration

Fixes #1544

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 1, 2026 16:53
@thomhurst
Copy link
Copy Markdown
Owner Author

Summary

Adds CancellationToken support and ConfigureAwait(false) to all AWS S3 bucket operation methods.

Critical Issues

None found ✅

Suggestions

Consistency across AWS services: The Lambda.cs class in the same package doesn't expose any async methods yet, but if similar wrapper methods are added to other AWS service classes (Lambda, etc.) in the future, they should follow this same pattern of accepting CancellationToken and using ConfigureAwait(false).

Pattern verification: The changes correctly follow the established patterns in the codebase:

  • ✅ CancellationToken parameter with default value (consistent with src/ModularPipelines/Http/Http.cs:32)
  • ✅ ConfigureAwait(false) usage (consistent with src/ModularPipelines/Http/Http.cs:36, 41, 48)
  • ✅ Proper async propagation to underlying AWS SDK calls

Verdict

APPROVE - No critical issues

The implementation correctly addresses issue #1544 by enabling cancellation support while maintaining backward compatibility. The pattern is consistent with the rest of the codebase.

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 adds proper cancellation support to AWS S3 bucket operations by introducing CancellationToken parameters and applying ConfigureAwait(false) for consistent async behavior. This allows S3 operations to be cancelled when a pipeline is cancelled, preventing in-flight AWS API calls from continuing unnecessarily.

  • Adds CancellationToken cancellationToken = default to all 16 S3 method signatures
  • Propagates cancellation tokens to AWS SDK async method calls
  • Adds ConfigureAwait(false) to all async operations for consistent async patterns

@thomhurst thomhurst merged commit dcf9646 into main Jan 1, 2026
17 of 18 checks passed
@thomhurst thomhurst deleted the fix/s3-cancellation-token branch January 1, 2026 17:07
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.

Code smell: AWS S3 methods do not accept CancellationToken

2 participants