Skip to content

feat: Add BeforeSendFeedback callback to inspect, modify, or drop user feedback before it's sent#5361

Open
vladbrincoveanu wants to merge 3 commits into
getsentry:mainfrom
vladbrincoveanu:feat/4092-before-send-feedback-y
Open

feat: Add BeforeSendFeedback callback to inspect, modify, or drop user feedback before it's sent#5361
vladbrincoveanu wants to merge 3 commits into
getsentry:mainfrom
vladbrincoveanu:feat/4092-before-send-feedback-y

Conversation

@vladbrincoveanu

@vladbrincoveanu vladbrincoveanu commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Refers to #4092

Summary

Adds a BeforeSendFeedback callback to SentryOptions, mirroring the existing BeforeSend pattern but scoped to user feedback events. It lets applications inspect, modify, or drop user feedback before it is sent to Sentry.

Changes

  • Two SetBeforeSendFeedback overloads on SentryOptions (with and without SentryHint), consistent with SetBeforeSend / SetBeforeSendTransaction.
  • SentryEventHelper.DoBeforeSendFeedback, invoked in SentryClient.CaptureFeedback after event processors run.
  • New CaptureFeedbackResult.DroppedByBeforeSendFeedback result value
  • Dropped feedback is recorded via ClientReportRecorder under DiscardReason.BeforeSend / DataCategory.Feedback. Originally, was specified the use of DataCategory USER_REPORT_V2.
    [SDK docs] add new UF data model and implementation details under telemetry dev docs sentry#88232 (comment)

Behavior notes for reviewers

Assumption: Feedback is a common place to scrub PII, so a callback that cannot complete should not leak partially-scrubbed or unintended feedback.
Implementation: Both the null-return and throw paths record a client-report discard. This is documented on the public API and covered by tests.

Tests

SentryClientTests covers: callback invocation + mutation passthrough, hint received from caller, null and throw drops feedback.

Unrelated changes

Added a small unit test for CaptureFeedbackResult.UnknownError.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.19%. Comparing base (4b51c11) to head (7bbbb1c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5361      +/-   ##
==========================================
+ Coverage   74.14%   74.19%   +0.04%     
==========================================
  Files         509      509              
  Lines       18386    18409      +23     
  Branches     3600     3603       +3     
==========================================
+ Hits        13633    13658      +25     
+ Misses       3880     3879       -1     
+ Partials      873      872       -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

vladbrincoveanu and others added 3 commits July 9, 2026 12:40
…r feedback before it's sent

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…semantics

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vladbrincoveanu vladbrincoveanu force-pushed the feat/4092-before-send-feedback-y branch from 1f51fe2 to 7bbbb1c Compare July 9, 2026 10:40
@vladbrincoveanu vladbrincoveanu marked this pull request as ready for review July 9, 2026 12:10
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant