Skip to content

Conversation

@dumbbell
Copy link
Collaborator

@dumbbell dumbbell commented Feb 2, 2023

When we collect feature flag properties from all nodes, we start with an empty cluster inventory (a common Erlang recursion pattern). This means that all feature flags are unknown at first.

In merge_feature_flags(), we must compute a global stability level for each feature flag, in case all nodes are not on the same page (like one nodes considers a feature flag experimental, but another one marks it as stable). That's why we rank stability level: required > stable > experimental.

This ranking had one issue: rabbit_feature_flags:get_stability/1 defaults to stable if a feature flag has not explicit stability set. Therefore, with our empty starting inventory, the starting stability would be stable. And it would superceed an experimental feature flag stability level, even though all nodes agree on that.

Now, if a feature flag is missing from our inventory being collected, we consider its stability level to be experimental. This is different from a known feature flag with no explicit stability level. This way, we are sure that feature flags marked as experimental everywhere will be considered experimental globally.

While here, fix two other small issues:

  • a badly formatted list of feature flags when logged
  • an incorrect spec and doc for get_stability/1

When we collect feature flag properties from all nodes, we start with an
empty cluster inventory (a common Erlang recursion pattern). This means
that all feature flags are unknown at first.

In `merge_feature_flags()`, we must compute a global stability level for
each feature flag, in case all nodes are not on the same page (like one
nodes considers a feature flag experimental, but another one marks it as
stable). That's why we rank stability level: required > stable >
experimental.

This ranking had one issue: `rabbit_feature_flags:get_stability/1`
defaults to `stable` if a feature flag has not explicit stability set.
Therefore, with our empty starting inventory, the starting stability
would be `stable`. And it would superceed an experimental feature flag
stability level, even though all nodes agree on that.

Now, if a feature flag is missing from our inventory being collected, we
consider its stability level to be experimental. This is different from
a known feature flag with no explicit stability level. This way, we are
sure that feature flags marked as experimental everywhere will be
considered experimental globally.
"~~" was ok when the final string was a format string, but it's not
anymore. We need a simple "~".
The return value was incorrectly specified and documented: it can return
`undefined` when a feature flag name is passed and that feature flag is
unknown.

So far, this function is always called with a feature flag properties
map, in which case it doesn't return `undefined`.
@dumbbell dumbbell added this to the 3.12.0 milestone Feb 2, 2023
@dumbbell dumbbell requested a review from dcorbacho February 2, 2023 11:29
@dumbbell dumbbell self-assigned this Feb 2, 2023
@dumbbell dumbbell marked this pull request as ready for review February 2, 2023 12:56
@dumbbell dumbbell merged commit 55e3569 into main Feb 2, 2023
@dumbbell dumbbell deleted the fix-default-feature-flags-filtering-in-ff-controller branch February 2, 2023 13:02
dumbbell added a commit that referenced this pull request Feb 2, 2023
Feature flags: Fix experimental feature flags inventory (backport #7156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants