Fall back to DTO path on direct adapter failure#6489
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR improves event parsing robustness in Stream Chat Android. The direct event parser now catches adapter parsing failures, logs them, and falls back to null for DTO parsing. The NewMessageEventAdapter removes a contradictory default fallback for createdAt to ensure consistency with prior validation. ChangesEvent Parsing Robustness
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
SDK Size Comparison 📏
|
|



Goal
Harden the opt-in fast event parser so a thrown direct-adapter exception degrades gracefully to the existing DTO path instead of failing the whole event parse. Also clean up a dead
Date(0)fallback flagged by SonarCloud. Ports two fixes from develop PR #6473 back to V6.Implementation
DirectEventParser.parse: wrapadapter.fromJson(raw)inrunCatching. On failure, log at verbose level and returnnull—MoshiChatParser.parseAndProcessEventalready checks fornulland falls through to the DTO path.NewMessageEventAdapter: drop the?: Date(0)elvis on thecreatedAtconstructor argument. The explicitif (createdAt == null) throw JsonDataException(...)above already guaranteescreatedAtis non-null at that point, so the elvis was dead.The malformed-
created_atguards (missing field, explicit JSON null, unparseable string) are preserved unchanged.UI Changes
No UI changes.
Testing
DirectEventParserTest,NewMessageEventParsingTest, and other parser2 unit tests continue to pass.nulland the DTO path should take over.Summary by CodeRabbit