Skip to content

Sync epic and work item parents

What does this MR do and why?

Related to Sync epics parent_id and relative position to w... (#434533 - closed)

For the process of migrating epics to work items every epic will have an associated work item with its data kept in sync. This MR handles the syncing of the parent association.

Summary of changes:

  • Modify EpicLinks::CreateService and EpicLinks::DestroyService so that when an epic parent is added or removed the change is reflected in the associated work item (if present)
  • Skip system notes and resource events creation with updating the synced work item parent
  • Modify Epics::CreateService and Epics::UpdateService to use the corresponding EpicLinks service when the parent param is present, similarly to how it's done for changing the parent using quick action.

Note that syncing relative position when reordering children is pending and will be addressed in a follow-up.

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

Add parent to an epic

  1. Create 2 new epics (child and parent) that have associated work items
  2. Visit the parent epic and add the second epic as a child
  3. Visit the corresponding work items and verify that they are not related and contain new system notes

add_parent_to_existing_epic

Remove parent from an epic

  1. Visit the parent epic and remove the linked child
  2. Verify that corresponding work items reflect this change and contain new system notes

remove_parent_from_epic

Create epic with a parent

  1. Fetch a user personal access token and use the following request to create an epic with a parent (replace group path)
export ROOT_PAT=<access_token>
export PARENT_ID=<parent_epic_id>

curl -X POST -H "Authorization: Bearer $ROOT_PAT" -d title=child -d parent_id=$PARENT_ID http://127.0.0.1:3000/api/v4/groups/group-c/epics
  1. Verify that a new epic with a work item was created and that both are linked to the correct parent

Repeat with the FF epic_creation_with_synced_work_item disabled and verify that it works as expected (the associated work item is not linked to a parent)

Edited by Eugenia Grieff

Merge request reports