Fix work item status fallback to use lifecycle-aware default
What does this MR do and why?
When work items lack a current status record, they were incorrectly falling back to the system-defined default status (open/closed/duplicated) even when a namespace transitioned to using custom lifecycles and statuses.
This MR updates the status_with_fallback method to:
- Fetch the appropriate lifecycle for the work item's root namespace
- Implement SafeRequestStore caching for performance optimization
- Handle both custom and system-defined lifecycles properly
Notes
- When filtering by status, we also need to make sure that work items without a current status are filtered correctly. The fix will be addressed via a separate issue.
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Enable the
work_item_status_mvc2feature flag. - Create a new group and project.
- Create a few issues and assign the
Donestatus to them. - Delete the current status record from the last issue:
WorkItem.last.current_status.delete. - Navigate to the issues settings page.
- Add a new status named
New defaultunder theDonecategory. - Mark
New defaultas the default closed status. - Navigate to the issues list page.
- Before the fix: The issue without a current status referenced an incorrect
Donestatus. - After the fix: The issue without a current status correctly references the default status
New default.
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.
Edited by Agnes Slota

