mozilla / code-review

Automated static analysis & linting bot for Mozilla repositories
Mozilla Public License 2.0
56 stars 42 forks source link

Bulk issues creation does not lookup existing hashes #2474

Open La0 opened 2 hours ago

La0 commented 2 hours ago

The bulk issues creation endpoint does not currently lookup for pre-existing issues with same hashes.

We can see some duplicate issues trigger a 500 on testing

I thought this was covered in the recent changes, but apparently we do not have a test case re-publishing issues with the same hash.

We need to:

  1. add a unit test that hit the issues publication endpoint twice:
    • once with issue A & B (should have no problem)
    • second time with issue A & C (it should crash on master)
  2. replace Issue.objects.bulk_create in IssueBulkSerializer by a loop using Issue.objects.get_or_create
La0 commented 2 hours ago

Another test should also be done with the same issue hash in the same API call