Skip to content

refactor: slash-and-burn Word Cloud BuiltIn XBlock#38745

Open
irfanuddinahmad wants to merge 2 commits into
masterfrom
irfanuddinahmad/slash-and-burn-word-cloud-block
Open

refactor: slash-and-burn Word Cloud BuiltIn XBlock#38745
irfanuddinahmad wants to merge 2 commits into
masterfrom
irfanuddinahmad/slash-and-burn-word-cloud-block

Conversation

@irfanuddinahmad

@irfanuddinahmad irfanuddinahmad commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the built-in Word Cloud XBlock and all associated assets. The extracted xblocks_contrib.word_cloud.WordCloudBlock has been the active implementation since USE_EXTRACTED_WORD_CLOUD_BLOCK = True.

Step 2 of 8 in the Slash-n-Burn Built-In XBlocks epic.

Changes

  • Remove USE_EXTRACTED_WORD_CLOUD_BLOCK toggle from openedx/envs/common.py
  • Remove conflicting built-in word_cloud entrypoint from pyproject.toml (the xblocks-contrib entrypoint remains active)
  • Delete xmodule/word_cloud_block.py
  • Delete xmodule/assets/word_cloud/ (JS, D3 vendor libs, and custom webpack.config.js)
  • Delete lms/templates/word_cloud.html
  • Delete xmodule/static/css-builtin-blocks/WordCloudBlockDisplay.css
  • Remove WordCloudBlockDisplay / WordCloudBlockEditor webpack entries from webpack.builtinblocks.config.js and webpack.common.config.js
  • Delete xmodule/tests/test_word_cloud.py and lms/djangoapps/courseware/tests/test_word_cloud.py

Epic Step 1: Post-extraction commit review

