edx-platform
edx-platform copied to clipboard
[WIP][BD-13][BB-6709] refactor: Delete XModule compatibility code from `xml_module.py`
Description
Describe what this pull request changes, and why. Include implications for people using this change. Design decisions and their rationales should be documented in the repo (docstring / ADR), per OEP-19, and can be linked here.
Useful information to include:
- Which edX user roles will this change impact? Common user roles are "Learner", "Course Author", "Developer", and "Operator".
- Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
- Provide links to the description of corresponding configuration changes. Remember to correctly annotate these changes.
Supporting information
Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions. Be sure to check they are publicly readable, or if not, repeat the information here.
Testing instructions
Please provide detailed step-by-step instructions for testing this change.
Deadline
"None" if there's no rush, or provide a specific date or event (and reason) if there is one.
Other information
Include anything else that will help reviewers and consumers understand the change.
- Does this change depend on other changes elsewhere?
- Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
- If your database migration can't be rolled back easily.
Thanks for the pull request, @0x29a!
When this pull request is ready, tag your edX technical lead.
Posting my findings here for now, will add the most important parts to the PR description later.
Initial goal of this PR was to remove the compatibility code marked with VS[compat]
comments from xml_module.py
file. See the diff.
What exactly was this code for?
As far as I could understand, initially the platform didn't have Studio, and all courses consisted of a handwritten OLX. Back then, OLX wasn't standardized, so when Studio was created, edX has to add this compatibility code to 1) support both pre- and post-Studio course formats, and 2) be able to migrate these courses to Studio.
Specifically, the compatibility code adds the possibility to embed XML problem description right inside its tag, which should have been deprecated (example of before and after). Without the compatibility code (this, specifically), all problems have to be "pointer tags" and point at separate files.
What's the problem with just removing it?
It seems to be used to this day.
Removing this code breaks hundreds of tests. Most of them, including each from test_import.py, rely on course fixtures in the old format. I've tried importing toy course into the modern platform, exporting it and substituting the fixture OLX with the exported one. This made almost all tests from test_import.py passing, which suggests that they cover valid cases.
Another example of a failed test. It's using the problem with inline XML description, and likely tests something important, but without the compatibility code it can't be parsed, as poll_question
doesn't have url_name
attribute and doesn't point at a separate file. All such tests must be reworked.
Finally, cc2olx
tool generates OLX in the old format, so if we remove this compatibility code we'll need to update it too.
Questions
Is there a timeline for removing this code? I see that DataDog counters were added to track what code is using the compatibility code, but then they were removed. Also, tests with the "inline" OLX or importing cc2olx
-generated courses don't seem to emit any deprecation warnings. So, probably it was just marked as deprecated? @ormsbee, probably you can shed some light on this?
cc @Agrendalath
😞 Yeah, we can't break OLX as it's being used in the wild, and inline definitions like this are too pervasive at this point to deprecate. So that ability needs to stay, and probably will stay forever.
@ormsbee, thank you for confirming.
@Agrendalath, as you suggested, I expanded VS[compat]
comments. Please take a look.
@ormsbee, I realized I didn't give a "formal" +1. Would you like to check if we missed anything in the expanded explanations about the compatibility?
@0x29a 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.
EdX Release Notice: This PR has been deployed to the production environment.