-
Notifications
You must be signed in to change notification settings - Fork 18
feat: enforce unique flag keys in manifest validation #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
3adc547 to
44ed2ea
Compare
Summary of ChangesHello @kriscoleman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the manifest validation process by introducing a mechanism to detect duplicate flag keys. This change prevents potential data integrity issues that could arise from malformed manifests where flag keys are unintentionally duplicated, providing clearer error feedback and ensuring that each flag is uniquely defined. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a valuable feature to detect duplicate flag keys during manifest validation, which is a great improvement as standard JSON unmarshaling would silently ignore these. The implementation uses a token-based parsing approach which is appropriate for this task. The accompanying unit tests are thorough and cover a good range of scenarios. My main feedback is focused on improving the robustness of error handling within the new parsing logic to ensure that malformed JSON doesn't lead to incomplete or incorrect validation results.
Add duplicate flag key detection to the Validate() function. This catches cases where a manifest JSON file is manually edited to contain duplicate keys within the flags object. Standard JSON unmarshaling silently accepts duplicates (taking the last value), so we use a token-based approach to detect them during validation. Fixes open-feature#193 Signed-off-by: Kris Coleman <kriscodeman@gmail.com>
44ed2ea to
9739186
Compare
georgesdugue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @kriscoleman
Great ideas, I can follow up with some of this, it will make for good UX improvements |


This PR
Add duplicate flag key detection to the Validate() function. This catches cases where a manifest JSON file is manually edited to contain duplicate keys within the flags object. Standard JSON unmarshaling silently accepts duplicates (taking the last value), so we use a token-based approach to detect them during validation.
Related Issues
Fixes #193
How to test
to try it for realsies:
openfeaturecommand against the manifest and it should detect the duplicate keys as validate is called pre-emptively for all manifest commands.