Content Core Platform Simplification

This work is being in https://openedx.atlassian.net/wiki/spaces/COMM/pages/3062333478.

Scope and Benefits

Unify DescriptorSystem and ModuleSystem

  • Eliminate a historically common source of difficult to diagnose memory leaks.

  • Remove redundant implementations of courseware services (e.g. course static asset linking).

  • Remove the single most confusing aspect of the XBlock runtime (descriptor vs. module system).

Simplify Serialization Code

  • Remove redundant serialization mechanisms used in import/export, another common source of bugs and developer confusion. This came up as an issue in recent import OLX validation work.

  • Separate XBlock instantiation from data initialization, to more cleanly decouple the storage layer and allow for a smoother transition to Blockstore (as well as more LMS-optimized storage in the future).

Prune Unused XModule-specific Code

  • Make the courseware internals more reliable and approachable for developers by removing special case handling, deleting redundant classes, and normalizing terminology.

  • Improve build times for static asset compilation.

  • Remove a lot of the complex magic of the runtime, like ProxyAttribute.

Discovery: XBlock Static Asset Modernization

  • Discovery to investigate ways to reduce the overhead of static assets that we need to send over to render courseware. We currently send far more in the way of CSS and JavaScript than we need to “just in case”, because we have no good way to determine what a piece of XBlock content’s static asset requirements actually are.

Milestones

Description

PRs

Status

Milestones

Description

PRs

Status

Unify DescriptorSystem and ModuleSystem

 

 

In Progress

Use Existing XBlock Services Instead of ModuleSystem APIs

In cases where equivalent capabilities are provided by existing XBlock Services, all code in edx-platform and other relevant repos will be updated to use those instead of the deprecated ModuleSystem APIs.

 

In Progress

Create XBlock Runtime Services

XBlock Runtime Services will be created for all remaining ModuleSystem APIs. Any code in edx-platform and other relevant repos using the legacy APIs will be updated to use the Services instead. This will give a consistent, predictable interface between XBlocks and Studio/LMS, instead of the haphazard platform imports that sometimes happen today.

 

In Progress

 

Remove Unused ModuleSystem APIs

Some APIs were added to the ModuleSystem many years ago for specific XModules. Any unused ones will be removed.

 

 

Migrate to Simplified XBlockRuntime Class

Once the above are complete, the DescriptorSystem, ModuleSystem and shim code will be replaced by the simplified XBlockRuntime class. LMS and Studio will be updated to use it.

 

 

 

 

 

 

Simplify XBlocks Serialization

 

 

 

Remove Unused Logic

There is unused serialization and deserialization logic in the code. This includes logic in a number of places which was added in 2012 to handle import of specific courses into MongoModulestore from the XMLModulestore, both of which were deprecated by 2015.

 

 

Update Serialization API

add_xml_to_node() is the official XBlocks API for serializing an XBlock data into XML. The converted XBlocks will be updated to use it and the legacy shim code will be removed.

 

 

Update Deserialization API

parse_xml() is the official XBlocks API for parsing OLX data. The converted XBlocks will be updated to use it and the legacy shim code will be removed.

 

 

Split Parsing and Instantiation

The parsing API does not distinguish between "instantiating a block, and initializing its fields with values parsed from XML" and "an instantiated XBlock is writing new values into some of its fields”. This forces us to use fragile hacks to make the BlockstoreRuntime to work properly. Once the legacy APIs and shim code have been removed, the parsing and instantiation will be refactored into separate explicit steps to allow getting rid of these hacks and simplify future work including creating Blockstore based storage for courses.

 

 

 

 

 

 

Prune Unused XModule-specific Code

 

 

 

Remove XModule-specific Static Asset Handling

There is an entire layer of deprecated static asset management methods that will only confuse developers. Removing this will improve static asset build times, reduce the complexity of the static build process, and remove a source of confusion for new developers.

 

 

Remove Unnecessary Modulestore-internal Classes

With XModule compatibility no longer necessary, there are a number of classes that can be removed entirely, simplifying the codebase. Some bits of them may need to be moved to other classes:

  • XModule and XModuleDescriptor

  • ProxyAttribute + module_attr, descriptor_attr, module_runtime_attr

  • StudioEditableModule, StudioEditableDescriptor, EditingDescriptor

  • Remove or update tests that refer to the above.

 

 

Terminology Cleanup

There are many ways to refer to XBlocks in the system: XBlocks, blocks, descriptors, modules, items. Applying consistent conventions throughout the edx-platform repo will make the code and documentation more approachable.

 

 

 

 

 

 

Discovery: XBlock Static Asset Modernization