Refactor or deprecate parent-child relationships between XBlocks
Open
@kdmccormick is already working on this.
Since Nov 10, 2025.
- Dominant language
- Python
- Stars
- 470
- Forks
- 231
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 6
Description
This would be a long-term initiative. It probably belongs on the platform-roadmap.
Context
We have decided that parent-child relationships should only exist at/below the VerticalBlock: https://github.com/openedx/edx-platform/blob/master/docs/decisions/0006-role-of-xblock.rst
We have further discussed that parent-child relationships in their entirety should be removed; I'm not sure if we came to a consensus on that.
TODO -- Add more context ( @ormsbee , @kdmccormick , and @bradenmacdonald ).
Tasks
Off the top of my head...
- File a DEPR encompassing our plan to:
- Remove parent-child relationships on the base XBlock class. Delete the _HasChildrenMetaclass. Move all parent-child logic to a new subclass, XBlockWithChildren. Make it
XBlock.has_childrena read-only class property. Some details. - Raise an exception if
get_parentis called at or above the VerticalBlock level. - For all XBlockWithChildren subclasses above the VerticalBlock (so, CourseBlock, SectionBlock, and SequenceBlock): Move their implementations to either Learning Core or edx-platform djangoapps.
- Remove parent-child relationships on the base XBlock class. Delete the _HasChildrenMetaclass. Move all parent-child logic to a new subclass, XBlockWithChildren. Make it
- Decide: Should parent-child relationships still exist at/below the Vertical block?
- Either way -> ADR it.
- Yes -> We're done.
- No -> File another DEPR encompassing our plan to:
- Raise deprecation warnings on the XBlockWithChildren class.
- For all remaining XBlockWithChildren subclasses in edx-platform (eg, LibraryContentBlock, SplitTestBlock):
Move their implementations to either Learning Core or edx-platform djangoapps. - Write guidance on how custom XBlockWithChildren subclasses can be similarly migrated. Ensure that, for example, OpenCraft's ProblemBuilder block can be migrated using this guide.
- Delete the XBlockWithChildren class, and delete all parent-child logic from the XBlock repository.
- Delete all parent-child logic from modulestore and edx-platform's XBlock runtimes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.