feat: land ricecooker assessment items as QTI#6032
Open
rtibblesbot wants to merge 1 commit into
Open
Conversation
Refactor create_exercises to delegate item construction and schema validation to AssessmentItemSerializer instead of duplicating that logic. Native QTI (editor-shaped or arbitrary) is persisted and schema-validated directly; legacy/structured questions are converted to QTI on ingest; raw Perseus passes through unchanged; a Perseus custom interaction is unwrapped back to its raw perseus_question by reading its data-perseus-path payload. Referenced media is mapped via the existing map_files_to_assessment_item helper. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Ricecooker's internal ingest endpoint built
AssessmentItems directly and validated onlyassessment_iduniqueness, so malformed QTI, unconverted legacy question types, and Perseus content wrapped for republishing could all land in Studio unchecked.create_exercisesnow delegates item construction and schema validation toAssessmentItemSerializer: native QTI is validated and persisted as-is, legacy/structured questions are converted to schema-valid QTI on ingest, raw Perseus passes through unchanged, and a Perseus custom interaction is unwrapped back into a rawperseus_questionby reading its declared payload file. Referenced media is mapped for every resulting item.References
Fixes #6002.
Reviewer guidance
views/internal.py:987-996—set_files()auto-creates a strayFilerow per QTI media reference duringserializer.save(); the watermark-then-delete cleanup removes it before the real attach. Check this can't race a concurrent upload from the same user landing in the same window.views/internal.py:972-976— DRF'sValidationErroris caught and re-raised asNodeValidationError; confirm the wrapped message (e.detail) still gives ricecooker callers an actionable error rather than a generic DRF error dict.viewsets/assessmentitem.py:147— widened theraw_datavalidation to also acceptPERSEUS_QUESTION, not justQTI. Confirm this can't be used to smuggleraw_dataedits into aPERSEUS_QUESTIONitem through the browser-editor sync API in a way that wasn't intended.AI usage
Used Claude Code to implement the refactor from an existing task plan and write the accompanying tests. Verified with the full affected test suite and the repo's pre-commit hooks.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
🟡 Waiting for feedback
Last updated: 2026-07-05 05:21 UTC