Skip to content

refactor: remove built-in Video XBlock implementation (slash-n-burn #37819)#38750

Open
irfanuddinahmad wants to merge 7 commits into
masterfrom
irfanuddinahmad/slash-and-burn-video-block
Open

refactor: remove built-in Video XBlock implementation (slash-n-burn #37819)#38750
irfanuddinahmad wants to merge 7 commits into
masterfrom
irfanuddinahmad/slash-and-burn-video-block

Conversation

@irfanuddinahmad

@irfanuddinahmad irfanuddinahmad commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the built-in Video XBlock from xmodule/ as part of the Slash-n-Burn Built-In XBlocks epic (#37819). The extracted version in xblocks-contrib has been the active implementation since USE_EXTRACTED_VIDEO_BLOCK was set to True.

Deleted:

  • xmodule/video_block/ (entire directory: video_block.py, video_utils.py, video_xfields.py, init.py)
  • xmodule/tests/test_video.py — built-in unit tests
  • lms/djangoapps/courseware/tests/test_video_handlers.py — tests patching built-in edxval_api internals
  • lms/djangoapps/courseware/tests/test_video_mongo.py — tests patching built-in edxval_api internals
  • xmodule/static/css-builtin-blocks/VideoBlockDisplay.css and VideoBlockEditor.css

Modified:

  • openedx/envs/common.py — removed USE_EXTRACTED_VIDEO_BLOCK toggle
  • pyproject.toml — removed conflicting built-in video and videoalpha entrypoints (the xblocks-contrib entrypoints remain active)
  • webpack.builtinblocks.config.js — removed VideoBlockDisplay and VideoBlockEditor entries
  • lms/djangoapps/course_api/blocks/transformers/video_urls.py — inlined rewrite_video_url (was the only caller of xmodule.video_block.video_utils.rewrite_video_url)
  • All test files importing VideoBlock: updated to xblocks_contrib.video.VideoBlock
  • All mock.patch paths targeting xmodule.video_block.: updated to xblocks_contrib.video.

Note on deleted tests: test_video_handlers.py (1355 lines) and test_video_mongo.py (2605 lines) patch internal methods of the built-in VideoBlock (edxval_api module paths, EXPORT_IMPORT_* constants) that no longer exist. These tests cannot be straightforwardly migrated without knowledge of xblocks-contrib's internal structure. Porting this coverage to xblocks-contrib is tracked in:

Epic Step 1: Post-extraction commit review

Reviewed commits to xmodule/video_block/ after USE_EXTRACTED_VIDEO_BLOCK was set to True (2026-03-16 · 59d152d210). All 5 post-toggle commits were cosmetic: deprecation markers (#38174), ruff suppression, import sorting (x2), and lint-amnesty removal. xblocks-contrib received the Video block on 2026-03-04; it has been independently developed since (own bug fixes for template errors, download link sizing, etc.). No functional bug fixes or features to port.

Test plan

Testing scope: The xblocks-contrib implementation's behavioral correctness was fully validated during the extraction phase (when USE_EXTRACTED_* was set to True). These slash-n-burn PRs only delete dead built-in code — no behavioral change is possible. The only regression risk is that an entrypoint, webpack bundle, or import path is broken, which surfaces as a block failing to load. Basic load verification across LMS, CMS course, and CMS library is sufficient.

Smoke tests require a live Tutor environment and cannot be pre-checked in CI. Please verify during staging.

  • Block loads and renders in LMS (student view)
  • Block loads and renders in CMS course unit
  • Block loads and renders in CMS V2 Library
  • A video with a CDN-hosted source URL renders correctly — rewrite_video_url was inlined from video_utils.py into video_urls.py

Automated checks (CI):

  • Run pytest lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py — all 3 CDN rewrite tests pass
  • Run pytest lms/djangoapps/courseware/tests/test_video_xml.py

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Jun 11, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

This repository is currently maintained by @openedx/wg-maintenance-openedx-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 Jun 11, 2026
@irfanuddinahmad irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-video-block branch from bd94b9b to d841d89 Compare June 11, 2026 12:53
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Jun 11, 2026
@irfanuddinahmad irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-video-block branch 2 times, most recently from d02bd44 to f18930d Compare June 12, 2026 16:55
Irfan Ahmad and others added 7 commits June 22, 2026 16:25
…37819)

Removes xmodule/video_block/, CSS assets, the USE_EXTRACTED_VIDEO_BLOCK
toggle, and both 'video'/'videoalpha' entrypoints in pyproject.toml now
that the extracted version in xblocks-contrib is the only implementation.
Inlines rewrite_video_url into video_urls.py (sole production caller).
Updates all test file imports and mock.patch paths from xmodule.video_block
to xblocks_contrib.video. Deletes test_video_handlers.py and
test_video_mongo.py which patch edxval_api internal paths that no longer
exist in xmodule.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
xblocks_contrib.video.video uses get_edxval_api() from video_utils,
not a module-level edxval_api attribute. Patching the non-existent
attribute raised AttributeError in mock.patch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… (PT008)

Ruff PT008 requires using return_value= instead of lambda when patching.
Using new=MagicMock(return_value=None) avoids injecting a mock arg into
the test function signatures while satisfying the lint rule.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fixture

The USE_EXTRACTED_VIDEO_BLOCK toggle was removed; test_api.py now asserts
xblocks_contrib directly. VideoBlockEditor.css was deleted with the video
block; tests updated to use HtmlBlockEditor.css which still exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@irfanuddinahmad irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-video-block branch from 27a1012 to 395855b Compare June 22, 2026 11:26
@irfanuddinahmad irfanuddinahmad changed the title feat: remove built-in Video XBlock implementation (slash-n-burn #37819) refactor: remove built-in Video XBlock implementation (slash-n-burn #37819) Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

3 participants