Skip to content

Update task iteration when parent iteration gets updated

What does this MR do and why?

This update enhances how iterations work with parent-child work item relationships. The main change allows iteration assignments to cascade from parent work items to their children automatically. When a parent work item's iteration is changed, all child work items that were in the previous iteration will now be updated to match the parent's new iteration.

The code adds tracking for these automated changes by:

  1. Adding new database columns to record when iteration changes are automated
  2. Storing which parent work item triggered the change
  3. Improving the display of these changes in the UI by showing messages like "changed iteration to #123 (closed) on this item and parent item"

The implementation includes database migrations, new scopes to find work items with specific widget types, and callback logic to handle the cascading updates efficiently in batches.

All the changes are under a Feature Flag. The plan is to enable the FF for all gitlab.com and monitor the performance.

Database

For querying the issues in order to get all the descendants that we need to update, we are using .each_batch method. The each batch method will run the bellow queries(the limit is the default)

  1. fetch the 1st ID of the loop
  1. fetch the last ID of the loop
  1. fetch the issues

As we the batch size is 100, we will update the sprint_id for 100 of the descendants, it will execute this query

And for creating 100 resource_iteration_events, it will execute this query:

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

In order to test it locally. Create a new work item(issue) and create some(1-2) task for the issue. Add an iteration to the issue, the task should also get's an update with the same iteration. The tasks will get updated only when they are open and if the iteration is matching with the issue, including empty iterations.

Note: the tasks will not get updated in the issue show page, you need to open the task in a separate view to see the change and the note.

Edited by Stefanos Xanthopoulos

Merge request reports

Loading