Repository navigation
Restore QTI exercises when restoring a channel - #6243
Conversation
826690b to
e919cbe
Compare
|
Outside this PR's scope — tracked under #5998:
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly How was this generated?
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1324c5d to
2a49103
Compare
rtibbles
left a comment
There was a problem hiding this comment.
More precise testing assertions would help here, but ultimately, not restoring in a broken way is key.
2a49103 to
5067b47
Compare
rtibbles
left a comment
There was a problem hiding this comment.
I am more confident that the code is actually doing what is intended in terms of setting the appropriate assessment_id - but the tests are too weak. If there are exceptions that need to be handled, that is fine, but we shouldn't weaken the assertions in the cases where the ids should be exactly replicated.
| self.assertEqual(self._file_rows(item), self._file_rows(source_item)) | ||
| if source_item.type == exercises.QTI: | ||
| # An editor item's identifier is not its assessment_id. | ||
| self.assertRegex(item.assessment_id, "^[0-9a-f]{32}$") |
There was a problem hiding this comment.
This assertion is too weak - it only asserts that the restored assessment_id is a valid 32 digit hex - not that it restored the original assessment id.
There was a problem hiding this comment.
Fixed in bd281a4: an editor item whose identifier encodes its assessment_id (hex_to_qti_id) now must restore that exact id. Both node tests (QTI-only and dual-published) gained such an item.
Only an item named by an editor slug (e.g. item_1) keeps the regex check. Neither the package nor Kolibri's assessment_item_ids records its source assessment_id, so restore has to mint a new one.
Searched test_restore_channel.py for format-only assessment_id assertions and found 2:
_assert_restores_source_rows: changed as above.test_editor_item_with_non_canonical_id_gets_a_new_assessment_id: left as is. Its identifier encodes no id, so there is no source id to compare against.
5067b47 to
bd281a4
Compare
Exercises with a qti_zip restore every manifest item as type=qti with its images. A dual node's exercise archive holds QTI ids, so it is not a fallback: an unusable package restores no items. A converted legacy item gets back the assessment_id its identifier encodes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Packaged Perseus custom interactions restore with their hex assessment_id, images and graphies instead of landing as qti items. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Fixed fixture ids whose QTI encodings hold "-" and "_"; expected ids stated per test - Publish a restored legacy-only node through create_content_database Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Outside this PR's scope — tracked in:
Written by rtibblesbot, an LLM-based coding agent. |
bd281a4 to
fa8e58f
Compare
rtibbles
left a comment
There was a problem hiding this comment.
This now appears to properly encode and decode the assessment ids - this is good to go.
|
Quick check on rtibblesbot's work on this PR: react 👍 helpful · 😕 mixed · 👎 not helpful. Reply with anything specific. |
Summary
restore_channelrebuilt questions only from an exercise's Perseus archive. QTI-only exercises restored with no questions; dual-published ones restored QTI item ids asassessment_ids, which broke publishing.References
Fixes #6211
Reviewer guidance
qti_zipfile, questions restore from it and theexercisearchive is ignored. Nodes with only anexercisearchive restore as before.type=qtiwith XML inraw_data; item images are attached asEXERCISE_IMAGEfiles.assessment_iditsK…identifier encodes; a QTI editor item, whose id is in neither archive, gets a fresh one.perseus_question, keyed by the hex inperseus/<hex>.json.get_assessment_item_resources_from_manifestinimsmanifest.py).EXERCISE_GRAPHIEfiles.exercisearchive, whose QTI ids cannot republish.AI usage
Implemented by Claude Code following a pre-approved plan with TDD. Python tests ran in CI on fork verify branches (the agent's sandbox blocks Postgres): full suite passes on the branch and on its second commit alone.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
🟡 Waiting for feedback
Last updated: 2026-10-06 04:46 UTC