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
andEpicLinks::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
andEpics::UpdateService
to use the correspondingEpicLinks
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
- Create 2 new epics (child and parent) that have associated work items
- Visit the parent epic and add the second epic as a child
- Visit the corresponding work items and verify that they are not related and contain new system notes
Remove parent from an epic
- Visit the parent epic and remove the linked child
- Verify that corresponding work items reflect this change and contain new system notes
Create epic with a parent
- 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
- 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)