-
Notifications
You must be signed in to change notification settings - Fork 218
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
refactor(flipt/validate): build entire snapshot on validate #2093
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2093 +/- ##
==========================================
- Coverage 70.81% 70.76% -0.06%
==========================================
Files 73 73
Lines 7011 7042 +31
==========================================
+ Hits 4965 4983 +18
- Misses 1761 1774 +13
Partials 285 285
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@GeorgeMac I think a warning log for what we fail silently for makes sense for now so its not a breaking change. Maybe we can have a deprecation path forward that would make strict mode the default in the future. |
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.
im good with making this a somewhat breaking change tbh
* 'main' of https://github.com/flipt-io/flipt: refactor(flipt/validate): build entire snapshot on validate (#2093)
* main: refactor(flipt/validate): build entire snapshot on validate (#2093)
Fixes #2086
Fixes: FLI-568
This is a draft while we consider the proposed change.
The outstanding change needed to deliver this is a decision around referential integrity error enforcement.
This PR changes a few things, however, primarily it builds an entire store snapshot on
flipt validate
.Doing this means we can get full confidence that a snapshot can be built from a target set of configuration on validate.
This give full confidence during e.g. a CI step.
To achieve this however, I have actually added the CUE validate step to the snapshot builder itself.
Meaning now, failures to validate via the CUE schema will fail snapshot building at runtime.
(This never happened before and the snapshot builder could be more lenient than the CUE schema).
When I did this, I found a couple constraints that I laxed in the existing CUE schema:
So, merging this, we might be introducing more stringent validation to the FS backends at runtime.
That said, the parity between the snapshot and building should mean that flipt validate is all the confidence you need.
Beyond this, this also update
flipt validate
so that it can take zero or more paths.Zero paths used to mean, validate nothing.
Now it means, perform the same process as the FS backends. Meaning, attempt to parse the flipt index file and find all the files that match it (defaulting to the features.yaml files we default to now).
flipt validate
can still be called with existing files, and only those files will be validated.Outstanding Decision
Currently, the fs backend snapshot builder will just fail silently when references cant be resolved.
For example:
flipt/internal/storage/fs/snapshot.go
Lines 364 to 367 in a4d2662
We need to decide how to proceed here, in order to surface these as errors at validation time.
Depending on the decision, this may be considered a breaking change.
This would be the breaking change for anyone currently just relying on the silent dropping of unreferenceable resources.
This idea is to add a warning log to these sites.
Then we could add a flag to both Flipts backend and
flipt validate
that could cause Flipt to fail fast in these situations.For example,
--strict
.This is obviously something that might be easy to miss, so has to be considered.
Maybe it is safe right now to just cut over and break this behaviour.
Update:
We chose to move forward with the breaking change.
So this PR introduces an error when a distributions variant cannot be resolved (as it does not exist).