Skip to content

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

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

irfanuddinahmad wants to merge 10 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. xblock_video.VideoBlock has been the default since USE_EXTRACTED_VIDEO_BLOCK = True, so the built-in code no longer runs.

Part of the Slash-n-Burn Built-In XBlocks epic. Closes openedx/public-engineering#539

Merge status: ✅ ready for review.
Known gaps (pre-existing, not regressions; master behaves the same):

Changes

Deleted: xmodule/video_block/ (video_block.py, video_utils.py, video_xfields.py, __init__.py), VideoBlockDisplay.css and VideoBlockEditor.css, the VideoBlockDisplay/VideoBlockEditor webpack entries, the built-in video and videoalpha entrypoints, and the USE_EXTRACTED_VIDEO_BLOCK toggle.

Modified:

  • lms/djangoapps/course_api/blocks/transformers/video_urls.py: rewrite_video_url is inlined here, its only caller.
  • Every import of VideoBlock and every mock.patch target under xmodule.video_block.* now points at xblock_video, including the newer cms/.../test_youtube_transcripts.py.

Tests:

Removed from the platform Counterpart in xblocks-core
xmodule/tests/test_video.py (37 tests, imported _BuiltInVideoBlock) src/xblock_video/tests/: same names; 35 near-identical, 2 adapted to the extracted block's service and patch targets

Kept in the platform (they use BaseTestXmodule, so they already ran against the extracted block; supersedes openedx/xblocks-core#264 and #265):

  • lms/djangoapps/courseware/tests/test_video_handlers.py and test_video_mongo.py, with test names and assertions unchanged. Changes: the toggle branch collapsed to the extracted path; xmodule.video_block.video_block.edxval_api.<fn> patches now target edxval.api.<fn> (the old target was that module anyway); xmodule.video_block.VideoBlock.<method> patches now target xblock_video.VideoBlock.<method>; instantiate_block/VideoBlockTestBase copied in from the deleted test_video.py, since the xblocks-core wheel doesn't ship tests.

Epic Step 1: Post-extraction commit review

Toggle flipped 2026-03-16 (59d152d210). All 5 later commits to xmodule/video_block/ are cosmetic (deprecation markers #38174, ruff suppression, import sorting ×2, lint-amnesty). Nothing to port.

Test plan

Tested on a local Tutor nightly (master 6f85d63c7f + xblocks-core 2.0.0) through the REST APIs and a headless browser, because PR sandboxes aren't deploying (open-craft/pr-sandbox-automation#28). A box is ticked only if that flow actually ran.

  • LMS student view
  • CMS course unit
  • CMS V2 Library
  • CDN-hosted video URL (rewrite_video_url was inlined): covered by test_video_urls.py (3 passed); not exercised with a real CDN config
  • CI: 17 pytest paths, about 660 tests locally, including the kept test_video_handlers.py and test_video_mongo.py, test_video_urls.py, test_video_xml.py, test_youtube_transcripts.py, test_transcripts.py; npm run build
V2 Library checklist: 9/15 pass (L8, V4, V5 hit the pre-existing gaps above; V1, V3 playback and L10 export diff not checked)

Content Libraries V2: smoke tests (historically the most fragile area for extracted blocks: openedx/xblocks-core#123, openedx/xblocks-core#132, openedx/xblocks-core#243, openedx/xblocks-core#274)

  • L1. Create the block in a V2 library; the preview renders with no 500 or console errors
  • L2. Edit → save → reload the page → reopen the editor: every field kept its value
  • L3. Publish the component; its status changes to Published
  • L4. Copy to clipboard from the library, then paste into the library and into a course unit
  • L5. In a library unit: add the block as new content, then add it as existing library content (watch for "There was an error linking the content to this container", [Test failure] TC-00338: Libraries: Unable to add existing component to a unit wg-build-test-release#556)
  • L6. Reuse in a course: add it through "Library content" in a unit, and reuse a library unit containing it from the course outline. Both render in Studio and in the LMS student view
  • L7. Sync: edit and publish in the library, then accept the update in the course and also ignore one
  • L8. Override the title on the reused copy in the course — not ticked: the override is overwritten on sync. Pre-existing: the built-in and extracted editor_saved are identical and don't record downstream_customized (Video: course-side title override of a library-synced Video is lost on sync (editor_saved doesn't call super) xblocks-core#326)
  • L9. Library search: filtering by content type finds the block
  • L10. OLX: import as a pointer tag and inline, export as a pointer tag, and diff the export against master (which still has the built-in block) — not ticked: inline and pointer-tag import and pointer-tag export pass; the export diff against the built-in block wasn't done

Video-specific (from ULMO TC-00323/00324/00325, the Video test report and #37829 notes):

Library checklist compiled from the Aximprovements manual test doc (Extracted Block Tests tab) and the Ulmo test sheet's library cases. Generated using Claude Code.

Screenshots

5 screenshots (LMS, Studio unit, V2 Library)

Local Tutor nightly, 2026-11-12

Captured automatically during the local smoke tests (the sandbox isn't reachable yet, see open-craft/pr-sandbox-automation#28). All images: irfanuddinahmad/edx-platform@snb-smoke-screenshots/38750.

LMS student view (imported block) Studio course unit (authoring MFE)
lms_inline studio_unit
V2 library home V2 library component preview
library_home lib_preview
LMS: copy reused from the library (after sync + title override)
lms_reused

🤖 Generated with Claude Code

Settings

# Workaround for open-craft/pr-sandbox-automation#28: the openedx-permissions image name gets mangled.
DOCKER_IMAGE_PERMISSIONS: docker.io/overhangio/openedx-permissions:23.0.0-main

@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

openedx-webhooks commented Jun 11, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @irfanuddinahmad!

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

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
@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
@irfanuddinahmad
irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-video-block branch from 395855b to ae23d30 Compare November 4, 2026 11:08
@irfanuddinahmad irfanuddinahmad added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Nov 5, 2026
Irfan Ahmad and others added 10 commits November 10, 2026 15:22
…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 <[email protected]>
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 <[email protected]>
… (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 <[email protected]>
…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 <[email protected]>
This test file was added on master after the branch was cut and still
imported the removed xmodule.video_block package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trib VideoBlock

test_video_handlers.py (41 tests) and test_video_mongo.py (50 tests) load
the block through the xblock entrypoint (BaseTestXmodule, CATEGORY='video'),
so they were already exercising the extracted VideoBlock. They are LMS
integration tests that cannot move to xblocks-core as-is, so keep them
here instead of deleting them (supersedes openedx/xblocks-core#264/#265).

- Drop the USE_EXTRACTED_VIDEO_BLOCK branch (keep the extracted path).
- Patch edxval.api.* directly. The old 'xmodule.video_block.video_block.
  edxval_api.X' targets resolved to the edxval.api module object anyway.
- Patch xblocks_contrib.video.VideoBlock.* instead of the removed shim.
- Move instantiate_block/VideoBlockTestBase out of the deleted
  xmodule/tests/test_video.py; xblocks-core does not ship its tests in the
  wheel, so they cannot be imported from there. VideoBlockTest now builds
  the extracted block (previously it built _BuiltInVideoBlock).

Test names and assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
xblocks-core 2.0.0 (#38473) removed the xblocks_contrib package. Point the
platform entrypoint, imports and mock.patch targets at the new per-block
packages (e.g. xblocks_contrib.video.video -> xblock_video.block).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
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). create-sandbox open-craft-grove should create a sandbox environment from this PR 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.

[Refactor] Slash-n-Burn Video BuiltIn XBlock

2 participants