Skip to content

Conversation

@kzu
Copy link
Member

@kzu kzu commented Jun 25, 2025

Allow updating messages in storage

This is useful to update messages with additional properties set in the pipeline

This is useful to update messages with additional properties set in the pipeline
@kzu kzu requested a review from Copilot June 25, 2025 12:13
@kzu kzu enabled auto-merge (rebase) June 25, 2025 12:13
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

Allow updating messages in storage by replacing existing entries instead of always appending, and add a test to verify this behavior.

  • Replace existing message in a conversation when IDs match.
  • Update test project’s C# language version to Preview.
  • Add a test that verifies updating an existing message’s additional properties.

Reviewed Changes

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

File Description
src/WhatsApp/ConversationStorage.cs Add logic to find and replace an existing message in the conversation before saving.
src/Tests/Tests.csproj Bump LangVersion to Preview in the test project.
src/Tests/ConversationStorageTests.cs Add a test case to ensure that updating a message preserves both new and existing properties.


message.AdditionalProperties?["Agent"] = "Calendar";

await storage.SaveAsync(message);
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

The test calls SaveAsync without providing a CancellationToken, but the implementation requires one. Either add an overload with a default token or update the test to pass a valid CancellationToken.

Copilot uses AI. Check for mistakes.
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>Preview</LangVersion>
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

[nitpick] Requiring the C# Preview language version in tests may introduce instability; consider targeting a specific stable LangVersion unless new preview features are strictly needed.

Suggested change
<LangVersion>Preview</LangVersion>
<LangVersion>latest</LangVersion>

Copilot uses AI. Check for mistakes.
@kzu
Copy link
Member Author

kzu commented Jun 25, 2025

37 passed 37 passed 8 skipped

🧪 Details on Ubuntu 24.04.2 LTS

from dotnet-retest v0.7.1 on .NET 8.0.17 with 💜 by @devlooped

@kzu kzu merged commit 3b54cb0 into main Jun 25, 2025
7 checks passed
@kzu kzu deleted the dev/UpdateMessage branch June 25, 2025 12:15
@kzu kzu added the enhancement New feature or request label Jun 25, 2025
@devlooped devlooped locked and limited conversation to collaborators Jul 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants