Skip to content

Add Uniqueness Validation & Change SentryIssueFinder to be Deterministic

What does this MR do?

This MR solves 2 problems:

  1. We realized that we cannot validate against sentry_issue_identifer and removed that validation because users may hook up multiple instances and it is an incrementing id but we still only want users to create one gitlab_issue from a single sentry issue.

  2. Since it is possible to have duplicate sentry_issue_identifer's per project (based on the validation being removed and no db constraint) we want to make sure the SentryIssueFinder is deterministic and selects the most recent associated issue.

Resolves #196808 (closed)

Technical Implementation

This adds a custom application level validation of sentry_issue_identifer scoped to the project_id and then makes sure that in all places where we find a sentry issue we use the most recent record that can be found based on sentry_issue_identifer and project_id (this is because it is possible that we have 2 records for a given sentry_issue_identifer and project_id already).

As background, we originally considered adding project_id to the sentry_issues table so that the SentryIssueFinder could avoid a join on issues(a larger table than projects) and to enable the use of scope in the validation. We decided not to provide the potentially pre-mature optimization of adding project_id.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Allison Browne

Merge request reports