Skip to content

Status deletion sets old status role in mapping

What does this MR do and why?

Status deletion sets old status role in mapping

Old status role needs to be set in mappings so we can include items without a current status record in lists filtered by a status.

This is a follow up from !207735 (comment 2808985452)

We're adding old_status_role to the attach service, but should we also do this to the #process_status_with_mapping method in BaseService?

I think it would also be needed there when we allow deletion of default statuses with mapping.

References

  1. Handle items without current_status by mapping (#572551)

Screenshots or screen recordings

How to set up and validate locally

  1. Enable work_item_status_mvc2 feature flag

  2. Create a new group

  3. Go to the issues settings page and delete the "To do" status which is marked as default.

  4. Select "In progress" as new status and new open default

  5. Open the console and check for the newest mapping that was created:

    WorkItems::Statuses::Custom::Mapping.last
  6. The output should look somewhat like this and set old_status_role to open

    [1] pry(main)> WorkItems::Statuses::Custom::Mapping.last
    WorkItems::Statuses::Custom::Mapping Load (0.8ms)  SELECT "work_item_custom_status_mappings".* FROM "work_item_custom_status_mappings"
      ORDER BY "work_item_custom_status_mappings"."id" DESC LIMIT 1 
    => #<WorkItems::Statuses::Custom::Mapping:0x000000031f8f3ac8
     id: 81,
     namespace_id: 150,
     old_status_id: 264,
     new_status_id: 260,
     work_item_type_id: 5,
     valid_from: nil,
     valid_until: nil,
     created_at: Thu, 09 Oct 2025 18:02:07.289789000 UTC +00:00,
     updated_at: Thu, 09 Oct 2025 18:02:07.289789000 UTC +00:00,
     old_status_role: "open">

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 Marc Saleiko

Merge request reports

Loading