Skip to content

Conversation

SudeshHirave
Copy link

Problem

Closes #38896

Changes

Added if check for empty groups and gave an proper error for for creating a feature flag with empty groups

How did you test this code?

  • Bug Fixes
    • Prevents saving feature flag filters with an empty "groups" list; attempts now return a clear validation error.

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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +399 to +401
raise serializers.ValidationError(
"Feature flag filters must contain at least one condition set. Empty 'groups' array is not allowed."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The error message string is split across multiple lines without proper indentation. Consider formatting it properly:

Suggested change
raise serializers.ValidationError(
"Feature flag filters must contain at least one condition set. Empty 'groups' array is not allowed."
)
raise serializers.ValidationError(
"Feature flag filters must contain at least one condition set. Empty 'groups' array is not allowed."
)
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/api/feature_flag.py
Line: 399:401

Comment:
**style:** The error message string is split across multiple lines without proper indentation. Consider formatting it properly:

```suggestion
            raise serializers.ValidationError(
                "Feature flag filters must contain at least one condition set. Empty 'groups' array is not allowed."
            )
```

How can I resolve this? If you propose a fix, please make it concise.

@posthog-bot posthog-bot requested a review from a team October 3, 2025 15:56
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.

bug(flags): The API allows creating a flag with empty condition sets
1 participant