Skip to content

Add beforeSendFeedback callback for user feedback filtering - #1528

Merged
tustanivsky merged 19 commits into
mainfrom
feat/before-send-feedback
Aug 13, 2026
Merged

tustanivsky merged 19 commits into
mainfrom
feat/before-send-feedback

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds a beforeSendFeedback hook to the Unreal SDK, letting applications inspect, enrich, or drop user feedback before it is sent to Sentry. It mirrors sentry_options_set_before_send_feedback (sentry-native) and SentryOptions.setBeforeSendFeedback (sentry-java), handing the handler the feedback event so it can scrub or enrich the whole event.

Key Changes

  • New USentryBeforeSendFeedbackHandler (Blueprintable), exposed via the BeforeSendFeedbackHandler plugin setting and wired through the subsystem callback bundle. The handler receives the feedback event (USentryEvent); return null to drop it, or the (possibly modified) event to send it.
  • New USentryEvent::GetFeedback() returns the feedback carried by a feedback event as a typed USentryFeedback, so handlers can read and modify the feedback fields (message, name, contact email, ...).
  • Native (Windows/Linux/consoles): registers sentry_options_set_before_send_feedback and wraps the event like the beforeSend hook.
  • Android: routes SentryOptions.setBeforeSendFeedback through JNI, wrapping the event like the beforeSend hook; GetFeedback() returns the typed io.sentry.protocol.Feedback.
  • Apple (macOS/iOS): not supported. sentry-cocoa has no before-send-feedback callback and applies scope internally when capturing feedback, so there's no seam to hand the handler a scope-enriched event. The hook is a no-op and logs a warning if one is configured.
  • Sample UCppBeforeSendFeedbackHandler (C++ and Blueprint) plus a feedback-capture integration test (desktop and Android) that verifies delivery, field values, the handler scrubbing the contact email via Event->GetFeedback(), and the associated-event link against live Sentry.

Documentation

Related Items

Introduce USentryBeforeSendFeedbackHandler and wire it through plugin
settings and the subsystem callback bundle so user feedback can be
filtered or modified before being sent. Platform implementations follow.
Register sentry_options_set_before_send_feedback and route it through
USentryBeforeSendFeedbackHandler, mirroring the beforeSend trampoline.
Feedback dropped by the handler is discarded via sentry_value_decref; a
new FGenericPlatformSentryFeedback constructor adopts the callback-provided
value so the handler can read and mutate it in place.
Route SentryOptions.setBeforeSendFeedback through the JNI bridge to
USentryBeforeSendFeedbackHandler: serialize the handler pointer, extract the
Feedback from the SentryEvent in SentryUnrealBeforeSendFeedbackCallback, and
invoke the handler via a new onBeforeSendFeedback native method. Adds an
FAndroidSentryFeedback constructor that wraps an existing Java Feedback.
sentry-cocoa has no feedback filter and its beforeSend callback skips
feedback, so invoke the handler manually at the start of CaptureFeedback,
dropping the feedback when the handler returns null. The handler runs on the
calling thread with the same reentrancy and safety guards as the other Apple
callbacks.
Add a feedback-capture integration test that captures user feedback
associated with an event and verifies it reaches Sentry with the expected
fields. Add UCppBeforeSendFeedbackHandler, registered via an -ini override in
the desktop Pester suite, to exercise the beforeSendFeedback hook end to end:
the handler redacts the contact email, which the test asserts. Bump the
app-runner pin to pull in the Get-SentryFeedback helpers.
sentry-native wraps the user feedback in an event under contexts.feedback
before invoking before_send_feedback, so the callback receives the event, not
the flat feedback value. Read contexts.feedback and hand that to the handler
so its edits land where the feedback is serialized from. Caught by the
feedback-capture integration test, which now passes 8/8.
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 53c25ec

@tustanivsky tustanivsky changed the title Add beforeSendFeedback hook Add beforeSendFeedback hook to filter user feedback Aug 11, 2026
@tustanivsky tustanivsky changed the title Add beforeSendFeedback hook to filter user feedback Add beforeSendFeedback callback for user feedback filtering Aug 11, 2026
Comment thread scripts/packaging/package.snapshot Resolved
…kaging

pack.ps1 rewrites the plugin's raw UPROPERTY handler pointers to TObjectPtr
for UE 5.0+, where native pointer members are disallowed on some targets
(e.g. macOS). The new BeforeSendFeedbackHandler member was missing from that
list, so the packaged plugin failed to build on macOS UE 5.8.
EGuidFormats::DigitsLower was added in UE 5.0, breaking the UE 4.27 build.
Digits is available on all supported engine versions and works the same for
correlating the feedback by its message token.
Use Log verbosity on Linux/UE 4.27 to avoid duplicated log lines, matching the
other integration tests, and pin app-runner to the latest commit carrying the
feedback helpers and the manifest export.

@limbonaut limbonaut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

Match the native and Android SDK callbacks by handing the handler the feedback
event (USentryEvent) instead of a bare feedback object, so handlers can enrich
or scrub the whole event - tags, contexts, message. Native and Android now wrap
the event like the beforeSend hook, and the feedback-value adopt constructors
are no longer needed.
sentry-cocoa has no before-send-feedback callback and applies scope internally
when capturing feedback, so there's no seam to hand the handler a scope-enriched
event. Don't invoke the hook on Mac/iOS and log a warning when one is configured.
Scrub the feedback contact email through the event's feedback context in the
sample C++ and Blueprint handlers, skip the redaction assertion on the cocoa
backend where the hook is a no-op, and pin app-runner to the merged feedback
helpers.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7b66199. Configure here.

Expose the feedback carried by a feedback event through a typed USentryFeedback
so beforeSendFeedback handlers can inspect and modify the feedback fields.
Native reads the feedback context value; Android returns the typed
io.sentry.protocol.Feedback via the JNI bridge; Apple and Null return null. The
generic context API can't serve this on Android, where the feedback context is
a typed object rather than a map.
Scrub the contact email through Event->GetFeedback() in the sample handler, and
add a feedback-capture Context to the Android integration suite so the
typed-Feedback JNI path is covered on device.
@tustanivsky
tustanivsky merged commit af122e2 into main Aug 13, 2026
186 of 191 checks passed
@tustanivsky
tustanivsky deleted the feat/before-send-feedback branch August 13, 2026 06:34
tustanivsky added a commit to getsentry/sentry-docs that referenced this pull request Aug 18, 2026
This PR documents the new `beforeSendFeedback` hook in the Unreal SDK.

## Key Changes

- Adds a "Filtering User Feedback" section to the Unreal filtering
guide.
- Adds a `configuration/before-send-feedback` platform-include showing
how to subclass `USentryBeforeSendFeedbackHandler` and register it via
the settings delegate.

## Related Items

- getsentry/sentry-unreal#1528
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.

2 participants