Skip to content

Conversation

@Zaimwa9
Copy link
Contributor

@Zaimwa9 Zaimwa9 commented Oct 15, 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

  • GET /api/v1/projects/{project_id}/features/?environment={env_id}&segment={segment_id}endpoint now accept query-string params?segment=xx` to return the requested segment' feature states

Added segment_feature_state to response when segment=xx is passed in. Without or with invalid segment, the response is untouched

From V1 to V2:
Frontend was initially going to get the features list and reconciliate the feature states with it. However we realized that this could lead to some loopholes due to features list pagination.
V2 includes a new query param in order to attach the segment_feature_state to the features list to avoid pagination discrepancies.

How did you test this code?

  • Added tests
  • Ran query

Example payload:

{
            "id": 21,
             ....
            "uuid": "1a56cd3c-611a-407f-9dd3-13a10580c7ca",
            "project": 3,
            "environment_feature_state": {
                "id": 565,
                "feature_state_value": null,
                "environment": 8,
                "identity": null,
                "feature_segment": null,
                "enabled": false
            },
            "segment_feature_state": null,
            "num_segment_overrides": 0,
             ....
            "metadata": [],
            "code_references_counts": []
        },

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner October 15, 2025 09:54
@Zaimwa9 Zaimwa9 requested review from gagantrivedi and removed request for a team October 15, 2025 09:54
@vercel
Copy link

vercel bot commented Oct 15, 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 Oct 28, 2025 2:07pm
flagsmith-frontend-preview Ignored Ignored Preview Oct 28, 2025 2:07pm
flagsmith-frontend-staging Ignored Ignored Preview Oct 28, 2025 2:07pm

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Oct 15, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 15, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-6156 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6156 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6156 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6156 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6156 Finished ✅ Results

cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.01%. Comparing base (6905e70) to head (ff9dc4e).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6156   +/-   ##
=======================================
  Coverage   98.00%   98.01%           
=======================================
  Files        1278     1278           
  Lines       45122    45178   +56     
=======================================
+ Hits        44223    44280   +57     
+ Misses        899      898    -1     

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

@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 15, 2025
cursor[bot]

This comment was marked as outdated.

gagantrivedi
gagantrivedi previously approved these changes Oct 15, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 21, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 21, 2025
cursor[bot]

This comment was marked as outdated.

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner October 21, 2025 15:35
@Zaimwa9 Zaimwa9 requested review from talissoncosta and removed request for a team October 21, 2025 15:35
@Zaimwa9
Copy link
Contributor Author

Zaimwa9 commented Oct 21, 2025

Couple of changes @gagantrivedi 🙏 :
From V1 to V2:
Frontend was initially going to get the features list and reconciliate the feature states with it. However we realized that this could lead to some loopholes due to features list pagination.
V2 includes a new query param in order to attach the segment_feature_state to the features list to avoid pagination discrepancies.

@kyle-ssg
Copy link
Member

This simplifies the FE so much! Tested with the code in #6137

gagantrivedi
gagantrivedi previously approved these changes Oct 22, 2025
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 28, 2025
cursor[bot]

This comment was marked as outdated.

@Zaimwa9 Zaimwa9 requested a review from khvn26 October 28, 2025 14:08
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request labels Oct 28, 2025
@Zaimwa9 Zaimwa9 merged commit 9ad82d5 into main Oct 28, 2025
30 checks passed
@Zaimwa9 Zaimwa9 deleted the feat/get-segment-features-states-with-query-param branch October 28, 2025 14:30
Copilot AI pushed a commit that referenced this pull request Oct 30, 2025
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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 front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants