Skip to content

fix: save video asides during XML course import - #36500

Merged
pdpinch merged 1 commit into
openedx:masterfrom
mitodl:asad/save-video-asides-during-course-import
Apr 22, 2025
Merged

fix: save video asides during XML course import#36500
pdpinch merged 1 commit into
openedx:masterfrom
mitodl:asad/save-video-asides-during-course-import

Conversation

@asadali145

@asadali145 asadali145 commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Description

During course import, the video asides are not loaded from the XML properly. This results in inconsistent states after the export and reimport of a course. This works fine for the Problem and Other blocks.

This PR saves the Asides for the videos during course XML import.

Supporting information

#36489

Testing instructions

  • Checkout master branch
  • Create an Aside that applies to video blocks and problem blocks.
    • Alternatively, you can use ol_openedx_chat

      • Create a studio config in CMS Admin at /admin/xblock_config/studioconfig/. Keep it enabled.
      • Go to the CMS Shell and run pip install ol-openedx-chat
      • Now restart CMS
      • Go to {LMS_BASE_URL}/admin/waffle/flag/ and add waffle flag ol_openedx_chat.ol_openedx_chat_enabled. Keep it enabled.
      • Now go to Any course in CMS, and open advanced settings.
      • Now add the below code in Other Course Settings
       {
          "OL_OPENEDX_CHAT_PROBLEM_BLOCK_ENABLED": true,
          "OL_OPENEDX_CHAT_VIDEO_BLOCK_ENABLED": true
       }
      
      • If you cannot find Other Course Settings, you will need to enable it by doing FEATURES["ENABLE_OTHER_COURSE_SETTINGS"] = True in CMS settings.
      • Once all of this is done, you can go to a Unit in the CMS. You will see Enable AI Chat Assistant against problem and video blocks.
  • Now, change the Aside fields to a value other than the defaults.
  • Export the course
  • Import it in another course in CMS.
  • You will notice that for videos, it does not retain the Aside state from the exported course. It retains the state for the Problems.
  • Now check out this branch and repeat the above steps.

Deadline

24-02-25
So that it is included in Teak.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 8, 2025
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @asadali145!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

1 similar comment
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @asadali145!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Apr 8, 2025
@asadali145 asadali145 moved this from Needs Triage to Ready for Review in Contributions Apr 8, 2025
@asadali145 asadali145 moved this from Ready for Review to Needs Triage in Contributions Apr 8, 2025
@asadali145
asadali145 force-pushed the asad/save-video-asides-during-course-import branch from 6e8e8fe to cd5bb97 Compare April 9, 2025 07:27
@mphilbrick211 mphilbrick211 added the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label Apr 14, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Apr 14, 2025
@asadali145
asadali145 force-pushed the asad/save-video-asides-during-course-import branch from 1d4cc75 to 18c7747 Compare April 15, 2025 11:45
@asadali145
asadali145 requested a review from a team April 15, 2025 12:19
@ormsbee
ormsbee self-requested a review April 15, 2025 22:52
@ormsbee

ormsbee commented Apr 15, 2025

Copy link
Copy Markdown
Contributor

Does this affect any XBlock class that overrides parse_xml? Like ORA for instance?

@asadali145

asadali145 commented Apr 16, 2025

Copy link
Copy Markdown
Contributor Author

Does this affect any XBlock class that overrides parse_xml? Like ORA for instance?

@ormsbee No, this won't affect any other XBlocks. This PR just fixes the VideoBlock.

@ormsbee

ormsbee commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Sorry, I realize this fix only affects VideoBlock. But does the bug that it's fixing for videos also happen with other XBlocks that implement their own parse_xml, like ORA?

@asadali145

Copy link
Copy Markdown
Contributor Author

Sorry, I realize this fix only affects VideoBlock. But does the bug that it's fixing for videos also happen with other XBlocks that implement their own parse_xml, like ORA?

@ormsbee Yes, this bug exists in ORA. I looked at the code, and XBlock Asides are not handled in parse_xml. Then, I tested it with our plugin.

Any XBlock that overrides the parse_xml but does not handle the asides should have this bug.

@ormsbee

ormsbee commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Is there a way we can add support at the LMS runtime or xblock repo level so that third-party XBlocks can support asides by default, without having to understand anything about them?

@asadali145

Copy link
Copy Markdown
Contributor Author

Is there a way we can add support at the LMS runtime or xblock repo level so that third-party XBlocks can support asides by default, without having to understand anything about them?

@ormsbee Sorry, my reply took longer than expected.

I don't have enough in-depth context of XBlock and the LMS Runtime, so my analysis might be wrong. Here are my thoughts on this:

  • All of the XML import code that's also responsible for parsing the asides exists in edx-platform. Adding support to the XBlock repo is very much impossible because we don't really interact with the XBlock internals during the parsing. Some responsible classes and methods for Parsing are:
    • XMLModuleStore recursively parses the XML and, in the process, calls the XMLMixin.parse_xml for all of the course blocks.
    • XMLMixin.parse_xml is responsible for parsing the asides. This is one that's overridden by the Video and ORA blocks and responsible for parsing the Asides.
    • ImportSystem is the runtime that is responsible for processing the XML string to XBlock.
  • Adding support to LMS Runtime will require refactoring and is also complex due to the checks around the runtime type. ImportSystem is the import runtime.
  • Any other approaches:
    • We might be able to add some support in CourseImportManager. Saying this, I think we should have someone with more domain knowledge take a deeper look and we may find a better approach.

Also, we would like to get this PR reviewed & merged before Teak as the general fix requires more time.

I am attaching the code flow for a Problem block that is followed when parsing the Asides for a Problem Block.

asides_parsing_trace.txt

@ormsbee

ormsbee commented Apr 21, 2025

Copy link
Copy Markdown
Contributor

Also, we would like to get this PR reviewed & merged before Teak as the general fix requires more time.

Sure, that's fair, and I'll review this as a local fix. My primary concern is that asides will be much more useful and easier to maintain over the long term if XBlock authors have to really understand them and account for them in their own code. And asides are much less likely to get deprecated over the long term if they are both useful and easy to maintain.

FYI to @kdmccormick

Reviewing this now...

@asadali145
asadali145 force-pushed the asad/save-video-asides-during-course-import branch from 18c7747 to 797438e Compare April 22, 2025 19:00
@pdpinch
pdpinch merged commit 2eb0adb into openedx:master Apr 22, 2025
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Contributions Apr 22, 2025
@openedx-webhooks openedx-webhooks removed the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label Apr 22, 2025
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@ormsbee

ormsbee commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

@kdmccormick: do we have to worry about Asides breaking when built-in XBlocks are extracted?

@kdmccormick

Copy link
Copy Markdown
Member

@ormsbee Can you be more specific about what you think would break?

If someone's aside directly references XBlock code in edx-platform, then yes, that will break. It will also break if it directly references the dotted path of the block's class (xmodule.html_block.HtmlBlock).

But if someone's aside just depends on the XBlock framework APIs and block tag (e.g. html) then nothing should break. It would be good for us to test with some existing aside to be sure.

@ormsbee

ormsbee commented Jul 21, 2025

Copy link
Copy Markdown
Contributor

@kdmccormick: I'm not worried about people importing directly from edx-platform, only that if they make an Aside that wraps html blocks, that it continues to work after HTMLBlock is extracted, given this issue:

@kdmccormick

Copy link
Copy Markdown
Member

I see. I'll keep this in mind, and follow up on the issue you linked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants