bug(nimbus): Prevent mismatches between NimbusReviewSerializer and the front-end allowing invalid experiments #11773
+71
−16
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.
Because:
segments
field to theNimbusExperiment
model.NimbusReviewSerializer
, which caused the serializer to infer a default serializer for the field which marks it as a required field.NimbusReviewSerializer
was always throwing before we hit itsvalidate()
method (due to the invalidsegments
field), which prevented the majority of the validation from running.ready
property from theuseReviewCheck()
hook, which allowed launching invalid experiments.NimbusExperiment
s with non-emptysegments
fields.This commit:
segments
field to theNimbusReviewSerializer
which makes the field optional.NimbusExperiment
with an emptysegments
field and verifies it does not raise aValidationError
. (This test fails without the changes to the serializer.)NimbusExperimentFactory
to randomly use between 0 and 2 values forsegments
,primary_outcomes
, andsecondary_outcomes
so that we have broader test coverage over all possible inputs.ready
key instead ofinvalidPages
to prevent launches.ready
is false but there are no invalid pages (i.e., they've hit a programming error).Fixes #11767