Repository navigation
refactor: slash-and-burn Word Cloud BuiltIn XBlock - #38745
irfanuddinahmad wants to merge 4 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 <[email protected]>
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 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…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 <[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]>
d4fd4a8 to
4f87536
Compare








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, the built-inword_cloudentrypoint, and theUSE_EXTRACTED_WORD_CLOUD_BLOCKtoggle.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.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),npm run buildV2 Library checklist: 11/12 pass (L10 export diff not done)
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)
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