Skip to content

Conversation

@gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Nov 19, 2025

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Adds two new experimental endpoints under /api/experiments/:

How did you test this code?

Unit tests

matthewelwell and others added 2 commits October 29, 2025 10:23
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)
@vercel
Copy link

vercel bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs Ignored Ignored Preview Dec 9, 2025 0:20am
flagsmith-frontend-preview Ignored Ignored Preview Dec 9, 2025 0:20am
flagsmith-frontend-staging Ignored Ignored Preview Dec 9, 2025 0:20am

@gagantrivedi gagantrivedi changed the title Feat/experimental flag update endpoints feat(api): add experimental feature flag update endpoints Nov 19, 2025
@github-actions github-actions bot added the api Issue related to the REST API label Nov 19, 2025
@github-actions github-actions bot added the feature New feature or request label Nov 19, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 26, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 26, 2025
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.05%. Comparing base (bebb47b) to head (6af33d2).
⚠️ Report is 43 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- 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
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 28, 2025
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
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 28, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 28, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Nov 28, 2025
@gagantrivedi gagantrivedi force-pushed the feat/experimental-flag-update-endpoints branch from f280c7f to b987697 Compare November 28, 2025 13:29
- 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
@gagantrivedi gagantrivedi force-pushed the feat/experimental-flag-update-endpoints branch from f6d2ae8 to c979e28 Compare December 9, 2025 08:03
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Dec 9, 2025
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.
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Dec 9, 2025
- 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
@gagantrivedi gagantrivedi removed the request for review from emyller December 9, 2025 08:43
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Dec 9, 2025
@gagantrivedi gagantrivedi requested a review from khvn26 December 9, 2025 09:34
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.
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Dec 9, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Dec 9, 2025
@gagantrivedi gagantrivedi dismissed emyller’s stale review December 10, 2025 02:37

Feel free to review retrospectively.

@gagantrivedi gagantrivedi removed the request for review from matthewelwell December 10, 2025 02:37
@gagantrivedi gagantrivedi merged commit 32e9bc5 into main Dec 10, 2025
30 checks passed
@gagantrivedi gagantrivedi deleted the feat/experimental-flag-update-endpoints branch December 10, 2025 02:39
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 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create new experimental endpoints to update a given feature in an environment

5 participants