Reviewed commits to xmodule/word_cloud_block.py after USE_EXTRACTED_WORD_CLOUD_BLOCK was set to True (2025-12-16 · e662394398). All 3 post-toggle commits were cosmetic: deprecation markers (#38174), import sorting, and lint-amnesty removal. 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

Automated checks (CI):

  • Run xmodule unit tests: pytest xmodule/tests/
  • Confirm webpack build succeeds: npm run build

@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-word-cloud-block branch from db987da to ed55494 Compare June 11, 2026 12:52
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Jun 11, 2026
@irfanuddinahmad irfanuddinahmad force-pushed the irfanuddinahmad/slash-and-burn-word-cloud-block branch 2 times, most recently from 19618f9 to 3313f57 Compare June 12, 2026 16:55
@farhan farhan linked an issue Jul 3, 2026 that may be closed by this pull request
11 tasks
@farhan farhan force-pushed the irfanuddinahmad/slash-and-burn-word-cloud-block branch from 3313f57 to 4a47320 Compare July 3, 2026 08:04
@farhan

farhan commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@irfanuddinahmad I have rebased the branch with master checks are failing.

Adding screenshots of testing word cloud block of xblocks-core will be great.

@farhan

farhan commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Test coverage gap for the extracted Word Cloud block

After the extraction of the Word Cloud block into xblocks-contrib (openedx/xblocks-core#4), #36199 was merged in this repo, adding Studio editing support (studio_submit handler) so the Word Cloud block editor renders and saves in a Libraries v2 context (the handler was later generalized into EditingMixin by #36265). It also added test_studio_submit_handler to xmodule/tests/test_word_cloud.py, which this PR deletes.

The extracted block was never updated with this change — it uses StudioEditableXBlockMixin (submit_studio_edits) instead of the legacy studio_submit pathway, and xblocks-contrib has no equivalent test coverage for it.

The following scenarios from #36199 should be thoroughly tested against the extracted block before removing the built-in one:

  1. Studio editor rendering in a Libraries v2 context — the original bug fixed by fix: Render Word cloud block editor in libraries [FC-0076] #36199 was that the editor did not render for the word cloud block in libraries.
  2. Saving settings through the Studio editor (equivalent of test_studio_submit_handler) — submit display_name, instructions, num_inputs, num_top_words, and display_student_percents via the editor and verify each value persists on the block.
  3. Boolean field handling on save — the legacy handler received display_student_percents as the string 'True'/'False'; verify the submit_studio_edits pathway persists the correct boolean value.
  4. Save and Cancel buttons in the editor work correctly (added as part of the fix: Render Word cloud block editor in libraries [FC-0076] #36199 fix).

-- Comment has been written assisted with @claude

@farhan farhan Jul 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it shouldn't be removed and test should run testing xblocks-core word cloud block.

It can also be moved to xblocks-core here if feasible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed — the extracted block's tests (xblocks_contrib/word_cloud/tests/test_word_cloud.py) didn't have equivalent coverage for the scenarios this file exercises against the extracted block. Ported them in openedx/xblocks-core#273 (OLX import/export, indexibility, AJAX handler dispatch, submit_studio_edits). See the summary comment above for the full analysis.

Comment thread xmodule/tests/test_word_cloud.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be moved to xblocks-core here before removing from here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — ported the missing scenarios (OLX import/export, indexibility, AJAX handler dispatch, submit_studio_edits incl. boolean handling) into xblocks_contrib/word_cloud/tests/test_word_cloud.py via openedx/xblocks-core#273 before this deletion lands. See the summary comment above for details.

Irfan Ahmad and others added 2 commits July 6, 2026 21:18
Removes the built-in Word Cloud XBlock and all associated assets now that
USE_EXTRACTED_WORD_CLOUD_BLOCK has been True, making xblocks_contrib the
active implementation.

- Remove USE_EXTRACTED_WORD_CLOUD_BLOCK toggle from common.py
- Remove word_cloud entrypoint from pyproject.toml
- Delete xmodule/word_cloud_block.py (built-in class + shim)
- Delete xmodule/assets/word_cloud/ (JS assets including D3 vendor libs
  and custom webpack config)
- Delete lms/templates/word_cloud.html
- Delete xmodule/static/css-builtin-blocks/WordCloudBlockDisplay.css
- Remove WordCloudBlockDisplay/WordCloudBlockEditor webpack entries from
  webpack.builtinblocks.config.js and webpack.common.config.js
- Delete xmodule/tests/test_word_cloud.py and
  lms/djangoapps/courseware/tests/test_word_cloud.py

Closes openedx/public-engineering#534

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

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed write-up, @farhan — really useful. I dug into this and wanted to share what I found before we decide what (if anything) still needs to change here.

Why no source-code port is needed

The studio_submit/EditingMixin machinery added in #36199 and generalized in #36265 only applies to the legacy XModule-style editing descriptors (MetadataOnlyEditingDescriptor / SequenceDescriptor) — see the xblock_iframe.html diff in #36199, where the manual metadata-editor JS and the studio_submit handler call are explicitly gated on data['xmodule-type'] being one of those two. That code path only ever applied to the built-in word_cloud_block.py (and the pre-extraction lti_block.py).

The extracted xblocks_contrib.word_cloud.WordCloudBlock uses StudioEditableXBlockMixin instead — a different, already-standard editing pathway with its own submit_studio_edits handler that's used across many other XBlocks. It never goes through EditingMixin.studio_submit at all, so there's nothing from #36199/#36265 to port into it.

The other half of #36199 — the RequireJS/baseURL fix in xblock_iframe.html — is generic, platform-owned infrastructure, not tied to the specific block implementation. The extracted block already benefits from it automatically since it's rendered through the same iframe template.

But the test-coverage gap was real

You're right that this repo's xmodule/tests/test_word_cloud.py and lms/djangoapps/courseware/tests/test_word_cloud.py currently exercise the extracted block too (via @override_settings(USE_EXTRACTED_WORD_CLOUD_BLOCK=True)), and this PR deletes those files with no replacement. Comparing against xblocks_contrib/word_cloud/tests/test_word_cloud.py, these scenarios genuinely had no equivalent there:

  • OLX import/export round-trip
  • Search indexing (index_dictionary)
  • Handler-dispatch-level AJAX calls (going through block.handle(...), not just calling the method directly)
  • The submit_studio_edits Save pathway, including the boolean handling for display_student_percents — this is exactly scenario 2/3 from your list above, and it was already being exercised against the extracted block by the very test this PR deletes.

I opened openedx/xblocks-core#273 to port those scenarios into this repo's own suite before they're lost. All 13 tests (8 existing + 5 new) pass, and the full xblocks_contrib suite is unaffected (839 passed, no regressions).

Manual verification (scenarios 1 and 4)

Editor rendering in a Library v2 context and the Save/Cancel buttons were never covered by automated tests even in the original #36199 fix — they were verified manually, which lines up with your screenshot request from 2026-07-03. I did that manual pass in a local Tutor devstack:

  1. Created a v2 Content Library and added a Word Cloud component to it.
  2. The Studio editor rendered correctly with all 5 fields (Display Name, Inputs, Instructions, Maximum Words, Show Percents).
  3. Edited display_name, instructions, num_inputs (5→3), and display_student_percents (True→False), clicked Save — all changes persisted (confirmed via the Preview tab, which immediately showed the new title, instructions text, and exactly 3 input boxes).
  4. Clicked Cancel after making an unsaved edit — got an "Exit the editor? Any unsaved changes will be lost" confirmation, and "Discard Changes and Exit" correctly reverted to the last-saved state.

Screenshots of each step:

Library created library created
Word Cloud component added component added
Student preview renders in Library v2 student preview
Studio editor renders with correct defaults editor renders
Fields edited (incl. boolean toggle) fields edited
Save persisted correctly save persisted
Cancel — unsaved edit in progress cancel in progress
Cancel discarded the change cancel discarded

(full gist: https://gist.github.com/irfanuddinahmad/df358e2dc74bdf7b6c73db1d99b4abaf)

Given all of the above, I think this is safe to merge once #273 lands. Let me know if you'd like anything else checked.

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: Waiting on Author

Development

Successfully merging this pull request may close these issues.

[Refactor] Slash-n-Burn Word Cloud BuiltIn XBlock

4 participants