Override linter is index-bound instead of segment-bound in mixed-format segment overrides UI
How are you running Flagsmith
- [ ] Self Hosted with Docker
- [ ] Self Hosted with Kubernetes
- [x] SaaS at flagsmith.com
- [ ] Some other way (add details in description below)
Describe the bug
When using mixed format segment overrides in the Segment Overrides UI, the linter appears bound to the list index, not the segment attached to that row. The actual override values are evaluated and mapped correctly after reorder. Only the linter assigned to each row becomes mismatched.
Problem Description
If override row 0 is configured with a JSON linter, and row 1 is configured with an XML linter, reordering these overrides swaps the segments and retains the correct override values. However, the linters do not follow the segments. They remain fixed to their original row index. This causes validation mismatches in the UI even though evaluations are correct.
Observed Behavior • Segments and override values stay mapped and evaluate correctly. • The JSON linter remains bound to row index 0. • The XML linter remains bound to row index 1. • After reorder, row index 0 may contain XML overrides but is linted as JSON. • Row index 1 may contain JSON overrides but is linted as XML. • UI validation mismatches the segment override format being edited.
Steps To Reproduce
- Create two segments in Flagsmith
- Open the Segment Override UI.
- Configure overrides: • Row 0: assign Segment A, add JSON override values (valid JSON linter active). • Row 1: assign Segment B, add XML override values (valid XML linter active).
- Reorder overrides by swapping row 0 and row 1.
- Observe linter or validation behavior for each row.
Expected behavior
• Override linter or validation should follow the segment attached to the override row. • After reorder, row 0 should lint or validate using the linter for Segment B’s content (XML if assigned). • After reorder, row 1 should lint or validate using the linter for Segment A’s content (JSON if assigned). • Validation and linting should stay aligned with segment identity, not list position.