[BD-13] [BB-5967] refactor: deprecate get_module and descriptor_runtime attributes from ModuleSystem #30436
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
Builds on the shim added by #29190 to deprecate the following
ModuleSystemattributes:get_module: in favour of the newModuleServicedescriptor_runtime: TheDescriptorSystemobject was passed toModuleSystemusing this attribute.This was used to access the
id_reader,id_generatorandget_blockproperties of the theDescriptorSystemfrom theModuleSystem. Each of these are now being handled differently as explained below and so thisdescriptor_runtimeattribute has been removed and has not been replaced with anything else.How the properties of
DescriptorSystemwhich were accessed fromModuleSystemare now being handled:id_reader: This property of theDescriptorSystemwas fetched to set theid_readerkeyword argument of theModuleSystemin its__init__method as this is required by the baseRuntimeclass. This is now being supplied during initialization as keyword argument from the calling functions.id_generator: Same asid_readerget_block: This property of theDescriptorSystemwas invoked from theget_blockmethod of theModuleSystemto fetch the block descriptor based onblock_idandfor_parent. This descriptor was then passed toget_modulemethod (being deprecated) to bind the user data and module system.As part of the PR, we have removed the
get_blockmethod from theModuleSystemand created a newget_blockmethod in theCombinedSystemclass. Here, theget_blockmethod of the descriptor_system is invoked to fetch the block. Further, its checked if the_module_systemis initalized and if it contains the newModuleService. If so, then this service is used to bind the user data and module system to the block descriptor.This change should not affect any user of edx-platform
Supporting information
BB-5967 - OpenCraft internal ticket
Testing instructions
LMS: https://pr30436.sandbox.opencraft.hosting/
Studio: https://studio.pr30436.sandbox.opencraft.hosting/
LMS:
Studio: