Skip to content

feat: add feedback api#1033

Open
zmitchell wants to merge 1 commit intogetsentry:masterfrom
zmitchell:zmitchell/add-feedback
Open

feat: add feedback api#1033
zmitchell wants to merge 1 commit intogetsentry:masterfrom
zmitchell:zmitchell/add-feedback

Conversation

@zmitchell
Copy link
Contributor

Description

Implements the plumbing for the User Feedback API.

Issues

Reminders

Copy link

@cursor cursor bot left a comment

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.

timestamp: SystemTime::now(),
contexts: map,
..Default::default()
}
Copy link

Choose a reason for hiding this comment

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

Feedback event missing required type field

High Severity

The to_new_event method constructs a feedback Event but doesn't set r#type to Some("feedback".to_string()). The PR specifically added a type field to the Event struct for this purpose, but the ..Default::default() fallback leaves it as None, so it won't be serialized. Per the Sentry protocol, feedback event payloads require "type": "feedback" for the backend to correctly identify and process them as feedback rather than regular error events.

Additional Locations (1)
Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 8.00000% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.63%. Comparing base (a57b91c) to head (b9864a9).
⚠️ Report is 44 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1033      +/-   ##
==========================================
- Coverage   73.81%   73.63%   -0.18%     
==========================================
  Files          64       66       +2     
  Lines        7538     7582      +44     
==========================================
+ Hits         5564     5583      +19     
- Misses       1974     1999      +25     

Comment on lines +28 to +38
map.insert("feedback".to_string(), self.to_context());
map
};
Event {
event_id: random_uuid(),
level: Level::Info,
timestamp: SystemTime::now(),
contexts: map,
..Default::default()
}
}
Copy link

Choose a reason for hiding this comment

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

Bug: The to_new_event() function for feedback events fails to set the r#type field, causing them to be processed incorrectly by Sentry.
Severity: HIGH

Suggested Fix

In the to_new_event function, explicitly set the r#type field on the Event struct to Some("feedback".to_string()) to ensure the event is correctly categorized by the Sentry backend.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: sentry-types/src/protocol/feedback.rs#L25-L38

Potential issue: The `to_new_event()` method in `sentry-types/src/protocol/feedback.rs`
creates an `Event` from user feedback but fails to set the `r#type` field. The event is
initialized with `..Default::default()`, which sets the `r#type` field to `None`. Due to
the `skip_serializing_if = "Option::is_none"` attribute, this field is omitted from the
serialized JSON payload sent to Sentry. As a result, the Sentry backend will not
correctly identify the event as a feedback event, causing it to appear as an "unlabeled
event" and not be displayed in the User Feedback section, which defeats the purpose of
the feature.

Did we get this right? 👍 / 👎 to inform future reviews.

@szokeasaurusrex
Copy link
Member

Hi @zmitchell, thank you for the pull request.

Before I do a full review, please check and resolve (or mark as irrelevant) all of the comments from AI reviewers. Also, please add a changelog entry for these changes. Thanks! 🙏

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.

Implementing a capture_feedback function

2 participants