Skip to content

Conversation

@buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Oct 23, 2025

📜 Description

Currently accessing the json values is not type safe

💡 Motivation and Context

Fixes #3301

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Replace other protocol classes to use the new type safe access methods

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.00%. Comparing base (393f8ec) to head (7730cfa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3309      +/-   ##
==========================================
- Coverage   88.08%   88.00%   -0.09%     
==========================================
  Files         295      296       +1     
  Lines       10217    10244      +27     
==========================================
+ Hits         9000     9015      +15     
- Misses       1217     1229      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1257.60 ms 1265.52 ms 7.92 ms
Size 5.53 MiB 6.01 MiB 487.38 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
944b773 1252.82 ms 1254.08 ms 1.27 ms
aeb02f2 1244.29 ms 1256.55 ms 12.26 ms
5b9a0da 1249.69 ms 1250.71 ms 1.03 ms
40c8f93 1234.27 ms 1261.98 ms 27.71 ms
819c1e7 1250.59 ms 1249.08 ms -1.51 ms
c1e775e 1263.08 ms 1275.32 ms 12.24 ms
c8596a6 1234.11 ms 1241.19 ms 7.08 ms
192b44c 1269.08 ms 1275.52 ms 6.44 ms
de377fd 1252.28 ms 1254.76 ms 2.48 ms
e2d675d 1238.48 ms 1242.76 ms 4.28 ms

App size

Revision Plain With Sentry Diff
944b773 5.53 MiB 6.00 MiB 479.98 KiB
aeb02f2 7.86 MiB 9.44 MiB 1.58 MiB
5b9a0da 5.53 MiB 5.96 MiB 444.32 KiB
40c8f93 5.53 MiB 6.00 MiB 479.94 KiB
819c1e7 5.53 MiB 6.00 MiB 479.96 KiB
c1e775e 20.70 MiB 22.46 MiB 1.75 MiB
c8596a6 7.86 MiB 9.44 MiB 1.58 MiB
192b44c 5.53 MiB 5.96 MiB 444.33 KiB
de377fd 20.71 MiB 22.43 MiB 1.73 MiB
e2d675d 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: fix/unsafe-access-sentry-device

Startup times

Revision Plain With Sentry Diff
5551800 1261.46 ms 1265.96 ms 4.50 ms
2a0b9c7 1233.52 ms 1246.59 ms 13.07 ms
d177ad0 1246.53 ms 1245.63 ms -0.90 ms
3563704 1260.73 ms 1257.17 ms -3.57 ms
3e5fad6 1269.69 ms 1264.14 ms -5.54 ms

App size

Revision Plain With Sentry Diff
5551800 5.53 MiB 6.00 MiB 484.71 KiB
2a0b9c7 5.53 MiB 6.00 MiB 484.82 KiB
d177ad0 5.53 MiB 6.00 MiB 485.18 KiB
3563704 5.53 MiB 6.00 MiB 484.98 KiB
3e5fad6 5.53 MiB 6.00 MiB 484.73 KiB

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 442.41 ms 465.78 ms 23.37 ms
Size 13.93 MiB 15.06 MiB 1.13 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
575ebaa 478.00 ms 585.76 ms 107.76 ms
73a3c38 478.18 ms 526.62 ms 48.44 ms
819c1e7 449.80 ms 442.98 ms -6.82 ms
a10aff4 488.19 ms 515.02 ms 26.83 ms
7cfee3b 498.78 ms 516.98 ms 18.20 ms
3615e19 468.38 ms 504.71 ms 36.33 ms
73dca78 476.53 ms 522.21 ms 45.68 ms
aeb02f2 373.84 ms 437.00 ms 63.16 ms
e2d675d 457.92 ms 529.17 ms 71.25 ms
2cb90b9 479.38 ms 552.69 ms 73.31 ms

App size

Revision Plain With Sentry Diff
575ebaa 6.54 MiB 7.69 MiB 1.15 MiB
73a3c38 6.54 MiB 7.69 MiB 1.15 MiB
819c1e7 13.93 MiB 15.00 MiB 1.06 MiB
a10aff4 13.93 MiB 15.06 MiB 1.13 MiB
7cfee3b 6.54 MiB 7.70 MiB 1.17 MiB
3615e19 6.54 MiB 7.70 MiB 1.16 MiB
73dca78 6.54 MiB 7.69 MiB 1.15 MiB
aeb02f2 6.54 MiB 7.69 MiB 1.15 MiB
e2d675d 6.54 MiB 7.69 MiB 1.15 MiB
2cb90b9 6.54 MiB 7.70 MiB 1.17 MiB

Previous results on branch: fix/unsafe-access-sentry-device

Startup times

Revision Plain With Sentry Diff
3e5fad6 365.02 ms 361.24 ms -3.78 ms
5551800 579.29 ms 598.21 ms 18.92 ms
2a0b9c7 433.07 ms 457.19 ms 24.12 ms
3563704 411.51 ms 440.96 ms 29.45 ms

App size

Revision Plain With Sentry Diff
3e5fad6 13.93 MiB 15.00 MiB 1.06 MiB
5551800 13.93 MiB 15.00 MiB 1.06 MiB
2a0b9c7 13.93 MiB 15.00 MiB 1.06 MiB
3563704 13.93 MiB 15.06 MiB 1.13 MiB

Comment on lines 46 to 50
// Handle numeric 0 and 1 as boolean values
if (value is num) {
if (value == 0) return false;
if (value == 1) return true;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the reason for this is when using FFI objective_c conversions bool are represented as 1 or 0 nums

@buenaflor buenaflor requested a review from denrase October 23, 2025 11:59
/// Extension providing type-safe value extraction from JSON maps
@internal
extension TypeSafeMapExtension on Map<String, dynamic> {
/// Generic, type-safe extraction with a few built-in coercions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

@buenaflor buenaflor merged commit a69a51f into main Oct 23, 2025
135 of 136 checks passed
@buenaflor buenaflor deleted the fix/unsafe-access-sentry-device branch October 23, 2025 15:22
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.

loadContextsIntegration failed

3 participants