feat: User.Id can now be overriden (set to null) in Global mode#5039
Conversation
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Breaking Changes 🛠
Features ✨
Fixes 🐛
Dependencies ⬆️Deps
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5039 +/- ##
==========================================
+ Coverage 73.87% 74.07% +0.20%
==========================================
Files 506 507 +1
Lines 18247 18255 +8
Branches 3564 3568 +4
==========================================
+ Hits 13480 13523 +43
+ Misses 3891 3865 -26
+ Partials 876 867 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adjusts how User.Id is populated from InstallationId when Global Mode is enabled, so that applications can explicitly clear/override the value (e.g., set it to null) without it being re-applied during event enrichment.
Changes:
- Add a new
GlobalRootScopeIntegrationdefault integration that setsscope.User.Idfromoptions.InstallationIdat startup (Global Mode only). - Update
Enricherto not apply theInstallationIdfallback in Global Mode (so user overrides aren’t re-written). - Update/extend tests and Verify snapshots to account for the new default integration and changed behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/Sentry/Integrations/GlobalRootScopeIntegration.cs |
New integration to set User.Id on the root scope in Global Mode. |
src/Sentry/Internal/Enricher.cs |
Stops applying InstallationId fallback when Global Mode is enabled. |
src/Sentry/SentryOptions.cs |
Registers the new integration as a default integration. |
test/Sentry.Tests/Integrations/GlobalRootScopeIntegrationTests.cs |
Adds tests covering the new integration and updated enricher behavior. |
test/Sentry.Tests/SentryClientTests.cs |
Adjusts tests around fallback User.Id behavior. |
test/Sentry.Tests/SentryOptionsTests.verify.cs + *.verified.txt |
Narrows snapshot scope to integration-registration logs and updates expected output. |
src/Sentry/PlatformAbstractions/FrameworkInfo.cs |
Adds an additional .NET Framework release key mapping for 4.8.1. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thank you for the PR! |
| {533320, "4.8.1"}, | ||
| {533325, "4.8.1"} | ||
| {533325, "4.8.1"}, | ||
| {533509, "4.8.1"} |
There was a problem hiding this comment.
question: how did you notice this?
CI just started to fail when a new servicing update is applied to the runners?
There was a problem hiding this comment.
I think I ran the unit tests on my Windows box which is running the latest version of Windows and service packs, which broke the tests. Presumably those are now hitting the CI runners.
- Add Scope + SubstituteConfigureScope to the disabled test, with assertion that scope.User.Id remains null - Add hub.Received(1).ConfigureScope assertion to both enabled tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Stefan Pölz <38893694+Flash0ver@users.noreply.github.com>
- Use nameof(GlobalRootScopeIntegration) in Skip.If messages for easier navigation - Move comment to after // Arrange in CaptureEvent_UserIsNull_SetsFallbackUserId to match CaptureTransaction_UserIsNull_SetsFallbackUserId Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
> ℹ️ **Note** > > This PR body was truncated due to platform limits. This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [Sentry.Maui](https://sentry.io/) ([source](https://github.com/getsentry/sentry-dotnet)) | `6.5.0` → `6.6.0` |  |  | --- ### Release Notes <details> <summary>getsentry/sentry-dotnet (Sentry.Maui)</summary> ### [`v6.6.0`](https://github.com/getsentry/sentry-dotnet/blob/HEAD/CHANGELOG.md#660) [Compare Source](getsentry/sentry-dotnet@6.5.0...6.6.0) ##### Features ✨ - feat: propagate trace to `sentry-android` and `sentry-cocoa` by [@​bitsandfoxes](https://github.com/bitsandfoxes) in [#​5244](getsentry/sentry-dotnet#5244) - feat: User.Id can now be overriden (set to null) in Global mode by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5039](getsentry/sentry-dotnet#5039) - feat: Implement strict trace continuation by [@​giortzisg](https://github.com/giortzisg) in [#​4981](getsentry/sentry-dotnet#4981) ##### Fixes 🐛 - fix: return early from AddSentryOtlpExporter when DSN is the disable-SDK sentinel by [@​jamescrosswell](https://github.com/jamescrosswell) in [#​5247](getsentry/sentry-dotnet#5247) - fix: sync default tags to native layer by [@​bitsandfoxes](https://github.com/bitsandfoxes) in [#​5214](getsentry/sentry-dotnet#5214) ##### Dependencies ⬆️ ##### Deps - chore(deps): update Cocoa SDK to v9.14.0 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​5252](getsentry/sentry-dotnet#5252) - chore(deps): update Java SDK to v8.42.0 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​5208](getsentry/sentry-dotnet#5208) ##### Other - release: 6.6.0 by [@​jamescrosswell](https://github.com/jamescrosswell) in [0140be0a](getsentry/sentry-dotnet@0140be0) - chore: update scripts/update-cli.ps1 to 3.4.3 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​5251](getsentry/sentry-dotnet#5251) - ci: update the Update Dependencies workflow by [@​Flash0ver](https://github.com/Flash0ver) in [#​5175](getsentry/sentry-dotnet#5175) - chore: update modules/sentry-native to 0.14.2 by [@​github-actions](https://github.com/github-actions)\[bot] in [#​5229](getsentry/sentry-dotnet#5229) - chore: update...
Resolves #4172