Skip to content

Adds new unchecked free indicator variant

What does this MR do and why?

Adds a new unchecked free indicator variant to the new project sast enabled experiment.

This is to create parity with the unchecked candidate variant, and will help identify which of the (now) 4, performs the best given all the other indicators and concerns.

It also fixes a bug that we're seeing with the changes to how we did the element nesting. This is (I believe) now captured in gitlab-org/ruby/gems/gitlab-experiment#57, and we can try to address that now that we've noticed that elements provided within the experiment block aren't being rendered "around" the variant blocks. I think we should capture the content from both of these blocks.

Tests: This is tested, by two feature tests in https://gitlab.com/gitlab-org/gitlab/-/blob/da5bc97c47a59c331318a720247a2bcd017cfef4/spec/features/projects/user_creates_project_spec.rb#L37 and https://gitlab.com/gitlab-org/gitlab/-/blob/da5bc97c47a59c331318a720247a2bcd017cfef4/spec/features/projects/user_creates_project_spec.rb#L60. It currently only tests the candidate(s) though, and I don't think we get a lot of value in exchange for the cost of testing both free variants, so haven't done that here.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Enable the experiment
    Feature.enable(:new_project_sast_enabled)
  2. Assign the variants you want to, for your test user (assuming root is your test user)
    include Gitlab::Experiment::Dsl
    experiment(:new_project_sast_enabled, :control, user: User.first) # no checkboxes should be visible
    experiment(:new_project_sast_enabled, :candidate, user: User.first) # checkbox should be visible and checked
    experiment(:new_project_sast_enabled, :free_indicator, user: User.first) # checkbox should be visible and checked, and you should have a label indicating that it's free if you check it
    experiment(:new_project_sast_enabled, :unchecked_candidate, user: User.first) # checkbox should be visible and unchecked
    experiment(:new_project_sast_enabled, :unchecked_free_indicator, user: User.first) # checkbox should be visible and unchecked, with the free label
  3. Create a new blank project.

MR acceptance checklist

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

Edited by Jeremy Jackson

Merge request reports