Skip to content
Snippets Groups Projects

Ignore `default_enabled` value in `Feature.enabled?` [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Merged Vitali Tatarintev requested to merge ck3g-drop-default_enabled-from-Feature-enabled into master
3 unresolved threads

What does this MR do?

Contributes to #271275 (closed)

Ignores default_enabled argument in Feature.enabled?. Takes default_enabled value from the feature flag definition file instead. That should ensure that everything works as expected without default_enabled argument.

As a side note, default_enabled argument value is always in sync with the default_enabled value in the YAML definition file. We cannot even set the argument value to be different from the one specified in the YAML file.

To make the MR smaller and enable ability to remove default_enabled from Feature.enabled? calls in chunks, I think we can make the following changes separately.

The only part I'm not sure about is either should we update the docs now to mention that the argument it ignored, or leave it till we change the docs after removing default_enabled argument completely.

Follow-up changes

  • Remove default_enabled from Feature.enabled? calls
  • Remove default_enabled argument from Feature.enabled?
  • Remove default_enabled from Feature::Definition.valid_usage!
  • Updated docs: Remove mentions of default_enabled
  • Add a changelog entry (?)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] 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 Mayra Cabrera

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 🤖 GitLab Bot 🤖
  • added 1 commit

    • 092d9435 - Adjust feature flag related tests

    Compare with previous version

  • Vitali Tatarintev changed the description

    changed the description

  • added 3 commits

    • d89553bd - Ignore default_enabled arg in Feature.enabled?
    • f804f200 - Add missing feature flag definition files
    • bb78e5c1 - Adjust feature flag related tests

    Compare with previous version

  • Vitali Tatarintev changed title from WIP: Remove default_enabled in Feature.enabled? [RUN ALL RSPEC] [RUN AS-IF-FOSS] to WIP: Ignore default_enabled value in Feature.enabled? [RUN ALL RSPEC] [RUN AS-IF-FOSS]

    changed title from WIP: Remove default_enabled in Feature.enabled? [RUN ALL RSPEC] [RUN AS-IF-FOSS] to WIP: Ignore default_enabled value in Feature.enabled? [RUN ALL RSPEC] [RUN AS-IF-FOSS]

  • Vitali Tatarintev changed the description

    changed the description

  • Vitali Tatarintev changed the description

    changed the description

  • added groupsource code label and removed grouprespond label

  • added grouprespond label and removed groupsource code label

  • Vitali Tatarintev changed milestone to %13.11

    changed milestone to %13.11

  • Vitali Tatarintev changed the description

    changed the description

  • Vitali Tatarintev mentioned in merge request !57215 (merged)

    mentioned in merge request !57215 (merged)

  • Vitali Tatarintev mentioned in merge request !57217 (merged)

    mentioned in merge request !57217 (merged)

  • Vitali Tatarintev added 468 commits

    added 468 commits

    Compare with previous version

  • Vitali Tatarintev
  • Vitali Tatarintev marked this merge request as ready

    marked this merge request as ready

  • assigned to @eurie

  • Vitali Tatarintev requested review from @eurie

    requested review from @eurie

  • Ethan Urie approved this merge request

    approved this merge request

  • Ethan Urie assigned to @mayra-cabrera and unassigned @eurie

    assigned to @mayra-cabrera and unassigned @eurie

  • Ethan Urie requested review from @mayra-cabrera and removed review request for @eurie

    requested review from @mayra-cabrera and removed review request for @eurie

  • Mayra Cabrera
  • Mayra Cabrera
  • Mayra Cabrera removed review request for @mayra-cabrera

    removed review request for @mayra-cabrera

  • Vitali Tatarintev added 687 commits

    added 687 commits

    Compare with previous version

  • assigned to @mayra-cabrera and unassigned @ck3g

  • product intelligence spec/requests/api/usage_data_spec.rb LGTM as this is a simple specs fix.

  • Mayra Cabrera changed the description

    changed the description

  • Mayra Cabrera approved this merge request

    approved this merge request

  • Mayra Cabrera resolved all threads

    resolved all threads

  • Mayra Cabrera enabled an automatic merge when the pipeline for 0e149428 succeeds

    enabled an automatic merge when the pipeline for 0e149428 succeeds

  • @ck3g Thanks! This LGTM from backend, MWPS set :rocket:

  • merged

  • Mayra Cabrera mentioned in commit 0767b9e2

    mentioned in commit 0767b9e2

  • Vitali Tatarintev mentioned in merge request !52486 (closed)

    mentioned in merge request !52486 (closed)

  • Peter Leitzen
  • mentioned in issue #326201 (closed)

  • Peter Leitzen resolved all threads

    resolved all threads

  • 65 65 "The thing '#{thing.class.name}' for feature flag '#{key}' needs to include `FeatureGate` or implement `flipper_id`"
    66 66 end
    67 67
    68 Feature::Definition.valid_usage!(key, type: type, default_enabled: default_enabled)
    68 Feature::Definition.valid_usage!(key, type: type, default_enabled: :yaml)
    69 69 end
    70 70
    71 # If `default_enabled: :yaml` we fetch the value from the YAML definition instead.
    72 default_enabled = Feature::Definition.default_enabled?(key) if default_enabled == :yaml
    71 # TODO: Remove rubocop disable comment once `default_enabled` argument is removed https://gitlab.com/gitlab-org/gitlab/-/issues/271275
    72 default_enabled = Feature::Definition.default_enabled?(key) # rubocop:disable Lint/ShadowedArgument
  • 8 8
    9 9 before do
    10 10 skip_feature_flags_yaml_validation
    11 skip_default_enabled_yaml_check
    • @ck3g

      Ignores default_enabled argument in Feature.enabled?. Takes default_enabled value from the feature flag definition file instead. That should ensure that everything works as expected without default_enabled argument.

      We cannot do it, as: In shared.rb we have some entries marked as optional: true. It means that they will fail, as not having default_enabled:.

      The likely proper way to solve that is:

      def enabled?(key, thing = nil, type: :development, default_enabled: :yaml)

      And let all other that do not have YAML (as optional) to define default_enabled: false/true if needed.

      Edited by Kamil Trzciński
    • Author Maintainer

      Got it. Thank you!

    • Please register or sign in to reply
  • mentioned in commit 4aabd520

  • Vitali Tatarintev mentioned in merge request !57707 (merged)

    mentioned in merge request !57707 (merged)

  • added workflowproduction label and removed workflowstaging label

  • Albert mentioned in merge request !85522 (merged)

    mentioned in merge request !85522 (merged)

  • Please register or sign in to reply
    Loading