Add QTI assessment-item type and renderable preset-bit ordering#229
Merged
Conversation
rtibbles
requested changes
Jul 3, 2026
| # APPEND-ONLY: never reorder or remove an existing entry — that would | ||
| # silently change the bit value of every preset after it and corrupt | ||
| # already-persisted bitmasks. Only append new preset ids at the end. | ||
| RENDERABLE_PRESETS_ORDER = [preset.id for preset in PRESETLIST] |
Member
There was a problem hiding this comment.
I don't think this needs to be every preset? It's intended to be renderable presets, so supplementary presets should be excluded from this list.
Contributor
Author
There was a problem hiding this comment.
Fixed — RENDERABLE_PRESETS_ORDER now filters to not preset.supplementary, dropping thumbnails/subtitles from the order. Updated the pinned-index test accordingly (qti is now 13, kpub is now 17) and added a test asserting supplementary presets are excluded.
Expose format_presets.RENDERABLE_PRESETS_ORDER as a stable, append-only preset id ordering so Studio and Kolibri derive File.included_presets bitmask positions from shared bit locations. Fixes learningequality#224 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
6c7b124 to
c1c7084
Compare
rtibbles
approved these changes
Jul 3, 2026
rtibbles
left a comment
Member
There was a problem hiding this comment.
Looks good - the test helps accidental breakage of the order pin.
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
Adds two small constants consumed by Studio and Kolibri (issue #224):
exercises.QTI— a new assessment-item type, appended toquestion_choices. Uppercase is deliberate: Studio'sAssessmentItem.typechoices are built fromquestion_choices, and studio#5999 already pins the literal astype='QTI'.format_presets.RENDERABLE_PRESETS_ORDER— a stable, append-only preset-id ordering backing theFile.included_presetsbitmask (bit position = list index; consumers compute2 ** indexthemselves). Sourced fromPRESETLIST's existing order rather than the hand-writtenchoicestuple in the same file, since the two orderings have already drifted apart andchoiceshas precedent for silently dropping an entry.References
Fixes #224 (studio #1, studio #8, kolibri #10)
Reviewer guidance
format_presets.py:RENDERABLE_PRESETS_ORDERmust stay append-only — reordering or removing an entry changes the bit value of every preset after it and corrupts already-persisted bitmasks in Studio/Kolibri. New presets must only be appended.tests/test_presets.py::test_RENDERABLE_PRESETS_ORDER_index_is_stablepins a few known indices as a regression check against accidental reordering.AI usage
Implemented with Claude Code per the plan in
.plans/index.md.@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
Status: 🟡 Waiting for feedback · updated 2026-07-03 03:41 UTC