fix: send falsy variant values to Mixpanel and Rudderstack integrations - #8104
fix: send falsy variant values to Mixpanel and Rudderstack integrations#8104genrichez wants to merge 5 commits into
Conversation
|
Someone is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughMixpanel and Rudderstack feature property generation now preserves enabled values such as Estimated code review effort: 2 (Simple) | ~10 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fc1adce0-10c2-4387-9019-70c3ce400e24
📒 Files selected for processing (4)
api/integrations/mixpanel/mixpanel.pyapi/integrations/rudderstack/rudderstack.pyapi/tests/unit/integrations/mixpanel/test_unit_mixpanel.pyapi/tests/unit/integrations/rudderstack/test_unit_rudderstack.py
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0fdbcd90-b431-4d00-abff-fc3a6e2fdda8
📒 Files selected for processing (2)
api/tests/unit/integrations/mixpanel/test_unit_mixpanel.pyapi/tests/unit/integrations/rudderstack/test_unit_rudderstack.py
Describe the pull request
This PR fixes a bug in the Mixpanel and Rudderstack integrations where falsy variant values (like
False,0, or"") were being incorrectly dropped and replaced with the feature'senabledstate (usuallyTrue).Root cause:
The integrations used the ternary expression:
value if (feature_state.enabled and value) else feature_state.enabled
Because
False,0, and""are falsy in Python, theand valuecondition failed, causing the code to fall back tofeature_state.enabled.Fix:
Updated the logic to check for
value is not None, matching the correct pattern already used in the Amplitude and Heap integrations:value if (feature_state.enabled and value is not None) else feature_state.enabled
I also updated the existing unit tests and added new parametrized tests (matching the Heap integration test pattern) to explicitly verify that falsy values (
False,0,"") are sent correctly to both Mixpanel and Rudderstack.Link to the issue
Closes #7701