-
Notifications
You must be signed in to change notification settings - Fork 465
feat(api): add experimental feature flag update endpoints #6305
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds two new experimental endpoints under /api/experiments/: - update-flag-v1: Update single feature state (environment default or segment override) - update-flag-v2: Update multiple feature states in a single request (environment default + segment overrides)
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6305 +/- ##
==========================================
+ Coverage 98.02% 98.05% +0.03%
==========================================
Files 1280 1289 +9
Lines 45406 46147 +741
==========================================
+ Hits 44508 45249 +741
Misses 898 898 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Parameterize test_update_flag_by_name for all value types (integer, string, boolean) - Remove unsupported float type from serializer (model doesn't support it) - Add test_serializers.py with unit tests for edge cases - Add test for duplicate segment_id validation - Add tests for updating existing segment overrides with priority - Add unit tests for boolean string conversion and replica path - Refactor _update_flag_for_versioning_v2 to separate segment vs environment default cases for cleaner code and full coverage
Replace SDK endpoint calls with direct database verification using get_environment_flags_list. This keeps the tests as proper unit tests rather than integration tests. - Remove sdk_client and sdk_client_factory fixtures - Remove get_identity_feature_state_from_sdk helper function - Remove Identity, Condition, SegmentRule imports and usage - Simplify segment override tests to verify database state directly
f280c7f to
b987697
Compare
- Refactor AuditFieldsMixin into AuthorData dataclass with from_request factory - Add FeatureValueType Literal type for type safety - Remove unused return values from update_flag_v2 functions - Add TODO comment for segment validation optimization - Improve priority documentation wording
f6d2ae8 to
c979e28
Compare
When creating new segment overrides in V2 versioning mode, the FeatureSegment was not being linked to the version. This caused priority ordering to be calculated across all segments with NULL version instead of being scoped to the specific version.
- Use key existence checks instead of truthiness in FeatureIdentifierSerializer to correctly handle id=0 edge case - Fix test mock to use MasterAPIKey instance instead of string, matching production behavior where api_key is a model instance
segment_id=0 would bypass validation and incorrectly update the environment default instead of returning an error. Changed all segment_id checks to use 'is not None' or key existence tests.
khvn26
approved these changes
Dec 9, 2025
Feel free to review retrospectively.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature!Changes
Adds two new experimental endpoints under /api/experiments/:
Related issues: Create new experimental endpoint to update a single feature state for a given feature #6279 Create new experimental endpoints to update a given feature in an environment #6233
How did you test this code?
Unit tests