Skip to content

Cadence start date should not be editable after cadence starts

euko requested to merge 354977-cadence-start-date into master

What does this MR do and why?

An iteration cadence (cadence for short) is a container for iterations - often called sprints outside GitLab - and a group may have multiple cadences, one for each team under the group. A cadence automatically schedules new iterations based on its settings. In this MR, we want to update the cadence model so that the start date of a cadence cannot be changed once the cadence has started. The feature changes made in this MR are all behind :iteration_cadences FF which has not been defaulted.

To implement the above requirement, we are making the following changes (partially resolves #354977 (closed).)

  • Introduce new validations to Iterations::Cadence model to check start date on an update.
  • Use the start date of the first iteration as the cadence start date when a manual cadence is converted.
  • Document the updated behavior as well as the existing behaviors.
  • Update the cadence-related service specs to work with the updated cadence model. The service class themselves have not been changed. I refactored some existing specs for clarity.

How to set up and validate locally

Prepare a manual cadence and test its conversion

Currently iterations are directly scoped to groups rather than to cadences when the FF :iteration_cadences is disabled. When the FF is enabled, any existing iterations become grouped under a special cadence. We call this cadence a manual cadence because users have to manually manage (add/remove) iterations in the cadence. A manual cadence can be converted to use automated iterations scheduling. When the conversion is done, we want to make sure the start date of the cadence is set to the start date of its first iteration.

  1. Create a new group and make sure the feature flag :iteration_cadences is disabled in the Rails console:
Feature.disable(:iteration_cadences)
  1. Visit the newly created group and create a new iteration. Note its start date.

Demo: creating a new iteration

Screen_Recording_2022-05-02_at_3.35.03_PM

  1. Now enable the feature flag :iteration_cadences and revisit the Iterations page

(don't refresh the page. Rather visit the group home page and navigate via the sidebar menu.)

You will see that the iteration is now placed under an iterations cadence. Try to convert the cadence to use automated scheduling and confirm that the cadence start date is set to the start date of its first iteration (in most cases, manual cadences should've been created with the correct start dates in the first place.)

Demo

Screen_Recording_2022-05-02_at_3.39.48_PM

Test with an automatic cadence

  1. Create a new cadence after setting its start date to a past date.

  2. An error should be returned when attempting to edit the start date after.

Demo

Screen_Recording_2022-05-02_at_3.46.43_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by euko

Merge request reports

Loading