Cadence start date should not be editable after cadence starts
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.
- Create a new group and make sure the feature flag
:iteration_cadences
is disabled in the Rails console:
Feature.disable(:iteration_cadences)
- Visit the newly created group and create a new iteration. Note its start date.
Demo: creating a new iteration
- 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.)
Test with an automatic cadence
-
Create a new cadence after setting its start date to a past date.
-
An error should be returned when attempting to edit the start date after.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.