Skip to content

Fix non-custom Total stage in VSA

Adam Hegyi requested to merge fix-vsa-total-stage into master

What does this MR do?

This MR fixes the uneditable non-custom Total stage in value stream analytics. The Total stage was removed from VSA a few releases ago thus we need to make sure that the persisted Total stages have the custom flag set to true.

After checking the production DB, we have 3 occurrences of this bug, so we expect 3 record updates only.

How to reproduce it:

  1. Go to https://gitlab.com/groups/gitlab-org/-/analytics/value_stream_analytics
  2. Select 'default' from the dropdown.
  3. Click the "Edit" button.
  4. Scroll down and notice the "Total" stage is not editable.

Migration

UP

== 20210601073400 FixTotalStageInVsa: migrating ===============================
== 20210601073400 FixTotalStageInVsa: migrated (0.0116s) ======================

DOWN

== 20210601073400 FixTotalStageInVsa: reverting ===============================
== 20210601073400 FixTotalStageInVsa: reverted (0.0000s) ======================

Queries

The table contains 2000 rows and we expect to update 3 rows only.

EachBatch query:

SELECT "analytics_cycle_analytics_group_stages"."id"
FROM "analytics_cycle_analytics_group_stages"
WHERE "analytics_cycle_ana
lytics_group_stages"."id" >= 2167
ORDER BY "analytics_cycle_analytics_group_stages"."id" ASC
LIMIT 1
OFFSET 100;

Plan: https://explain.depesz.com/s/zPng

Update query:

UPDATE "analytics_cycle_analytics_group_stages"
SET "custom" = TRUE
WHERE "analytics_cycle_analytics_group_stages"."id" >= 1745
  AND "analytics_cycle_analytics_group_stages"."id" < 1901
  AND "analytics_cycle_analytics_group_stages"."name" = 'Total'
  AND "analytics_cycle_analytics_group_stages"."custom" = FALSE;

Plan: https://explain.depesz.com/s/Ssl8

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Adam Hegyi

Merge request reports

Loading