Draft
Conversation
…avior Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
Co-authored-by: Prithpal Sooriya <prithpal.sooriya@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
What is the current state of things and why does it need to change?
The
RemoteFeatureFlagControllerevaluates threshold-scoped variations based on their order in the array. If these variations are not sorted in ascending order by theirscope.value, the controller may select an unintended variation. This behavior was not explicitly documented or covered by a dedicated unit test, leading to potential confusion or misconfiguration.What is the solution your changes offer and how does it work?
This PR clarifies and documents the expected behavior for threshold-scoped variations.
remote-feature-flag-controller.test.tsthat explicitly demonstrates the controller selecting the first matching variation when the variations array is unsorted (e.g.,[1, 0.1]). This test serves as a clear specification of the current implementation.README.mdfor theremote-feature-flag-controllerpackage has been updated with a new section, "Threshold-scoped variation ordering," which explicitly states that variations must be sorted in ascending order by theirscope.valueand provides correct/incorrect JSON examples.Are there any changes whose purpose might not obvious to those unfamiliar with the domain?
The new unit test, which uses an unsorted array
[1, 0.1]and asserts that the variation for1is selected, is crucial for documenting that the controller processes variations in array order, not necessarily by their numerical value if unsorted. This highlights the importance of the ascending order requirement now stated in the documentation.References
#8122
Checklist