Some Issues believe they were closed BEFORE they were created
Summary
In both Production and Staging there are Issue
records that claim to have been closed BEFORE they were created. For example, consider Issue 7221343 in Staging:
- created_at 2019-05-06 16:40:09 UTC
- closed_at 2016-03-11 03:45:40 UTC (3 years before it was created!)
Steps to reproduce
In Rails console for Production or Staging: Issue.where('created_at > closed_at').count
What is the current bug behavior?
created_at > closed_at
What is the expected correct behavior?
created_at < closed_at
Relevant logs and/or screenshots
This problem was encountered during code review for MR !16775.
Output of checks
This bug happens on GitLab.com. There are 625 records affected in Production, at least as recently as 2019-07. There are 3 records affected in Staging, as recently as 2019-05-06. Staging represents a 2-year-old snapshot of Production, so it seems this problem has become much more common over time.
Possible fixes
- This problem seems to be related to importing issues in a "closed" state (based on the 3 records in Staging, so this is just a hunch).
- Adding a validation to
Issue
could help expose the bug, but would only be necessary if we can't identify the bug in troubleshooting.
Edited by Dan Jensen