fix: Unwrap protobuf Value types in CallParticipantState.custom field#1172
fix: Unwrap protobuf Value types in CallParticipantState.custom field#1172antondokusov wants to merge 3 commits intoGetStream:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdated Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart (1)
244-267:⚠️ Potential issue | 🔴 CriticalUse
toProto3Json()instead ofwriteToJsonMap()for converting protobuf Struct values to native Dart types.In protobuf 6.0.0,
toProto3Json()is the official, documented API for Proto3 JSON serialization and convertingStruct/Valuetypes to native Dart equivalents (String,num,bool,List,Map<String, dynamic>). WhilewriteToJsonMap()exists and may work, it's a generic message-to-map encoder and not the intended API for this conversion.Change line 251 to:
custom: custom.toProto3Json() as Map<String, dynamic>,
07fded6 to
6fc26c4
Compare
6fc26c4 to
d747656
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1172 +/- ##
=====================================
Coverage 6.36% 6.36%
=====================================
Files 615 615
Lines 43340 43340
=====================================
Hits 2757 2757
Misses 40583 40583 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @antondokusov, thanks for taking the time to contribute this! The change definitely makes sense, and ideally, it would have worked this way from the start. However, introducing it now would be a breaking change, which we’re trying to avoid. If you’re open to spending a bit more time on it, one option would be to introduce a new field with the correct mapping while marking the existing one as deprecated. That would allow us to maintain backward compatibility for now, and we could clean it up properly in the next major release. If you’d rather not invest more time in this, no worries at all, just let us know. We can open a separate PR building on top of your changes. Thanks again for the contribution! |
🎯 Goal
Fix an issue where
CallParticipantState.customfield contains protobufValuewrapper objects instead of native Dart types. This makes it difficult for developers to access custom participant data, as they need to manually unwrap eachValueobject to get the actual values.The protobuf
Structtype usesValuewrappers to represent dynamically-typed data, but when converting to the domain model, these should be unwrapped to native Dart types for easier consumption.🛠 Implementation details
Changed the conversion in
SfuParticipantExtension.toDomain()from:to:
🎨 UI Changes
N/A
🧪 Testing
This change can be tested by:
Before the fix:
After the fix:
☑️Contributor Checklist
General
☑️Reviewer Checklist
Summary by CodeRabbit