Skip to content

Replace vsa stage slug with id

What does this MR do?

Ensures we use the stage id field when fetching value stream stage data, previously we would use the title field for default stages since they were not persisted and had no id, but we should switch to the id even though for default stages the id is a string.

This was causing an issue with fetching value stream data when a user had changed their language from English, as the translated stage name would be picked up as the stage id.

Background

Initially we only had a single default value stream configuration which was hard-coded on the frontend, this was a pretty basic configuration with all the data returned from a single endpoint. Over time, we've:

  • Added the ability to create custom value streams
  • Moved some calculations / values to individual endpoints to improve load time / db queries

The default value stream configuration stuck around for a while and worked in conjunction with the custom value streams, because custom value streams were persisted in the db, stages associated with the value stream would have ids which we could use to query our endpoints, but for the default stream stages, we would use the name/title of the stage as an id for querying.

We eventually moved the default value stream configuration to the backend and fetch it when loading the page, at the same time we applied the users language preference to the descriptions / naming of the stage, which results in the titlefield being returned in the user's language. Additionally stages provided from the backend now have anid` field (which is still the english name of the stage), so we can now remove all the additional code we added to determine if the stage is a default stage or custom stage.

Screenshots or Screencasts (strongly suggested)

Before After
Screen_Recording_2021-09-08_at_4.40.18_pm Screen_Recording_2021-09-08_at_4.49.13_pm

How to setup and validate locally (strongly suggested)

Group VSA seeding instructions

  1. Ensure you have an EE license, or stub the cycle_analytics_for_groups license feature to true

  2. Create a group

  3. Create a project within a group (make sure to initialize the project with a readme, or create it from a template)

  4. Seed some test VSA data

    $ VSA_SEED_PROJECT_ID=<project-id> VSA_ISSUE_COUNT=10 SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
  5. Change your language preference in profile preferences - for example German

  6. Navigate to value stream analytics for the group, ie for a project named clean-vsa-project in group new-vsa-group it would be http://<gdk>/group/:group_id/-/analytics/value_stream_analytics (or find it in the left menu)

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 Ezekiel Kigbo

Merge request reports

Loading