flipt icon indicating copy to clipboard operation
flipt copied to clipboard

[FLI-923] Support a negative match on a segment

Open GeorgeMac opened this issue 1 year ago • 1 comments

Problem

The ability to express in a rule or rollout that a context does not match a specified segment.

An example usecase is that you can replicate what we have with variant type flags, where a context both matches some segment and falls into a distribution. This can be expressed in rollouts by first adding a negative match on a segment which returns early, before falling through to a threshold constraint.

  • if not match segment return false
  • if in within threshold 60% return true
  • otherwise, return default

This here ensures that true is only returned both when the context does fall in the segment and is within the precentage threshold.

Ideal Solution

One possible way to express this would be with a matches boolean property on rules or rollout segments, which defaults to true. This could be change to false to express the negative match.

 flags:
 - key: somevariantflag
   name: Some Variant Flag
   type: VARIANT_FLAG_TYPE
   variants:
   - key: a
   - key: b
   rules:
   - segment: foo
+    matches: false
     distributions:
     - variant: a
       rollout: 100
 - key: somebooleanflag
   name: Some Boolean Flag
   type: BOOLEAN_FLAG_TYPE
   rollouts:
   - segment:
       key: foo
+      matches: false

Search

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

Additional Context

No response

FLI-923

GeorgeMac avatar Mar 21 '24 15:03 GeorgeMac

CleanShot 2024-12-16 at 16 31 16

started taking a crack at it here

markphelps avatar Dec 16 '24 21:12 markphelps