Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Default Variant #3134

Open
1 task done
GeorgeMac opened this issue May 29, 2024 · 0 comments
Open
1 task done

Add Default Variant #3134

GeorgeMac opened this issue May 29, 2024 · 0 comments
Assignees
Labels
dx Developer experience enhancement Created by Linear-GitHub Sync go lg Little bit big needs docs Requires documentation updates

Comments

@GeorgeMac
Copy link
Contributor

GeorgeMac commented May 29, 2024

Problem

Currently, it is technically possible through the API or via the declarative backend to create a variant flag with a segment matching rule that has zero distributions (the UI blocks this). What this leads to is that a context which does match the segment for the rule returns Match == false, because matched has historically implied there is also an associated variant to return. However, variants are only selected when there is a distribution that the request entity ID hashes into. So given no distributions, the engine cannot reliably pick a variant and so it returns a result as having no match.

See this attempt to change the bahaviour of the evaluation engine in this situation: #2979

Ideal Solution

We could add a new property to variant flags to identify a default variant. This would be an optional additional parameter. It would identify one of its variants as being the variant to choose, given no distributions match for the entity ID.

How we represent the default variant could be one of a couple ways:

  1. Add a default_variant key to flag. It should contain a key which is present in the variants set within the flag itself. We would need to ensure this constraint is maintained both when adding a default or removing a referenced variant.
  2. Add a default boolean field to the Variant type itself. This removes the need to maintain the constraints required in (1), however, it introduces a different constraint, that we need to validate and maintain that default is only for one member of the flags entire set of variants.

Making the default variant an opt-in parameter would ensure backwards compatibility. Attempting to infer a default would be a breaking change and could cause unexpected behaviour. So making this opt-in is important.

Search

  • I searched for other open and closed issues before opening this

Additional Context

No response

@GeorgeMac GeorgeMac added enhancement Created by Linear-GitHub Sync go dx Developer experience needs docs Requires documentation updates lg Little bit big labels May 29, 2024
@markphelps markphelps self-assigned this Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dx Developer experience enhancement Created by Linear-GitHub Sync go lg Little bit big needs docs Requires documentation updates
Projects
Status: In Progress
Development

No branches or pull requests

2 participants