Add application limits to value stream analytics
Problem statement
The paid Value Stream Analytics feature currently doesn't limit the maximum number of stages and value streams within the group or project. Later, this can lead to slow page load times because our endpoints (value streams, stages) are not paginated.
Adding pagination increases complexity, which we probably won't need for most of the time. Usually, we don't expect more than a few value streams and stages per group so we could introduce Application Limits to ensure that outlier groups/projects won't cause problems in the future.
How
Add model level validations to the Analytics::CycleAnalytics::ValueStream
and the Analytics::CycleAnalytics::Stage
models which checks the number of records for the given namespace or value stream.
-
ValueStream
(number of records per group): maximum 50 -
Stage
(number of records per value stream): 15
The validations will ensure that the number of records will not grow too high. For existing groups with too many stages, we won't allow creating new records.
Ensure that the validation message is clear and visible on the FE, example: "The number of stages within the value stream is over the maximum allowed limit (15). You may create a new value stream for this stage or you could remove an unused stage within the current value stream.