Skip to content

Fix status mapping evaluation for non-persisted current status records

What does this MR do and why?

When a work item doesn't have a current status record (all work items created before the MVC1 release of configurable statuses in %18.2), they fall back to lifecycle's default status through a non-persisted CurrentStatus record using the status_with_fallback method.

This caused ArgumentError when find_mapped_status tried to compare nil updated_at with mapping's valid_until timestamp.

This MR sets updated_at to work item's created_at when building fallback current status records to support time-constrained status mapping evaluations.

This is consistent with existing filtering logic that compares mapping timestamps to issues.created_at.

Notes

  • The issue started occurring in %18.6, after the deployment of !208414 (merged).
  • This bug only affects the feature in %18.6, so no backports are required.

References

Screenshots or screen recordings

Before After
Screenshot_2025-10-23_at_2.06.18_pm Screenshot_2025-10-23_at_2.07.12_pm

How to set up and validate locally

  1. Create a new group, project, and two issues.
  2. Delete the current status record from the last issue via the Rails console: WorkItem.last.current_status.delete.
  3. In the issues settings page (/groups/group-23-10/-/settings/issues), create a new status called New default.
  4. Delete the existing To do status, map it to New default, and set New default as the default open status.
  5. Re-add the To do status and make it the default again.
  6. Navigate to the group or project work items list.
  7. Before the fix: Expect to see the 'Something went wrong' error when fetching work items.
  8. After the fix: The work item list and drawer should load without issues.

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

Merge request reports

Loading