Repository navigation
fix(flutter): Allow empty associatedEventId in SentryFeedbackForm - #4108
Merged
Merged
Conversation
SentryFeedbackForm asserted that associatedEventId is never SentryId.empty(), but Hub.captureMessage/captureEvent return the empty id whenever the capture is not sent (network error, disabled hub, beforeSend drop). Opening the form with that id crashed debug and profile builds. Treat an empty id the same as null (no association) instead. Fixes #4042 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. FeaturesFlutter
Fixes
Dependencies
🤖 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 #4108 +/- ##
==========================================
+ Coverage 88.81% 92.94% +4.13%
==========================================
Files 348 114 -234
Lines 12631 4636 -7995
==========================================
- Hits 11218 4309 -6909
+ Misses 1413 327 -1086
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
buenaflor
approved these changes
Oct 22, 2026
buenaflor
enabled auto-merge (squash)
October 22, 2026 10:30
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
SentryFeedbackFormno longer asserts thatassociatedEventIdis notSentryId.empty(). An empty id is now normalized tonullin the constructor, so the form opens without an event association instead of crashing.Because the normalization happens on the stored field, the empty id is also not sent with the submitted
SentryFeedback, nor carried intopendingAssociatedEventIdacross the screenshot flow.The public constructor and
showsignatures are unchanged.💡 Motivation and Context
Fixes #4042
Hub.captureMessage/captureEventreturnSentryId.empty()whenever the capture isn't sent (network error, disabled hub, dropped by an event processor orbeforeSend). A common pattern — including the example app's "Capture Feedback" button — passes that id straight toSentryFeedbackForm.show, which crashed debug and profile builds with:This is a runtime/environmental condition, not a programmer error, so it shouldn't be an assert.
💚 How did you test it?
submits feedback without association when associatedEventId is empty, that builds the form withSentryId.empty(), submits it, and verifiescaptureFeedbackreceivesassociatedEventId == null. It failed on the assertion before the fix and passes after.flutter test test/feedback/— all 59 tests pass.flutter analyze --fatal-warningsanddart format(Dart 3.13) clean via the pre-commit hook.📝 Checklist
sendDefaultPiiis enabled🔮 Next steps