Skip to content

Conversation

VladShturma
Copy link
Contributor

@VladShturma VladShturma commented Jul 25, 2025

CLA

  • I have signed the Stream CLA (required).
  • The code changes follow best practices
  • Code changes are tested (add some information if not applicable)

Description of the pull request

skipPush and skipEnrichUrl parameters are not preserved during message send or update retry
How to reproduce:

  • turn the internet off
  • call sendMessage with skipPush and skipEnrichUrl set to true
  • turn the internet on

Actual result: push notification is sent for this message. Url encoding is not skipped
Expected result: push notification is not sent for this message. Url encoding is skipped

Summary by CodeRabbit

  • Bug Fixes

    • Resolved an issue where message flags (skipPush and skipEnrichUrl) are now correctly preserved during message send, update, and partial update retries, ensuring consistent retry behavior.
  • Tests

    • Added and enhanced tests confirming that message retry operations maintain relevant flags and parameters across sending, updating, partial updating, and deleting failure states.

@VladShturma VladShturma marked this pull request as ready for review July 25, 2025 10:27
Copy link
Contributor

coderabbitai bot commented Jul 25, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change updates the message retry logic in the stream chat package to ensure that the skipPush and skipEnrichUrl flags are preserved during message send, update, and partial update retries. The failure states in the message state model are extended to carry these flags and additional partial update data. All relevant code, including retry queue handling, serialization, pattern matching, and tests, is updated accordingly.

Changes

Files / Areas Change Summary
CHANGELOG.md Added "Upcoming" section documenting bug fix for preserving skipPush and skipEnrichUrl flags during message retries.
channel.dart, retry_queue.dart Updated retry logic to extract and propagate skipPush, skipEnrichUrl, and partial update parameters when retrying failed message operations.
message_state.dart, message_state.freezed.dart, message_state.g.dart Extended failure state models to include skipPush, skipEnrichUrl, and partial update parameters; updated constructors, pattern matching, copyWith, equality, and serialization.
channel_test.dart, retry_queue_test.dart, message_state_test.dart, stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart Added and updated tests to verify correct preservation and propagation of the new flags and partial update parameters during retries and state transitions.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Channel
  participant MessageState
  participant Client

  User->>Channel: retryMessage(message)
  Channel->>MessageState: inspect failed state (get skipPush, skipEnrichUrl, partial update data)
  alt sendingFailed
    Channel->>Client: sendMessage(message, skipPush, skipEnrichUrl)
  else updatingFailed
    Channel->>Client: updateMessage(message, skipPush, skipEnrichUrl)
  else partialUpdatingFailed
    Channel->>Client: partialUpdateMessage(message, set, unset, skipEnrichUrl)
  else deletingFailed
    Channel->>Client: deleteMessage(message, hard)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Suggested reviewers

  • renefloor

Poem

🐇
Flags in the breeze, a message to send,
Retry with care, let the right bits ascend.
SkipPush and EnrichUrl, now safely in tow,
Partial updates join in the flow.
Through failures and retries, the right way to go,
With tests all a-hopping, this bug’s at its end!

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@VladShturma VladShturma force-pushed the fix/skip-push-retry branch from 67a7367 to 513ebd4 Compare July 25, 2025 10:44
Copy link

codecov bot commented Jul 25, 2025

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v10.0.0@ba38c8e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/stream_chat/lib/src/client/channel.dart 63.63% 4 Missing ⚠️
...stream_chat/lib/src/core/models/message_state.dart 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             v10.0.0    #2330   +/-   ##
==========================================
  Coverage           ?   64.91%           
==========================================
  Files              ?      417           
  Lines              ?    25777           
  Branches           ?        0           
==========================================
  Hits               ?    16732           
  Misses             ?     9045           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@VladShturma VladShturma force-pushed the fix/skip-push-retry branch from 513ebd4 to d5d8b81 Compare July 25, 2025 13:18
@VladShturma VladShturma marked this pull request as draft July 25, 2025 14:17
@VladShturma VladShturma force-pushed the fix/skip-push-retry branch from d5d8b81 to 54de13c Compare July 25, 2025 14:43
@VladShturma VladShturma marked this pull request as ready for review July 25, 2025 14:48
@xsahil03x
Copy link
Member

Hey @VladShturma , thanks for the fix. I will soon test this PR

@VladShturma
Copy link
Contributor Author

Hey @xsahil03x ! Friendly reminder about my PR

@xsahil03x
Copy link
Member

Hey @VladShturma , The PR looks good to me but this is going to be a breaking change as we are introducing new fields in the MessageState. I would suggest to merge it in the v10.0.0 branch as it's still in beta and can introduce breaking changes.

I also have some fixes in mind around partialUpdate retry as we are not handling it correctly. (We are calling updateMessage instead of partialUpdateMessage). Are you okay for it being released in next beta release?

The `skipPush` parameter was missing from the `FailedState.updatingFailed` constructor and its associated logic. This commit adds the parameter and updates the relevant code to use it.

This change ensures that the `skipPush` option is correctly propagated when a message update fails.
This commit introduces a new state, `partialUpdateFailed`, to the `MessageState` enum. This state is used when a partial update of a message fails.

The `isUpdatingFailed` getter now also considers `partialUpdateFailed` as a failed update state.

Tests have been updated to reflect these changes and ensure correct behavior when handling partial update failures, including retries and error handling.
# Conflicts:
#	packages/stream_chat/lib/src/core/models/message_state.freezed.dart
#	packages/stream_chat/lib/src/core/models/message_state.g.dart
This commit renames `partialUpdateFailed` and `PartialUpdateFailed` to `partialUpdatingFailed` and `PartialUpdatingFailed` respectively across the codebase.

The `skipPush` parameter has also been added as a required parameter to `MessageState.updatingFailed` and its corresponding tests.
@VladShturma
Copy link
Contributor Author

VladShturma commented Jul 30, 2025

@xsahil03x yes, sounds good to me. Is there something that I should do?

@xsahil03x
Copy link
Member

@VladShturma Nope, I can take it from here 👍🏼

@xsahil03x xsahil03x changed the base branch from master to v10.0.0 July 30, 2025 12:35
# Conflicts:
#	packages/stream_chat/CHANGELOG.md
#	packages/stream_chat_flutter/test/src/message_actions_modal/message_actions_modal_test.dart
@xsahil03x xsahil03x merged commit 3ad5cab into GetStream:v10.0.0 Jul 30, 2025
9 checks passed
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