flagd icon indicating copy to clipboard operation
flagd copied to clipboard

docs(ADR): standardize Flag configuration parsing and error handling

Open aepfli opened this issue 4 months ago • 3 comments

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.

aepfli avatar Jul 17 '25 19:07 aepfli

Deploy Preview for polite-licorice-3db33c ready!

Name Link
Latest commit a9b3444ffb7fef7ca900ce6973dca254262dda18
Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/68d27c09afce1600089ee6eb
Deploy Preview https://deploy-preview-1692--polite-licorice-3db33c.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Jul 17 '25 19:07 netlify[bot]

@aepfli sorry, I started typing without selecting the textbox first and accidently closed the issue :sweat_smile:

To summarize my alternative proposal:

  • use https://flagd.dev/schema/v0/flags.json to validate the whole document, on each sync
  • at startup, if anything is invalid, flagd fails to start (this is already partially implemented; if we can't parse the flags configuration, so we'd just follow that same path)
  • on any sync update, if anything is invalid, the update is ignored and an error/warning message is logged louded (again, this is already partially implemented; if we can't parse the flags configuration, so we'd just follow that same path)

Advantages:

  • very easy to implement, just add a validation step in the exact same code-location we already parse
  • we can remove many of our "error-edge-cases" in our test suite, since they will never be allowed
  • we rely fully on a schema for validation so we don't have to implement any detailed error handling code

Disadvantages:

  • 1 bad flag will prevent a whole update - however, this is already true if a single flag cannot be parsed (invalid JSON or nonsense variant configuration, etc) so we can never fully remove this situation, so I think we should just embrace this flow

toddbaert avatar Jul 21 '25 16:07 toddbaert

@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

aepfli avatar Sep 23 '25 10:09 aepfli