Skip to content

Fix forever-disabled VSA aggregations

What does this MR do and why?

Group-level value stream analytics uses a model to keep track of the aggregation progress: Analytics::CycleAnalytics::Aggregation

Problem:

When a group is being aggregated in the background, first we check the license. If the license is missing, then the aggregation is disabled (happens when the group downgrades). When a group upgrades again, the aggregation is not going to be enabled automatically.

Fix:

Whenever the user visits a VSA page, we call the safe_create_for_namespace to ensure that the aggregation record is created. The method call always happens after the license check. We can re-enable the aggregation by modifying the safe_create_for_namespace where we explicitly set enabled to true.

How to set up and validate locally

# create an aggregation, and disable it
agg = create(:cycle_analytics_aggregation, enabled: false, namespace: Group.first)
Analytics::CycleAnalytics::Aggregation.safe_create_for_namespace(Group.first)

agg.reload.enabled? # should return true

MR acceptance checklist

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

Merge request reports