-
Notifications
You must be signed in to change notification settings - Fork 89
docs(ADR): standardize Flag configuration parsing and error handling #1692
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
✅ Deploy Preview for polite-licorice-3db33c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
||
* Utilize schema validation as much as possible, instead of custom logic, on a flag level rather than a configuration level. | ||
* Define what consistutes a `PARSE_ERROR` versus a `FLAG_NOT_FOUND`. | ||
* Define if an invalid flag entry within a configuration can invalidate the whole configuration. |
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.
I think a JSON document is either invalid or valid, so we don't have unlimited flexibility here unless we want to do some fairly annoying manipulation of the payload, either validating only 1 flag at a time (this might require breaking single flags into a subschema).
It might be possible to identify the specific sub-entity of an invalid configuration with the validation library, and remove it, but I think that might not be worth it or possible everywhere.
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.
we can select subsets for validating entities within the json schema, it will be one validation per flag, but i think it is better than invalidating the whole configuration.
* Utilize schema validation as much as possible, instead of custom logic, on a flag level rather than a configuration level. | ||
* Define what consistutes a `PARSE_ERROR` versus a `FLAG_NOT_FOUND`. | ||
* Define if an invalid flag entry within a configuration can invalidate the whole configuration. | ||
* Define which file formats are supported (e.g., JSON, YAML, etc.). |
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.
We should make this consistent, I think. It's pretty trivial to support YAML/JSON conversion in most cases, though there might be some edge cases to consider.
* Define what consistutes a `PARSE_ERROR` versus a `FLAG_NOT_FOUND`. | ||
* Define if an invalid flag entry within a configuration can invalidate the whole configuration. | ||
* Define which file formats are supported (e.g., JSON, YAML, etc.). | ||
* Ensure the framework is testable via the existing testbed/test-harness. |
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.
💯
f6ca172
to
a20d36e
Compare
1. **Schema Validation**: Use schema validation to ensure that flags meet predefined criteria. This reduces the reliance on custom logic and improves consistency across implementations. | ||
2. **Supported File Formats**: Define and document the file formats that are supported (e.g., JSON, YAML). This aligns with the issue raised in [BUG] [File Provider] Support File Formats (#1689). | ||
3. **Error Definitions**: Clearly define what constitutes a `PARSE_ERROR` versus a `FLAG_NOT_FOUND` error. Each inconsistent flag should evaluate as a `PARSE_ERROR`, only if the flag is not part of the configuration (or due to other definitions), it should evaluate to a `FLAG_NOT_FOUND` | ||
4. **Invalid Flag Handling**: A invalid flag configuration should not affect the whole configuration. Other valid flags might still be important, and an error on one flag should not hinder updates or changes to the flag configuration. |
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.
I have to admit, I have a strong preference for failing to start up if the config is invalid in any way, and fully rejecting an update if it's invalid in any way. I think this is what most users expect from invalid configurations. I would be open to a switch that would ignore validation errors, in which case the behavior might not be well-defined (but it would allow us to test some of our edge cases).
I think removing invalid flags actually leads to more confusing behaviors, since flagd will start up but certain flags might just be missing due to a typo. I think it's better to simply not start up if any single flag is invalid. When an update is received, I think similarly - it's better if the entire update fails than a single flag is "silently" removed (only showing up in a log or something).
I also think implementing removal of only invalid flags will be tricky.
I'm really interested in other's opinions here though. Maybe I'm in the minority here.
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.
I would not remove them, I would persist them with a parse_error in the flag storage. this is now implementation specific for eg a hashmap:
- an existing key without a value is a parse_error reason
- an existing key with a flag, will trigger the resolution process
- a non existing key, is a flag not found
This way, we keep the user informed about possible flag issues, but ensure that updates for other flags are working.
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.
enhanced the proposal with flow diagrams for easier understanding of the proposed flow
@aepfli sorry, I started typing without selecting the textbox first and accidently closed the issue 😅 To summarize my alternative proposal:
Advantages:
Disadvantages:
|
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Authored-by: Simon Schrottner <simon.schrottner@dynatrace.com> Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
e79e0e7
to
3a2d568
Compare
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
3a2d568
to
a9b3444
Compare
@toddbaert I also added your proposal. I think it would be time to start some kind of vote - or give people the chance to add their remark - @open-feature/flagd-triagers please take a look |
relates to: #1690
This is the starting point, i think we should talk about what we want to achieve and how. My simple mind did not manage to come to another option i could propose, but i am open to add more options. please let me know what you think of this.