feat: sync environment to the native layers#5365
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5365 +/- ##
==========================================
- Coverage 74.25% 74.23% -0.02%
==========================================
Files 509 509
Lines 18420 18435 +15
Branches 3606 3610 +4
==========================================
+ Hits 13677 13685 +8
- Misses 3869 3875 +6
- Partials 874 875 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…entry/sentry-dotnet into feat/sync-scope-environment
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 490cc8f. Configure here.
…entry/sentry-dotnet into feat/sync-scope-environment
jamescrosswell
left a comment
There was a problem hiding this comment.
LGTM - thanks @bitsandfoxes !

Closes #5385
The scope exposes
Environmentto be overwritten after initialization by the user. This needs to be propagated to the respective native layers. API available onsentry-native✅sentry-cocoa✅sentry-javaneeds to be followed up on.We need to make sure that whatever it is that the SDK will end up setting on an event is also available on the native layer. The
Enricherlazily guarantees that the context is getting populated, so clearing the Scope needs to restore the native scope to the fallback.Initially, I thought we needed to have the
Scopefetch and set theEnvironmentfrom the options on the backing field in the constructor. The idea was that we'd avoid any duplicate scope sync. But this would only be an issue on non-global-mobe platforms, and those don't have scope sync in the first place.So we can "get away" with simply having
Environmentbe a smarter property.Changelog Entry
The
Environmentset on theScopenow gets synchronized to the native layers (sentry-cocoaandsentry-native)