Skip to content

fix: send falsy variant values to Mixpanel and Rudderstack integrations - #8104

Open
genrichez wants to merge 5 commits into
Flagsmith:mainfrom
genrichez:fix/mixpanel-falsy-variant-values
Open

fix: send falsy variant values to Mixpanel and Rudderstack integrations#8104
genrichez wants to merge 5 commits into
Flagsmith:mainfrom
genrichez:fix/mixpanel-falsy-variant-values

Conversation

@genrichez

Copy link
Copy Markdown

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's enabled state (usually True).

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, the and value condition failed, causing the code to fall back to feature_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

@genrichez
genrichez requested a review from a team as a code owner July 26, 2026 12:33
@genrichez
genrichez requested review from khvn26 and removed request for a team July 26, 2026 12:33
@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c23da66c-7ac6-4733-9be7-b682f9d96d5b

📥 Commits

Reviewing files that changed from the base of the PR and between c34e371 and 3db7c73.

📒 Files selected for processing (2)
  • api/integrations/mixpanel/mixpanel.py
  • api/integrations/rudderstack/rudderstack.py

📝 Walkthrough

Walkthrough

Mixpanel and Rudderstack feature property generation now preserves enabled values such as False, 0, and empty strings, falling back to the enabled state only when the value is None. Integration tests update expected mappings and add parametrised coverage for falsy values and disabled defaults.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the api Issue related to the REST API label Jul 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 36f579f and aef53ab.

📒 Files selected for processing (4)
  • api/integrations/mixpanel/mixpanel.py
  • api/integrations/rudderstack/rudderstack.py
  • api/tests/unit/integrations/mixpanel/test_unit_mixpanel.py
  • api/tests/unit/integrations/rudderstack/test_unit_rudderstack.py

Comment thread api/integrations/mixpanel/mixpanel.py
Comment thread api/tests/unit/integrations/mixpanel/test_unit_mixpanel.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between aef53ab and 9a27fad.

📒 Files selected for processing (2)
  • api/tests/unit/integrations/mixpanel/test_unit_mixpanel.py
  • api/tests/unit/integrations/rudderstack/test_unit_rudderstack.py

Comment thread api/tests/unit/integrations/mixpanel/test_unit_mixpanel.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixpanel integration: falsy variant values collapse into enabled-state

1 participant