Add date range validation to work item status mappings
What does this MR do and why?
Add date range validation to work item status mappings
- Removes unique constraint. This was a previous assumption when we didn't have valid_from and valid_until dates. It technically only allowed one mapping per old_status. But since this is not the case any more I removed it again.
- Adds new index for namespace_id.
- Add valid_from and valid_until date fields to status mappings
- Implement no_overlapping_date_ranges validation to prevent conflicting mappings
- Add comprehensive test coverage for date range overlap scenarios
- Support sequential mappings with gaps (A→B until yesterday, A→C from today)
- Prevent overlapping ranges while allowing legitimate temporal transitions
- Handle nil dates as unbounded ranges (open-ended mappings)
- Maintain O(1) lookup performance with request-scoped caching
The validation ensures data integrity by preventing overlapping date ranges for the same [old_status_id, work_item_type_id, namespace_id] combination while supporting complex temporal status mapping scenarios.
References
Screenshots or screen recordings
backend only
How to set up and validate locally
Model validations only. See tests or use console.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.