Ensure legacy Epic dates have same values from its related WorkItem

What does this MR do and why?

Roadmap relies on Epic API and we plan to move it to use Work Item API as a part of #478011, but until that the expectation is that there is no significant mismatch of data between both the APIs especially because other attributes of Epics are consistent between old and new experience.

To fix that, we're presenting the Epic dates with the WorkItem logic.

To ensure compatibility, we're also updating the REST API to return the same values as the GraphQL API.

Changelog: fixed

References

Related to: #514066 (closed)

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.

Screenshots or screen recordings

For existing Epics that had different fixed/inherited values between start/due dates, we follow the rules on WorkItems UI/API to decided if the dates are fixed/inherited, example:

epic-after.png

Before After

Legacy view

epic-before.png

Legacy view (side effect)

epic-after-legacy.png

roadmap-before.png

roadmap-after.png

How to set up and validate locally

EE license required.

  1. Create or use an existing group
  2. Create Epic E1 with fixed dates: start date 01/01/2025 and due date 31/01/2025
  3. Create Epic E2 as child of E1, with fixed dates: start date 10/01/2025 and due date 15/01/2025
  4. Open Epic E1 and change dates to inherited (you should see E2 dates)
  5. Open rails console and update E1 to have just the due date as fixed:
e1 = Group.find_by(path: <YOUR GROUP>).epics.find_by(title: 'E1')
e1.update(due_date_is_fixed: true)
e1.work_item.dates_source.update(due_date_is_fixed: true)
  1. After that, you can check on E1 (using ?force_legacy_view=true at the end of the URL) that only due date will be fixed, but start date will be inherited. This is not possible on the (new way) WorkItem.
  2. The roadmap on E1 will show
    1. without the fix: start date 10/01/2025 and due date 31/01/2025
    2. with the fix: start date 01/01/2025 and due date 31/01/2025

GraphQL query for test

query groupEpics {
  group(fullPath: <GROUP PATH>) {
    epics(iid: <EPIC IID>) {
      nodes {
        id
        title
        startDate
        startDateFixed
        startDateIsFixed
        dueDate
        dueDateFixed
        dueDateIsFixed
      }
    }
  }
}

REST test (using jq)

curl --silent --location --header 'PRIVATE-TOKEN: <ACCESS TOKEN>' --url http://gdk.test:3000/api/v4/groups/<GROUP PATH>/epics/<EPIC IID> | jq '{id, title, start_date, start_date_fixed, start_date_is_fixed, due_date, due_date_fixed, due_date_is_fixed}'
Edited by Kassio Borges

Merge request reports

Loading