112832 added the segments field to the NimbusExperiment model.
It did not add it to the NimbusReviewSerializer, which caused the serializer to infer a default serializer for the field which marks it as a required field.
Therefore, the NimbusReviewSerializer was always throwing before we hit its validate() method (due to the invalid segments field), which prevented the majority of the validation from running.
And the front-end was not checking the ready property from the useReviewCheck() hook, which allowed launching invalid experiments.
Our tests were always creating NimbusExperiments with non-empty segments fields.
This commit:
Adds a segments field to the NimbusReviewSerializer which makes the field optional.
Adds a test that explicitly creates a NimbusExperiment with an empty segments field and verifies it does not raise a ValidationError. (This test fails without the changes to the serializer.)
Changes our NimbusExperimentFactory to randomly use between 0 and 2 values for segments, primary_outcomes, and secondary_outcomes so that we have broader test coverage over all possible inputs.
Updates our front-end to use the ready key instead of invalidPages to prevent launches.
Updates the front-end to instruct users to come to #ask-experimenter if ready is false but there are no invalid pages (i.e., they've hit a programming error).
Because:
112832 added the
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