Repository navigation
refactor: slash-and-burn Word Cloud BuiltIn XBlock - #38745
irfanuddinahmad wants to merge 5 commits into
Conversation
|
Thanks for the pull request, @irfanuddinahmad! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
db987da to
ed55494
Compare
19618f9 to
3313f57
Compare
3313f57 to
4a47320
Compare
|
@irfanuddinahmad I have rebased the branch with Adding screenshots of testing word cloud block of |
|
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 ( The extracted block was never updated with this change — it uses The following scenarios from #36199 should be thoroughly tested against the extracted block before removing the built-in one:
-- Comment has been written assisted with @claude |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I am not seeing any test from this file moved to xblocks-core.
Can you please look into?
There was a problem hiding this comment.
Confirmed — none of the six integration tests from this file were migrated in xblocks-core#273. That PR only ports unit-level scenarios from xmodule/tests/test_word_cloud.py. Full breakdown and next steps are in #38745 (comment). Any new coverage will go in a separate PR.
| Generated using Claud Code
There was a problem hiding this comment.
Done. This file is kept in openedx-platform and now tests only the extracted block.
- All 6 integration tests are unchanged in name and logic. They still run through
BaseTestXmodulewith the multi-user clients. - Removed only:
TestWordCloudBuiltIn, theoverride_settingsdecorators,importlib.reload(word_cloud_block), and theif settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:/else:branches (collapsed to the extracted path that already existed).
CI is green on d4fd4a8815.
| Generated using Claude Code
4a47320 to
e5ec0e9
Compare
|
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 The extracted The other half of #36199 — the RequireJS/baseURL fix in But the test-coverage gap was real You're right that this repo's
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 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:
Screenshots of each step: (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. |
|
Thanks for the work on openedx/xblocks-core#273. I reviewed what was migrated from the two test files this PR deletes. Sharing a clearer breakdown below. Migrated in openedx/xblocks-core#273 (from
|
| Original test | Migrated as | Notes |
|---|---|---|
test_xml_import_export_cycle |
test_xml_import_export_cycle |
✅ Ported |
test_indexibility |
test_indexibility |
✅ Ported |
test_bad_ajax_request |
test_bad_dispatch_request |
✅ Ported (adapted for @json_handler / NoSuchHandlerError) |
test_studio_submit_handler |
test_submit_studio_edits |
✅ Ported (adapted for submit_studio_edits handler) |
test_good_ajax_request |
test_handle_submit_state_request |
Gap: test_good_ajax_request → test_handle_submit_state_request
The original test seeds pre-existing learner aggregate data before submit:
'all_words': {'cat': 10, 'dog': 5, 'mom': 1, 'dad': 2},and asserts the merged result (total_count == 22, global student_words, top_words including mom/dad). The migrated test uses a fresh block with empty all_words, so it only asserts total_count == 4 — it no longer exercises the merge-with-existing-aggregates path that the original test was written for.
Not migrated (from lms/djangoapps/courseware/tests/test_word_cloud.py)
None of the integration tests from this file appear in xblocks-core#273:
test_initial_statetest_post_wordstest_collective_users_submitstest_unicodetest_handle_ajax_incorrect_dispatchtest_word_cloud_constructor
These are platform integration tests (mongo modulestore, multi-user HTTP clients, fragment rendering via BaseTestXmodule) and cannot be dropped into xblocks-core as-is. We should decide separately whether a slim extracted-block-only version stays in openedx-platform, or whether that coverage is acceptable to lose.
Guidelines for completing the migration
For the remaining gaps, we will open a new PR (separate from #273 / #38745). When doing that:
- Keep original test names where possible — e.g. prefer
test_good_ajax_requestover renaming totest_handle_submit_state_requestwithin the scope of a migration PR. - Keep the original test logic as intact as possible — adapt only what the extracted block API requires (handler name, request format), not the assertions or setup unless strictly necessary.
- Reference the migration PR — tests ported from openedx-platform should note they originate from openedx/xblocks-core#273 / the deleted
xmodule/tests/test_word_cloud.pyandlms/djangoapps/courseware/tests/test_word_cloud.pyfiles.
Once the test_good_ajax_request gap is fixed and we have a plan for the lms integration coverage, I think we can unblock this PR.
| Generated using Claud Code
e5ec0e9 to
d4fd4a8
Compare
|
@farhan thanks for the detailed review. I've addressed it by keeping both test files in openedx-platform and pointing them at the extracted block, rather than relying on the port in xblocks-core#273. The branch is also rebased onto current master.
Assertions on the extracted path are unchanged, including the pre-seeded All 46 checks pass on Separately, I'll update xblocks-core#273 so it doesn't duplicate this coverage. | Generated using Claude Code |
… seed and assertions Restores the pre-seeded all_words/top_words merge path that the handler-level port in openedx#273 (test_handle_submit_state_request) does not assert. Name, setup and assertions match openedx-platform xmodule/tests/test_word_cloud.py (openedx/openedx-platform#38745). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
…dBlock Per review on this PR, keep xmodule/tests/test_word_cloud.py and lms/djangoapps/courseware/tests/test_word_cloud.py in openedx-platform instead of deleting them. They already exercised the extracted block (USE_EXTRACTED_WORD_CLOUD_BLOCK=True), and xblocks-core does not yet have equivalent coverage (openedx/xblocks-core#273 is still open; the LMS integration tests cannot move there as-is). Only the BuiltIn variants, the toggle overrides and the built-in-only branches are removed. Test names and assertions are unchanged, including the pre-seeded all_words merge path in test_good_ajax_request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
d4fd4a8 to
4f87536
Compare
farhan
left a comment
There was a problem hiding this comment.
Done with the initial code review.
I am expecting testing of Extracted Word Cloud block on this PR is done, sharing testing notes/edge-cases will be great.
| 'error': 'Unknown Command!' | ||
| }) | ||
|
|
||
| @XBlock.supports('multi_device') |
There was a problem hiding this comment.
Mobile apps lose inline rendering: the extracted block reports student_view_multi_device: false. Add this in xblocks-core src/xblock_word_cloud/block.py, and link that PR here:
@XBlock.supports("multi_device")
def student_view(self, context=None):There was a problem hiding this comment.
Confirmed. The built-in block declares @XBlock.supports("multi_device") on student_view and the extracted one doesn't. Fixed in openedx/xblocks-core#335 (decorator plus a regression test that fails without the fix). I checked the other blocks too: only Word Cloud lost it (HTML and Problem keep theirs, and the rest never had it). The description now lists this as a known gap, and the merge waits until #335 is released.
Generated using Claude Code
| # .. toggle_use_cases: temporary | ||
| # .. toggle_creation_date: 2024-11-10 | ||
| # .. toggle_target_removal_date: 2026-04-10 | ||
| USE_EXTRACTED_WORD_CLOUD_BLOCK = True |
There was a problem hiding this comment.
Verawood dev/op notes announced this removal for Willow. Add it under Deprecations & Removals in Willow dev/op notes, or confirm one entry covers all 8 blocks:
* **Removed the built-in Word Cloud block.** ``xmodule.word_cloud_block`` and the
``USE_EXTRACTED_WORD_CLOUD_BLOCK`` setting are removed. The Word Cloud block from
`xblocks-core <https://github.com/openedx/xblocks-core>`_ is always used.There was a problem hiding this comment.
Opened one entry for all 8 blocks: openedx/docs.openedx.org#1554. It's a draft until the platform PRs land, so the list matches what actually ships in Willow.
Generated using Claude Code
| # .. toggle_creation_date: 2024-11-10 | ||
| # .. toggle_target_removal_date: 2026-04-10 | ||
| USE_EXTRACTED_WORD_CLOUD_BLOCK = True | ||
|
|
There was a problem hiding this comment.
nit: double blank line.
There was a problem hiding this comment.
Fixed in 6ab3d7d.
Generated using Claude Code
| ] | ||
| }, | ||
|
|
||
| { |
There was a problem hiding this comment.
nit: leftover blank line.
| { |
There was a problem hiding this comment.
Fixed in 6ab3d7d.
Generated using Claude Code
| videoalpha = "xmodule.video_block:VideoBlock" | ||
| videodev = "xmodule.template_block:TranslateCustomTagBlock" | ||
| word_cloud = "xmodule.word_cloud_block:WordCloudBlock" | ||
| word_cloud = "xblock_word_cloud:WordCloudBlock" |
There was a problem hiding this comment.
Update the "Remove the entrypoint" item in openedx/public-engineering#534 to say re-pointed, and list this under a "Changed" heading in the PR description.
There was a problem hiding this comment.
Done. openedx/public-engineering#534 now says "Re-point the entrypoint" (xblock_word_cloud:WordCloudBlock), and the description has a Changed heading for it.
Generated using Claude Code
|
|
||
| @override_settings(USE_EXTRACTED_WORD_CLOUD_BLOCK=False) | ||
| class TestWordCloudBuiltIn(_TestWordCloudBase): | ||
| class TestWordCloudExtracted(_TestWordCloudBase): |
There was a problem hiding this comment.
nit (optional): only one subclass is left, and the cache reset was only needed for the removed importlib.reload:
-class _TestWordCloudBase(BaseTestXmodule):
+class TestWordCloud(BaseTestXmodule):
"""Integration test for Word Cloud Block."""
- __test__ = False
...
- plugin.PLUGIN_CACHE = {}
...
-
-
-class TestWordCloudExtracted(_TestWordCloudBase):
- __test__ = TrueThere was a problem hiding this comment.
Done in 6ab3d7d: one TestWordCloud class, without __test__ or the PLUGIN_CACHE reset (and without the now-unused from xblock import plugin). Test bodies are unchanged; 6 passed locally.
Generated using Claude Code
- Drop the extra blank lines left behind in openedx/envs/common.py and webpack.common.config.js. - Collapse _TestWordCloudBase/TestWordCloudExtracted into TestWordCloud. The plugin cache reset was only needed for the removed importlib.reload, so it goes too. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@farhan thanks for the review. Summary of the changes:
Translations: openedx/xblocks-core#329 and openedx/openedx-translations#85196 are merged and the Generated using Claude Code |
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. - Drop the blank line left between rules in webpack.common.config.js. - Collapse the toggle-era base class + __test__ subclass back into the original test class name(s). The plugin cache reset was only needed for the removed importlib.reload. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. - Drop the blank line left between rules in webpack.common.config.js. - Collapse the toggle-era base class + __test__ subclass back into the original test class name(s). The plugin cache reset was only needed for the removed importlib.reload. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Same nits as reviewed on #38745: - Drop the extra blank line left in openedx/envs/common.py after the toggle removal. - Collapse the toggle-era base class + __test__ subclass back into the original test class name(s). The plugin cache reset was only needed for the removed importlib.reload. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@farhan I ran your translation steps on a local Tutor stack (2026-11-19):
So the translation hold is lifted for Word Cloud, Poll, HTML and Discussion. Annotatable, Video and Problem still wait on #332 for their JS strings (plus Generated using Claude Code |








Summary
Removes the built-in Word Cloud XBlock.
xblock_word_cloud.WordCloudBlockhas been the default sinceUSE_EXTRACTED_WORD_CLOUD_BLOCK = True, so the built-in code no longer runs.Step 2 of 8 of the Slash-n-Burn Built-In XBlocks epic. Closes openedx/public-engineering#534
Changes
Deleted:
xmodule/word_cloud_block.py,xmodule/assets/word_cloud/(JS, D3 vendor libs, its ownwebpack.config.js),lms/templates/word_cloud.html,WordCloudBlockDisplay.css, theWordCloudBlockDisplay/WordCloudBlockEditorwebpack entries, and theUSE_EXTRACTED_WORD_CLOUD_BLOCKtoggle.Changed: the
word_cloudentrypoint inpyproject.tomlis re-pointed fromxmodule.word_cloud_block:WordCloudBlocktoxblock_word_cloud:WordCloudBlock. It isn't removed, because xblocks-core only registers_word_cloud_extracted(for testing), so existingword_cloudcontent needs this name.Tests:
xmodule/tests/test_word_cloud.pyandlms/djangoapps/courseware/tests/test_word_cloud.pynow run againstxblock_word_cloud.WordCloudBlock. Only the BuiltIn twin classes, toggle overrides and built-in-only branches were dropped. Test names and assertions are unchanged, including the pre-seededall_wordsmerge path intest_good_ajax_request.lms/djangoapps/courseware/tests/test_word_cloud.py,_TestWordCloudBase+TestWordCloudExtractedare now oneTestWordCloudclass. Theplugin.PLUGIN_CACHEreset, which was only needed for the removedimportlib.reload, is gone. Test bodies are unchanged.Epic Step 1: Post-extraction commit review
Toggle flipped 2025-12-16 (
e662394398). All 3 later commits toword_cloud_block.pyare cosmetic (deprecation markers #38174, import sorting, 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.pytest xmodule/tests/(732 passed locally) andlms/djangoapps/courseware/tests/test_word_cloud.py(6 passed, re-run on6ab3d7ded0),npm run buildstudent_view_multi_device): waits on fix: declare multi_device support on Word Cloud student_view xblocks-core#335Testing notes and edge cases (local Tutor nightly, 2026-11-12):
data, so it doesn't hit the Annotatable empty-data 500 (Annotatable: newly created empty block in a Content Library V2 fails to render (XMLSyntaxError: Document is empty) xblocks-core#323).test_collective_users_submits), seededall_wordsmerging (test_good_ajax_request), unicode (test_unicode), and the Studio save handler and OLX import/export cycle (xmodule/tests/test_word_cloud.py).<word_cloud …/>and pointer-tag import work, and export writes a pointer tag.USE_EXTRACTED_*_BLOCK = False(built-in) and on this branch; theword_cloudfiles and its unit are identical. Checked 2026-11-19.V2 Library checklist: 12/12 pass
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)
USE_EXTRACTED_*_BLOCK = False(built-in) and on this branch; theword_cloudfiles and its unit are identical.Word Cloud-specific:
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/38745.
🤖 Generated with Claude Code
Settings