ValidationError: Completion criteria doesn't conform to schema #3879
Copy link
Copy link
Closed
Labels
Description
@bjester has observed completion criteria for some nodes getting saved in an invalid state, likely reproducible through quick repeated changes to the criteria in the frontend.
Sentry Issue: STUDIO-FGH
ValidationError: ["Completion criteria doesn't conform to schema", "object doesn't satisfy 'anyOf' conditions"]
File "contentcuration/viewsets/contentnode.py", line 406, in _check_completion_criteria
completion_criteria_validator.validate(completion_criteria, kind)
File "contentcuration/constants/completion_criteria.py", line 97, in validate
raise e
ValidationError: [ErrorDetail(string='["Completion criteria doesn\'t conform to schema", "object doesn\'t satisfy \'anyOf\' conditions"]', code=None)]
(3 additional frame(s) were not displayed)
...
File "rest_framework/serializers.py", line 703, in save
self.instance = self.update(self.instance, validated_data)
File "contentcuration/viewsets/contentnode.py", line 246, in update
all_objects = super(ContentNodeListSerializer, self).update(
File "contentcuration/viewsets/base.py", line 309, in update
instance = self.child.update(obj, obj_validated_data)
File "contentcuration/viewsets/contentnode.py", line 437, in update
self._check_completion_criteria(validated_data.get("kind", instance.kind_id), validated_data.get("complete", instance.complete), validated_data)
File "contentcuration/viewsets/contentnode.py", line 410, in _check_completion_criteria
raise ValidationError(e)
Reactions are currently unavailable
Activity
bjester commentedon Mar 28, 2023
Users encounter that these nodes become invalid and will not be published
akolson commentedon Jul 29, 2024
@bjester the referenced link
cant seem to be found. Maybe it's been deleted? Does it make a difference anyway considering we already have a copy of the traceback on the issue?
bjester commentedon Jul 29, 2024
@akolson Yeah even though the error in Sentry doesn't exist, I believe my description of the error is correct. We merge changes in the frontend, prior to syncing, and I believe that merge behavior can incorrectly handle object fields like completion criteria, which have a strict well defined schema.
bjester commentedon Jul 29, 2024
Update: talking and digging in with @ozer550, we do merge changes but we merge them when we fetch. so there's still a theoretical chance we can merge incorrectly. I suggested a regression test on
combineUpdateAndUpdatemight illuminate the possibility it could produce invalid completion criteriaradinamatic commentedon Aug 27, 2024
Tried to change the completion criteria to more than 10 HTML5 resources in a row as fast as a could 🏃🏽♀️ ⏩
Not sure if any sentry errors occurred, but noting concerning user-facing was happening in the front-end, good job! 👍🏽
akolson commentedon Aug 27, 2024
It doesn't look so @radinamatic! All seems good in sentry 🎉