Flagsmith / Flagsmith/flagsmith

Mixpanel integration: falsy variant values collapse into enabled-state

Open
#7,701 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

### How are you running Flagsmith

- [ ] Self Hosted with Docker
- [ ] Self Hosted with Kubernetes
- [x] SaaS at flagsmith.com
- [ ] Some other way (add details in description below)

### Describe the bug

When a flag is enabled and the variant value is falsy, the mixpanel integration incorrectly fallbacks the value to the flag state `true` instead of `false`.

The documentation is ambiguous, only stating `if the flag has no remote config value, pass the boolean state`
```
# Current mapping

Flag state | Variant value | Sent to Mixpanel
-----------+----------------------------+----------------------
ON | True | true (value)
ON | False / None / 0 / "" | true (enabled state)
ON | "hello" / 42 | the value
OFF | anything | false (enabled state)
```

### Steps To Reproduce

1. Activate Mixpanel integration in your environment
2. Create a multivariate feature
3. Enable the flag
4. Set a variant value to be `false`
5. Mixpanel will show the variant as `true`

### Expected behavior

The mapping should be:
```
Flag state | Variant value | Sent to Mixpanel
-----------+----------------------------+----------------------
ON | True | true (value)
ON | False / "" / 0 | false
ON | None / null | true (enabled state)
ON | "hello" / 42 | the value
OFF | anything | false (enabled state)
```

The resolution of the issue includes:
- Updating the doc to be exhaustive in relation to the behavior
- Communicate with impacted customers before releasing

### Screenshots

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.