flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution
https://flipt.io
GNU General Public License v3.0
3.64k stars 200 forks source link

[Bug]: Variant type flags webhook payloads does not include "default rule" change #3471

Closed alucarddelta closed 1 week ago

alucarddelta commented 1 week ago

Bug Description

When sending webhook events and a the default rule is changed for a variant type flag, there is no information sent on what the default rule was changed to.

In the example, I changed the default rule from testvar to testvar2.

{
  "version":"0.2","type":"flag","action":"updated","metadata":{
    "actor":{
        "authentication":"oidc","email":"user@email.com.au","ip":"192.168.1.1","name":"user"}
    },
    "payload":{
        "description":"","enabled":true,"key":"test","name":"test","namespace_key":"default"
    },
  "timestamp":"2024-09-17T02:50:06Z"}

Bool type flag default "rollout" changes the "enable" object

{"payload":{"description":"","enabled":false,"key":"testbool","name":"testbool","namespace_key":"default"}}
{"payload":{"description":"","enabled":true,"key":"testbool","name":"testbool","namespace_key":"default"}}

Version Info

1.48.1

Search

Steps to Reproduce

  1. Configure the server to sent webhooks
  2. Create a Flag of type Variant
  3. Create 2 Variants
  4. Set the Flag to 1
  5. Update the Flag to 2

Expected Behavior

As part of the Payload object in the webhook include the name/key of the variant that is being used

    "payload":{
        "description":"","enabled":true,"key":"test","name":"test","namespace_key":"default", "default_rule":"testvar2"
    },

Additional Context

No response

GeorgeMac commented 1 week ago

Thanks for raising this @alucarddelta 🙏

I believe this needs adding roughly here in the code (for future reference): https://github.com/flipt-io/flipt/blob/ebca332effc1ee0852b5b18392935c4f0e4335f6/internal/server/audit/types.go#L10-L26