Skip to content

Create a cookie restriction that can be lifted using feature flags

Context

We'd like to explore more feature flag driven development, allowing us to merge sooner try the feature behind a flag and then use feature flags to release things when we are happy with them. This should help us move away a culture of large MRs that introduce significant change close to a feature freeze.

What

Provides a CookieRestriction helper we can use to hide features as we develop and polish them, and allows us to lift the cookie restriction using a feature flag.

There are three possible states when using a cookie restriction:

  1. Feature requires cookie to be active
  2. Feature visible to all without needing a cookie
  3. Feature completely disabled

This helper toggles between states (1) and (2), but we could later extend it to also create a flag for (3)

Example:

if CookieRestriction.new(:my_feature).active?(cookies)
  # Include some feature
end

Why

Being able to use a feature flag to lift the cookie restriction de-couples the cookie restriction from the release process and frees us from needing an exception request for that.

Todo

  • Inquire about default state for feature flags
  • Include documentation with examples, and outline process for using these as well as for eliminating dead code and dead feature flags.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/48427

Edited by James Edwards-Jones

Merge request reports