
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: main
Observed behavior
BaseQuestion.validate() and its subclass overrides (PerseusQuestion, MultipleSelectQuestion, SingleSelectQuestion, InputQuestion) use bare assert statements for validation. When a question is invalid, these raise AssertionError directly.
Callers like ExerciseNode._validate() and UnitNode._validate() call question.validate() inside _validate_values(not question.validate(), ...), expecting a boolean return value. But the AssertionError propagates before _validate_values gets a chance to collect the error — so invalid questions produce raw AssertionError stack traces instead of structured InvalidNodeException.
Errors and logs
# Example: SingleSelectQuestion with no correct answer
Traceback (most recent call last):
File "...", line ...
assert correct_answers == 1, "Assumption Failed: Single selection question should have only one correct answer"
AssertionError: Assumption Failed: Single selection question should have only one correct answer
Instead of the expected InvalidNodeException with collected validation errors.
Expected behavior
Invalid questions should produce the same structured InvalidNodeException that other validation failures produce via _validate_values(). The error should be collected into the node's validation error list alongside any other validation issues, rather than immediately crashing with a raw AssertionError.
User-facing consequences
Chef authors debugging invalid questions see raw Python stack traces instead of the clear, aggregated validation error messages that ricecooker produces for all other node validation failures. This makes it harder to identify and fix content issues.
Steps to reproduce
- Create an
ExerciseNode with a SingleSelectQuestion that has zero correct answers
- Add it to a channel and trigger validation
- Observe
AssertionError instead of InvalidNodeException
Context
Affected files:
ricecooker/classes/questions.py — BaseQuestion.validate() (line ~226), PerseusQuestion.validate(), MultipleSelectQuestion.validate(), SingleSelectQuestion.validate(), InputQuestion.validate()
ricecooker/classes/nodes.py — ExerciseNode._validate() (line ~1247), UnitNode._validate() (line ~1644)
Acceptance Criteria
AI usage
Issue drafted by Claude during code review of the of_course branch. Description verified against source code in questions.py and nodes.py.
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: main
Observed behavior
BaseQuestion.validate()and its subclass overrides (PerseusQuestion,MultipleSelectQuestion,SingleSelectQuestion,InputQuestion) use bareassertstatements for validation. When a question is invalid, these raiseAssertionErrordirectly.Callers like
ExerciseNode._validate()andUnitNode._validate()callquestion.validate()inside_validate_values(not question.validate(), ...), expecting a boolean return value. But theAssertionErrorpropagates before_validate_valuesgets a chance to collect the error — so invalid questions produce rawAssertionErrorstack traces instead of structuredInvalidNodeException.Errors and logs
Instead of the expected
InvalidNodeExceptionwith collected validation errors.Expected behavior
Invalid questions should produce the same structured
InvalidNodeExceptionthat other validation failures produce via_validate_values(). The error should be collected into the node's validation error list alongside any other validation issues, rather than immediately crashing with a rawAssertionError.User-facing consequences
Chef authors debugging invalid questions see raw Python stack traces instead of the clear, aggregated validation error messages that ricecooker produces for all other node validation failures. This makes it harder to identify and fix content issues.
Steps to reproduce
ExerciseNodewith aSingleSelectQuestionthat has zero correct answersAssertionErrorinstead ofInvalidNodeExceptionContext
Affected files:
ricecooker/classes/questions.py—BaseQuestion.validate()(line ~226),PerseusQuestion.validate(),MultipleSelectQuestion.validate(),SingleSelectQuestion.validate(),InputQuestion.validate()ricecooker/classes/nodes.py—ExerciseNode._validate()(line ~1247),UnitNode._validate()(line ~1644)Acceptance Criteria
question.validate()methods returnFalsefor invalid questions instead of raisingAssertionError_validate()methods collect question validation errors through_validate_values()like all other validation checksInvalidNodeExceptionwith descriptive messagesAI usage
Issue drafted by Claude during code review of the
of_coursebranch. Description verified against source code inquestions.pyandnodes.py.