Skip to content

Conversation

@xsahil03x
Copy link
Member

@xsahil03x xsahil03x commented Sep 23, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where leaving a call could fail due to errors parsing custom data.
    • Made user data handling more robust by allowing optional/nullable custom fields to reduce crashes with mixed or missing metadata.
    • Improved overall call stability in sessions with custom metadata.
  • Documentation

    • Added an Upcoming section to the changelog and documented the bug fix.

@xsahil03x xsahil03x requested a review from a team as a code owner September 23, 2025 10:11
@coderabbitai
Copy link

coderabbitai bot commented Sep 23, 2025

Walkthrough

Updated changelog with an upcoming bug-fix note and adjusted UserResponse deserialization to allow nullable values in the custom map by changing its type from Map<String, Object> to Map<String, Object?> and updating the JSON cast.

Changes

Cohort / File(s) Summary of Changes
Changelog Update
packages/stream_video/CHANGELOG.md
Added an Upcoming section noting a bug fix: leave call could fail when parsing custom data.
Model Deserialization
packages/stream_video/lib/open_api/video/coordinator/model/user_response.dart
Changed custom field type to Map<String, Object?>; updated fromJson to use mapCastOfType<String, Object?>(...) to permit nullable map values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Brazol

Poem

I hop through fields of JSON light,
Nullable pebbles tuck in tight.
Changelog hums of fixes near,
Custom maps now hold nulls with cheer.
Thump-thump — a rabbit's tidy merge delight. 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR contains no author-provided description while the repository requires a populated template with sections like Goal, Implementation details, Testing, and Contributor Checklist; this omission makes it hard for reviewers to verify intent and tests. The changelog and file diffs give hints, but the required description fields are missing. Please fill the repository PR template: add a "Goal" explaining why the leave call was failing, "Implementation details" describing changes (e.g., UserResponse.custom changed to Map<String, Object?> and the cast update), "Testing" with steps to reproduce and verify the fix, and complete the Contributor Checklist including assigning an owner and linking the related issue or Slack thread.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title is a short, single sentence that directly states the main intent—fixing a leave-call exception—and aligns with the changes in this branch (the custom-data parsing change in UserResponse and the changelog note about leave-call parsing). It is concise, relevant, and free of noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/leave-call

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/stream_video/CHANGELOG.md (1)

4-4: Fix typo/grammar in changelog entry.

Remove the extra “the” and tighten the phrasing.

-* Fixed an issue where the leave call operation could fail if the there were some issues in parsing custom data.
+* Fixed an issue where the leave call operation could fail if there were issues parsing custom data.
packages/stream_video/lib/open_api/video/coordinator/model/user_response.dart (1)

246-246: Avoid force-unwrap; default to empty map for resilience.

Using ! will still throw if custom is absent/null. Defaulting keeps behavior consistent with the constructor’s const {} and prevents crashes if the backend omits custom.

-        custom: mapCastOfType<String, Object?>(json, r'custom')!,
+        custom: mapCastOfType<String, Object?>(json, r'custom') ?? const {},

Note: If custom can be omitted, consider relaxing the debug-time assertion or removing 'custom' from requiredKeys to avoid assert failures in debug builds. Also verify this manual edit won't be overwritten by codegen.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e40e742 and 6003ffd.

📒 Files selected for processing (2)
  • packages/stream_video/CHANGELOG.md (1 hunks)
  • packages/stream_video/lib/open_api/video/coordinator/model/user_response.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: build
  • GitHub Check: analyze
  • GitHub Check: stream_video_flutter
  • GitHub Check: stream_video_noise_cancellation
  • GitHub Check: stream_video_push_notification
  • GitHub Check: stream_video

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 4.86%. Comparing base (e40e742) to head (bc15a7a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...pen_api/video/coordinator/model/user_response.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1065   +/-   ##
=====================================
  Coverage   4.86%   4.86%           
=====================================
  Files        591     591           
  Lines      39914   39914           
=====================================
  Hits        1943    1943           
  Misses     37971   37971           

☔ 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/stream_video/lib/open_api/video/coordinator/model/user_response.dart (1)

246-247: Null-safety: avoid ! to prevent crashes if custom is null

The value-type fix is correct and solves the cast error on null entries. To be defensive in release builds (where asserts are stripped), prefer a fallback over ! in case the backend sends custom: null.

-        // MANUAL_EDIT: allow null values
-        custom: mapCastOfType<String, Object?>(json, r'custom')!,
+        // MANUAL_EDIT: allow null values; default to empty map if null
+        custom: mapCastOfType<String, Object?>(json, r'custom') ?? const <String, Object?>{},

Please confirm the API never returns custom as null; if it might, the above change will prevent a release-mode NPE.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d2027dd and bc15a7a.

📒 Files selected for processing (1)
  • packages/stream_video/lib/open_api/video/coordinator/model/user_response.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: stream_video_noise_cancellation
  • GitHub Check: stream_video_push_notification
  • GitHub Check: stream_video
  • GitHub Check: analyze
  • GitHub Check: build
  • GitHub Check: stream_video_flutter

@xsahil03x xsahil03x enabled auto-merge (squash) September 23, 2025 14:11
@Brazol Brazol disabled auto-merge September 23, 2025 14:17
@Brazol Brazol merged commit 06e4050 into main Sep 23, 2025
12 of 15 checks passed
@Brazol Brazol deleted the fix/leave-call branch September 23, 2025 14:17
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.

4 participants