Skip to content

fix(llc): Fix UpsertPushPreferencesResponse null values parsing#2749

Open
VelikovPetar wants to merge 8 commits into
v9from
fix/fix_push_preferences_parsing_issue
Open

fix(llc): Fix UpsertPushPreferencesResponse null values parsing#2749
VelikovPetar wants to merge 8 commits into
v9from
fix/fix_push_preferences_parsing_issue

Conversation

@VelikovPetar

@VelikovPetar VelikovPetar commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Submit a pull request

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

We currently fail to parse null values in the UpsertPushPreferencesResponse.userPreferences map (when response is in the following format):

{
    user_preferences: {salvatore: null},
    user_channel_preferences: {salvatore: {messaging:!members-QOJWJvjGC-iBN9hHDdGMThtJxoUzR1kizb4pv-n0BtE: {chat_level: all}}},
    duration: "11.67ms"
}

Which is the response we get when we update channel-specific push preferences. In this case, the customer gets the error: Failed to set push preferences: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast, even though the operation was successful.

The fix makes the parser more robust, allowing the user_preferences JSON to have null values.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f6a6312d-dff4-4c2c-bfc5-8704525adcfd

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fix_push_preferences_parsing_issue

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@VelikovPetar VelikovPetar requested a review from a team June 12, 2026 15:03
@VelikovPetar VelikovPetar marked this pull request as ready for review June 12, 2026 15:03
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v9@39b0c09). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ckages/stream_chat/lib/src/core/api/responses.dart 80.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             v9    #2749   +/-   ##
=====================================
  Coverage      ?   65.96%           
=====================================
  Files         ?      425           
  Lines         ?    26931           
  Branches      ?        0           
=====================================
  Hits          ?    17765           
  Misses        ?     9166           
  Partials      ?        0           

☔ View full report in Codecov by Harness.
📢 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.

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