Skip to content

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

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

khvn26 wants to merge 37 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.

@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 12, 2026 11:49am UTC
2 Skipped Deployments
Project Deployment Actions Updated
flagsmith-frontend-preview Ignored Ignored Preview Oct 12, 2026 11:49am UTC
flagsmith-frontend-staging Ignored Ignored Preview Oct 12, 2026 11:49am 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
@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.85%. Comparing base (a1ace4a) to head (f25b8ef).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8713      +/-   ##
==========================================
- Coverage   98.86%   98.85%   -0.01%     
==========================================
  Files        1674     1677       +3     
  Lines       69337    69148     -189     
==========================================
- Hits        68548    68357     -191     
- Misses        789      791       +2     

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

@github-actions github-actions Bot added fix and removed fix docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot added docs Documentation updates fix and removed fix docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot added the docs Documentation updates label Oct 9, 2026
@khvn26
khvn26 force-pushed the fix/refuse-system-segment-changes branch from 1e18a46 to 3cfd3ee Compare October 9, 2026 16:52
@github-actions github-actions Bot added fix docs Documentation updates and removed fix docs Documentation updates labels Oct 9, 2026
@github-actions github-actions Bot removed the fix label Oct 9, 2026
khvn26 and others added 30 commits October 12, 2026 13:40
SegmentSerializer refuses drafting versions of system segments, which
also covers the change request serializers extending it, rather than
waiting for their commit.
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.
- 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.
- Keep the flag API's request schema refusing null values, and the
  versions request schema as it was, without TODOs.
- Reword comments and docstrings.
- Run the lifecycle hooks of deleted feature segments, rather than
  replicating them.
- Mark the services only legacy APIs use for removal.
… flag API

Replacing a flag's overrides leaves its system segment overrides as they
are, and PATCH updates flags partially, so the flag API no longer accepts
system segment overrides written as they are. The legacy feature state
API still does, as the dashboard writes every override of flags it saves.
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.
Creating overrides enabled or not already keeps their audit log to one
entry, without comparing their values.
…vice

Variants not written keep their weights, so writing some of them through
the service, as the legacy feature state API does, could exceed 100%.
Also keeps get_next_segment_override_priority beyond the legacy APIs.
Experiments write their rollout overrides, and the default allocations,
through features.future.services as owners of their rollout segments.
This removes versioning_service.update_flag, update_multivariate_values
and FlagChangeSet, their last consumer gone. MultivariateValueChangeSet
moves to experimentation, its only user.
… them

RolloutSpec carries the flag API's variants, which removes
MultivariateValueChangeSet.

This branch was successfully deployed

1 active deployment
Preview – docs — f25b8ef9 Deployed Oct 12, 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