ActiveRecord::RecordNotUnique when uploading designs
Designs not unique when creating design version.
See: https://sentry.gitlab.net/gitlab/gitlabcom/issues/1566104
This appears to be due to the fact that duplicate design-ids are passed in.
Testing Activity
- Unit test of SaveDesignsService
MR Breakdown
- Either we are getting duplicate filenames in the input list (which we should be validating and raising argument errors about) or for some other reason we are passing duplicate IDs to the version creation method. I would guard both places, in the mutation and in the service, the first with an argument error and the second with a uniq set
- SaveDesignsService should validate that files passed to it have unique file names and produce an error response if not #219113 (comment 354825433)
- We should also handle when
original_filename
s are stripped of special characters #219113 (comment 360806168)
- Investigate if this was caused by race condition, and see if the recent addition of with_lock solves the issue.
Edited by Luke Duncalfe