Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(user-report): Make all fields but event-id optional #886

Merged
merged 8 commits into from
Dec 18, 2020

Conversation

untitaker
Copy link
Member

@untitaker untitaker commented Dec 17, 2020

the exact schema has been really ill-defined, and it appears most SDK devs expect those fields to be optional now. We already store empty strings for all of those fields, so let's just make them all optional.

The "schema" for user report is "defined" is as the set of possible keyword-arguments to the Python model itself. Anything goes that the model constructor accepts. Explicit null was never really supported. Also changing to Option means that we would have to coerce to empty string on serialization precisely to avoid running UserReport(email=None).save() which would violate NotNullConstraint of the database.

@untitaker untitaker requested a review from a team December 17, 2020 14:18
@@ -8,9 +8,15 @@ pub struct UserReport {
/// The event ID for which this user feedback is created.
pub event_id: EventId,
/// The user's name.
// Empty strings are in fact stored in the database already
Copy link
Member

Choose a reason for hiding this comment

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

You can remove those comments.

Should this be Option<String>, instead, to support explicit null?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm just reading the sourcecode of Sentry, but here's what I believe holds:

The "schema" for user report is "defined" is as the set of possible keyword-arguments to the Python model itself. Anything goes that the model constructor accepts. Explicit null was never really supported. Also changing to Option means that we would have to coerce to empty string on serialization precisely to avoid running UserReport(email=None).save() which would violate NotNullConstraint of the database.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, yet, we're designing the ingestion interface here. To keep it consistent with the main event schema, and to not invert expectations, I would prefer to allow null going forward, too.

Copy link
Member

Choose a reason for hiding this comment

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

To add to the above, the API can and must abstract over how database access is or used to be handled in Sentry. This may change any time, and now that it occurs in a separate code base, we're no longer bound by implicit behavior that improperly tested code used to expose accidentally.

CHANGELOG.md Show resolved Hide resolved
@untitaker untitaker merged commit 08c0d57 into master Dec 18, 2020
@untitaker untitaker deleted the fix/userreport-schema branch December 18, 2020 08:55
jan-auer added a commit that referenced this pull request Dec 18, 2020
* master:
  feat: Enable use of multiple value types per field (#882)
  fix(user-report): Make all fields but event-id optional (#886)
  release: 20.12.1
  release: 20.12.0
  ci(release): Move to getsentry/publish for releases (#885)
  meta: Fix CODEOWNERS (#884)
  fix: Also build rdkafka with ssl if ssl feature is enabled (#881)
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