Skip to content

fix(Segments): Refuse changes to system segments and their overrides - #8713

Draft
khvn26 wants to merge 27 commits into
mainfrom
fix/refuse-system-segment-changes
Draft

khvn26 wants to merge 27 commits into
mainfrom
fix/refuse-system-segment-changes

Conversation

@khvn26

@khvn26 khvn26 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

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

  • I have read the Contributing Guide.
  • 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.

Changes

WIP

Contributes to #8608

How did you test this code?

Please describe.

khvn26 added 8 commits October 9, 2026 16:18
…g API

Only the features owning system segments can change their overrides now,
by calling update_flag or delete_segment_override with system=True.
Writing them as they are, e.g. replacing a flag as read, still works.
Superseded by the /api/__future__/ flag endpoints, documented at
https://docs.flagsmith.com/managing-flags/updating-flags. Removes
/api/experiments/environments/{key}/update-flag-v1/, update-flag-v2/ and
delete-segment-override/.
The create-segment-override, feature-segments and featurestates endpoints
now write live segment overrides through features.future.services, keeping
their requests and responses. They refuse system segment changes with it.
update-priorities reorders live overrides through the flag API, moving the
others out of the way as before. Writes the flag API can't make, e.g. to
drafts, refuse system segments until #7641. Committing a change request
refuses changes to system segments.
Also refuses create-segment-override requests without a feature segment
with a 400, rather than erroring.
SegmentSerializer refuses drafting versions of system segments, which
also covers the change request serializers extending it, rather than
waiting for their commit.
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Oct 9, 2026 7:50pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
flagsmith-frontend-preview Ignored Ignored Preview Oct 9, 2026 7:50pm UTC
flagsmith-frontend-staging Ignored Ignored Preview Oct 9, 2026 7:50pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates fix and removed docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot added the docs Documentation updates label Oct 9, 2026
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.84%. Comparing base (618f0fb) to head (5477bec).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8713      +/-   ##
==========================================
- Coverage   98.85%   98.84%   -0.01%     
==========================================
  Files        1665     1667       +2     
  Lines       68762    68689      -73     
==========================================
- Hits        67972    67893      -79     
- Misses        790      796       +6     

☔ View full report in Codecov by Harness.
📢 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.

khvn26 added 2 commits October 9, 2026 17:59
POST feature-segments/ in v2 environments drafts feature segments for
the feature states of new versions, e.g. ones going through change
requests, rather than overriding the live flag.
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026
- Type the legacy feature state data validated by the legacy APIs.
- Move the legacy override writes, and code reference notifications, to
  features/services.py.
- Render APIErrorDetail bodies from a common APIError base class.
- Mark legacy viewsets for removal as a whole.
@github-actions github-actions Bot added docs Documentation updates fix and removed fix docs Documentation updates labels Oct 9, 2026
The legacy APIs clear values themselves, without v2 feature versioning,
so the flag API keeps its request types. Legacy segment override helpers
move to features/feature_segments.
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026
Creating overrides enabled or not already keeps their audit log to one
entry, without comparing their values.
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026

This branch was successfully deployed

1 active deployment
Preview – docs — 5477beca Deployed Oct 9, 2026 by vercel[bot]
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 docs Documentation updates fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant