fix: Support geo in SentryGeo initWithDictionary#8026
Conversation
Add initWithDictionary: to SentryGeo and handle the "geo" key in SentryUser.initWithDictionary: so that geo data is properly deserialized instead of landing in the unknown dict and overwriting the serialized geo.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit aef9575. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8026 +/- ##
=============================================
+ Coverage 86.603% 86.612% +0.009%
=============================================
Files 550 550
Lines 31695 31709 +14
Branches 13043 13056 +13
=============================================
+ Hits 27449 27464 +15
- Misses 4196 4198 +2
+ Partials 50 47 -3
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Harness.
|
📲 Install BuildsiOS
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| dd70dad | 1233.87 ms | 1269.91 ms | 36.04 ms |
| 6b08499 | 1216.67 ms | 1247.76 ms | 31.08 ms |
| eaa30de | 1232.96 ms | 1265.43 ms | 32.47 ms |
| 69745fc | 1226.70 ms | 1259.72 ms | 33.02 ms |
| 92fada5 | 1217.60 ms | 1252.89 ms | 35.30 ms |
| 1887b2e | 1218.51 ms | 1243.06 ms | 24.55 ms |
| 2509eff | 1219.50 ms | 1253.57 ms | 34.07 ms |
| e0946cf | 1233.33 ms | 1258.57 ms | 25.24 ms |
| 9c19a06 | 1217.77 ms | 1248.98 ms | 31.21 ms |
| 07d6099 | 1224.06 ms | 1247.13 ms | 23.06 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| dd70dad | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 6b08499 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| eaa30de | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 69745fc | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 92fada5 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 1887b2e | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 2509eff | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| e0946cf | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| 9c19a06 | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| 07d6099 | 24.14 KiB | 1.17 MiB | 1.15 MiB |
itaybre
left a comment
There was a problem hiding this comment.
Almost LGTM, just one comment
Cover all properties, partial input, empty dict, wrong types, and serialize round-trip.
📜 Description
Add
initWithDictionary:toSentryGeo(via a private header) and handle the"geo"key inSentryUser.initWithDictionary:so that geo data is properly deserialized into thegeoproperty instead of landing in theunknowndictionary.Previously, passing a dictionary with a
"geo"key toSentryUser.initWithDictionary:would store it inunknown. During serialization,unknownkeys are written on top of the serialized dict, overwriting the properly-setself.geoproperty — causing duplicated or incorrect geo data.💡 Motivation and Context
Hybrid SDKs (e.g. React Native) pass user dictionaries that include
"geo". Without this fix, they need to manually strip the"geo"key before callinginitWithDictionary:and set it separately — a workaround that was identified in getsentry/sentry-react-native#6261 (comment).💚 How did you test it?
initWithDictionary:with geo fieldsdict → initWithDictionary → serialize) to verify geo survives serialization without leaking intounknownSentryUserTestspass📝 Checklist
sendDefaultPIIis enabled.#skip-changelog