Skip to content

Fix:Align Core API feature_segment shape with Edge API#7523

Open
SahilJat wants to merge 1 commit into
Flagsmith:mainfrom
SahilJat:fix/identity-api-feature-segment-shape
Open

Fix:Align Core API feature_segment shape with Edge API#7523
SahilJat wants to merge 1 commit into
Flagsmith:mainfrom
SahilJat:fix/identity-api-feature-segment-shape

Conversation

@SahilJat
Copy link
Copy Markdown
Contributor

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

  • [ x ] I have read the Contributing Guide.
  • [ x ] I have added information to docs/ if required so people know about the feature.
  • [ x ] I have filled in the "Changes" section below.
  • [ x ] I have filled in the "How did you test this code" section below.

Changes

Closes #7456

  • api/features/serializers.py:
    • Introduced _FeatureSegmentPrioritySerializer to handle the nested
      serialization of the priority field for feature segments.
    • Updated FeatureStateSerializerFull to use this new serializer for
      the feature_segment field.
    • This change ensures that the Core API's SDK-facing endpoints (and
      any other endpoints using FeatureStateSerializerFull) return the
      same data shape as the Edge API, providing the priority information
      that was previously missing.
  • api/tests/unit/environments/identities/test_unit_identities_views.py:
    • Added a new test case

How did you test this code?

Automated Tests: Added a new unit test in
api/tests/unit/environments/identities/test_unit_identities_views.py that specifically sets up a segment override with a defined priority
and asserts that the /api/v1/identities/ response contains the
feature_segment as an object: {"priority": 1}.

  • Manual Verification: Analyzed the serializer inheritance chain to
    ensure the change correctly propagates to the SDK identities and flags
    endpoints while minimizing impact on write operations (as the field is
    marked as read_only=True in the "Full" serializer).

@SahilJat SahilJat requested a review from a team as a code owner May 15, 2026 09:03
@SahilJat SahilJat requested review from emyller and removed request for a team May 15, 2026 09:03
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

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

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the api Issue related to the REST API label May 15, 2026
@SahilJat SahilJat force-pushed the fix/identity-api-feature-segment-shape branch from 5dce6c5 to 27f5ba9 Compare May 15, 2026 09:14
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.31%. Comparing base (6168392) to head (27f5ba9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7523      +/-   ##
==========================================
- Coverage   98.47%   98.31%   -0.16%     
==========================================
  Files        1400     1400              
  Lines       52980    52873     -107     
==========================================
- Hits        52170    51981     -189     
- Misses        810      892      +82     

☔ 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.

@SahilJat SahilJat changed the title Align Core API feature_segment shape with Edge API Fix:Align Core API feature_segment shape with Edge API May 15, 2026
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.

GET api/v1/identities returns feature_segment as integer FK instead of Edge Api object format

1 participant