fix: allow restoring content with blank titles#610
Draft
kdmccormick wants to merge 1 commit into
Draft
Conversation
Restoring a library archive failed whenever any unit (or other container/component) version had a blank title. Blank titles are legal (PublishableEntityVersion.title is blank=True) and common -- content imported from courses via the modulestore migrator frequently has untitled units, and such content can be backed up. The version title round-trips as an empty string, but EntityVersionSerializer.title used CharField(required=True), which defaults to allow_blank=False, so the empty string failed validation and aborted the whole restore. Set allow_blank=True so blank titles validate. The library_backup fixture's unit1 now has a blank title to exercise this path, with a regression test asserting it restores correctly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ormsbee
approved these changes
Jun 22, 2026
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.
Description
Restoring a library archive failed whenever any unit (or other container/component) version had a blank title. Blank titles are legal (
PublishableEntityVersion.titleisblank=True) and common — content imported from courses via the modulestore migrator frequently has untitled units, and such content can be backed up.The version title round-trips as an empty string, but
EntityVersionSerializer.titleusedCharField(required=True), which defaults toallow_blank=False, so the empty string failed validation and aborted the whole restore. This setsallow_blank=Trueso blank titles validate.The
library_backuptest fixture'sunit1now has a blank title to exercise this path, with a regression test asserting it restores correctly.Related issue
Fixes openedx/openedx-platform#38611
Manual testing instructions
This is the updated library from the test suite:
fixture-library.zip
Restore it on master gives:
Restoring it on this PR's sandbox works (TODO need to verify this once the sandbox is up!)
Other notes
allow_blankonly on entity version titles (units, sections, subsections, components). Learning package and collection titles are unchanged.AI
Generated by Claude Opus 4.8 with this prompt:
I reviewed the code and had it rework the test to be simpler.
Merge deadline
ASAP. We will want to backport this to Verawood before the release, which is probably next week.