Skip to content

Sync epic child reordering via REST api

What does this MR do and why?

Related to #455635 (closed)

When reordering child epics using EpicLinks::UpdateService the associated work items should be synced to the same relative position.

The conditions for the syncing are:

  • the feature flag sync_epic_to_work_item is enabled
  • The parent and child epic have synced work items that are as related (with a WorkItems::ParentLink record)
  • When move_after_id or move_before_id epics are provided, these also have a synced work item with the corresponding link to the parent

MR acceptance checklist

Screenshots or screen recordings

The changes in this MR are tested using the REST endpoint for reordering a child epic: PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id. We cannot use the UI to replicate the changes because this uses a different endpoint.

Screen_Recording_2024-04-17_at_18.43.02

How to set up and validate locally

  1. Enable feature flags sync_epic_to_work_item and sync_epic_work_item_order
  2. Create one epic Parent using the URL http://gdk.test:3000/groups/GROUP_PATH/-/epics/new
  3. Create 3 more epics Child 1, Child 2 and Child 3 using the same URL from above
  4. Go to epic Parent by visiting http://gdk.test:3000/groups/GROUP_PATH/-/epics/PARENT_IID and add 3 new epics as children: Child 3, Child 2 and Child 1
  5. Verify that the corresponding work item have also 3 children in the same order (use URL http://gdk.test:3000/groups/GROUP_PATH/-/work_items/EPIC_A_IID)
  6. Create an access token with API access and test the following request
export PAT=<access_token>

curl -X PUT -H "Authorization: Bearer $PAT" -d move_before_id=CHILD_2_ID -d move_after_id=CHILD_3_ID http://127.0.0.1:3000/api/v4/groups/GROUP_PATH/epics/PARENT_IID/epics/CHILD_1_ID
  1. Reload the PARENT epic and work item and verify that Child 2 was moved before and Child 3 was moved after the Child 1
Before reordering After reordering
Child 1 Child 2
Child 2 Child 1
Child 3 Child 3
Edited by Eugenia Grieff

Merge request reports