-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactor: reuse services and wrappers between XBlocks (fixed) [FC-0026] #32779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: reuse services and wrappers between XBlocks (fixed) [FC-0026] #32779
Conversation
|
Thanks for the pull request, @Agrendalath! As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion. |
|
@ormsbee, I included the fix in a separate commit (7bd5d941c14940d0737f5be7d054d4d0a03ace76) to make it easy to locate. |
This re-applies commit 36cc415 with handling an invalid context_key in the `PartitionService`. It can happen when rendering a `LibraryContentBlock` in Studio because this service is initialized by the modulestore when validating an XBlock to gather its error messages in the `studio_xblock_wrapper`.
7bd5d94 to
a44a5e0
Compare
|
@Agrendalath 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
|
2U Release Notice: This PR has been deployed to the edX production environment. |
|
@Agrendalath @ormsbee Hey there 👋. However unfortunate, the LTI xblock code imports and uses the I know there's a much larger discussion that has to be had about why the LTI library should not import this function and how we can refactor the library to no longer do so, but, in the interim, can you please give me a heads up before you merge future pull requests with changes to this function? I know this is likely a frustrating ask, but if we can get any advance notice that the LTI library will break, that would be very helpful as we consider next steps for addressing this dependency. I'm just trying to mitigate future problems while we search for a solution. Alternatively, if you could tell me whether you have additional planned work in this area, that would also be helpful. Thank you for your understanding. |
|
@michaelroytman: Sorry, I had completely forgotten that |
|
@michaelroytman, ah, sorry for breaking this. Initially, I didn't plan to merge |
Description
This is #32420, with a fix added to the
xmodule/partitions/partitions_service.pyfile.This re-applies commit 36cc415 (#32420) with handling an invalid context_key in the
PartitionService(xmodule/partitions/partitions_service.py). It can happen when rendering aLibraryContentBlockin Studio because this service is initialized by the modulestore when validating an XBlock to gather its error messages in thestudio_xblock_wrapper.Supporting information
Why didn't it happen before #32420?
In #31472, we unified the
ModuleSystemand theDescriptorSystem. To simplify things, we introduced a_runtime_servicesattribute (a dict), which took precedence over the native_servicesattribute.This way, we were never using the
partitionsservice generated by thecreate_runtimemethod when the runtime was "bound" for a user by a previously rendered XBlock.What alternatives did you consider?
I considered adding
if not isinstance(course_entry.course_key, LibraryLocator):above https://github.com/openedx/edx-platform/blob/aa7370c773dcd96850fbda8e4f6ad40950c10547/xmodule/modulestore/split_mongo/split.py#L3290 and to other ModuleStores. However, the partition generation process supports the plugins, which don't seem to be open-sourced, so I cannot determine if it wouldn't introduce other regressions.Why was it happening only in Studio, not LMS/Preview
That's because the unbound
LibraryContentBlockis validated only in thestudio_xblock_wrapper.htmltemplate. This invokes theLmsBlockMixin, which (for an unknown reason) is included in CMS configs. As mentioned in this comment, it was already the case over six years ago when theEnrollmentTrackUserPartitionwas implemented.As an alternative solution, we could ensure that https://github.com/openedx/edx-platform/blob/fd191db332d01a47b1c79f684617eafd81abda3d/lms/djangoapps/lms_xblock/mixin.py#L156 is invoked only in Studio. However, the
Nonevalue handling is easier to understand and less error-prone than this.