Skip to content

Conversation

@adalon
Copy link
Collaborator

@adalon adalon commented May 22, 2025

Purpose of the Pull Request

The purpose of this pull request is to refactor the handlers in the WhatsApp project to return asynchronous enumerable responses. This change prepares the codebase for adding a storage handler, improving the flexibility and scalability of the message-handling pipeline.

Impact and Potential Risks

This pull request involves significant changes across multiple files, including modifications to the message-handling logic, interfaces, and tests. The use of asynchronous enumerables may introduce risks related to error handling and cancellation token propagation, as highlighted in the discussions. However, these changes align with modern asynchronous programming practices, which should improve performance and resource usage.

@CLAassistant
Copy link

CLAassistant commented May 22, 2025

CLA assistant check
All committers have signed the CLA.

@adalon adalon force-pushed the dev/adalonso/RefactorHandlers branch 2 times, most recently from ca29304 to 9b4dba0 Compare May 27, 2025 15:07
@adalon adalon marked this pull request as ready for review May 27, 2025 15:07
@adalon adalon changed the title WIP/Draft Refactored handlers to return async enum responses Refactored handlers to return async enum responses May 27, 2025
@adalon adalon requested a review from Copilot May 27, 2025 16:15
Copy link

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@adalon adalon requested a review from Copilot May 27, 2025 16:38
Copy link

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 pull request refactors the WhatsApp handlers to return asynchronous enumerable responses, enhancing flexibility and scalability in message processing. Key changes include the transition from Task-based to IAsyncEnumerable-based handler methods, the propagation of cancellation tokens in client operations, and updates in test and sample implementations to work with async enumerables.

Reviewed Changes

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

Show a summary per file
File Description
src/WhatsApp/WhatsAppHandler.cs Refactored handler implementation to return IAsyncEnumerable.
src/WhatsApp/WhatsAppClientExtensions.cs Updated extension methods to include cancellation tokens and adjust parameter signatures.
src/WhatsApp/WhatsAppClient.cs Added cancellation token propagation in SendAsync operations.
src/WhatsApp/OpenTelemetryHandler.cs Updated error handling via WithErrorHandlingAsync in the tracing handler.
src/SampleApp/Sample/Program.cs Modified sample app to iterate asynchronous responses and updated service configuration.
Comments suppressed due to low confidence (1)

src/WhatsApp/WhatsAppClientExtensions.cs:6

  • The accessibility of the WhatsAppClientExtensions class was changed from public to internal by removing the public modifier. Confirm that this intentional change will not restrict its usage across assemblies if it was designed to be a public API.
static partial class WhatsAppClientExtensions

@kzu kzu force-pushed the dev/adalonso/RefactorHandlers branch from bb2241b to 73bb13a Compare May 27, 2025 19:01
@kzu kzu enabled auto-merge (rebase) May 27, 2025 19:01
@kzu kzu merged commit 4d8ae7a into devlooped:main May 27, 2025
4 checks passed
@devlooped devlooped locked and limited conversation to collaborators Jun 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants