Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(experiments): Handle None value for exposure_criteria #29066

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

danielbachhuber
Copy link
Contributor

Follow up from #29015
Fixes https://posthog.sentry.io/issues/6320840804/

Changes

Safely handles None in exposure_criteria field.

How did you test this code?

Tests should pass.

@danielbachhuber danielbachhuber requested a review from a team February 21, 2025 15:54
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds null safety checks for handling None values in the exposure_criteria field across experiment query runners, fixing a Sentry error where the code attempted to access properties of a None value.

  • Added null checks in ExperimentExposuresQueryRunner._get_exposure_query() before accessing exposure_criteria.get() properties
  • Modified create_experiment() method in test files to explicitly handle exposure_criteria=None parameter
  • Added safety checks in ExperimentQueryRunner._get_experiment_query() to prevent NoneType attribute errors
  • Updated test cases to verify proper handling of both None and explicitly set exposure_criteria values

4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@danielbachhuber danielbachhuber changed the title Handle None value for exposure_criteria fix(experiments): Handle None value for exposure_criteria Feb 21, 2025
@danielbachhuber danielbachhuber enabled auto-merge (squash) February 21, 2025 16:13
@danielbachhuber danielbachhuber merged commit da5e95a into master Feb 21, 2025
89 checks passed
@danielbachhuber danielbachhuber deleted the experiments/handle-non-value branch February 21, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants