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:
- Feature requires cookie to be active
- Feature visible to all without needing a cookie
- 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?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a UX Designer -
Has been reviewed by a Frontend maintainer -
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides -
If you have multiple commits, please combine them into a few logically organized commits by squashing them -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)