Skip to content

Comments

Allow for Extracted Word Cloud Block | Fix Test Cases#35983

Merged
kdmccormick merged 7 commits intomasterfrom
farhan/test-extracted-word-cloud
Aug 8, 2025
Merged

Allow for Extracted Word Cloud Block | Fix Test Cases#35983
kdmccormick merged 7 commits intomasterfrom
farhan/test-extracted-word-cloud

Conversation

@farhan
Copy link
Contributor

@farhan farhan commented Dec 7, 2024

In this PR:

  • We have added functionality to run Word Cloud XBlock test cases for Built-In and Extracted XBlocks.
  • We have fixed the test cases for Extracted Word Cloud XBlock.

In this PR we have enabled the usage of Extracted Word Cloud XBlock resides in xblocks-contrib repository.

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 8cf696a to 988cb0c Compare January 13, 2025 14:28
@farhan farhan closed this Jan 15, 2025
@farhan farhan reopened this Jan 15, 2025
@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch 4 times, most recently from ad5a8b7 to 02848a2 Compare January 16, 2025 10:40
@farhan farhan marked this pull request as ready for review January 16, 2025 11:09
@farhan farhan closed this Jan 17, 2025
@farhan farhan reopened this Jan 17, 2025
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

I took a pass but since I'm not as familiar with the Xblock framework, forgive me if some of the questions have obvious answers. I'm in particular confused about why the tests need to change and if that indicates any sort of breakage that we need to handle elsewhere?


assert fragment.content == self.runtime.render_template('word_cloud.html', expected_context)
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
expected_context['range_num_inputs'] = range(5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not check the block type in this case?

Copy link
Contributor Author

@farhan farhan Jan 22, 2025

Choose a reason for hiding this comment

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

Fixed, checking for both (Builtin & Extracted) XBlocks now.

if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
def_id = runtime.id_generator.create_definition(olx_element.tag, olx_element.get('url_name'))
keys = ScopeIds(None, olx_element.tag, def_id, runtime.id_generator.create_usage(def_id))
block = WordCloudBlock.parse_xml(olx_element, runtime, keys)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do keys need to be provided for one instantiation but not the other?

Copy link
Contributor Author

@farhan farhan Jan 22, 2025

Choose a reason for hiding this comment

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

Update:
I have added keys for both builtin and extracted implementation to avoid If condition.

Why It's not needed in case of builtin xblock implementation?
In BuiltIn xblock implementation WordCloud block has XmlMixin and in its parse_xml method implementation, there is a check at start that if keys are None then it creates the keys.
I have copied the same lines of code and added them in test case.
In Extracted XBlock implementation parse_xml method of xblocks/core.py calls which doesn't have this check and expecting keys values in params.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Further discussion:
#35983 (comment)

# This will export the olx to a separate file.
block.add_xml_to_node(node)
if settings.USE_EXTRACTED_WORD_CLOUD_BLOCK:
filepath = 'word_cloud/block_id.xml'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the same method as below to export the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because add_xml_to_node is defined in XmlMixin class.
BuiltIn XBlocks are using this mixin

In Extracted XBlocks we are preferring to use Xblock.core functionalities and using export_to_xml method which doesn't have export_to_file funcationlity like add_xml_to_node method of XmlMixin has

@kdmccormick kdmccormick marked this pull request as draft January 21, 2025 17:54
@farhan
Copy link
Contributor Author

farhan commented Jan 22, 2025

I took a pass but since I'm not as familiar with the Xblock framework, forgive me if some of the questions have obvious answers. I'm in particular confused about why the tests need to change and if that indicates any sort of breakage that we need to handle elsewhere?

@feanil Thanks for the pass.
Let me review my implementation, rethink on them, and address your rightful queries.

Let's keep this PR in draft until I make this PR and Extracted Word Cloud PR openedx/xblocks-contrib#4 fully ready.

@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 3f0447a to add935e Compare January 22, 2025 12:19
@farhan farhan force-pushed the farhan/test-extracted-word-cloud branch from 5768e3b to d23a0a6 Compare January 28, 2025 07:38
@farhan farhan requested a review from feanil January 28, 2025 13:23
@farhan
Copy link
Contributor Author

farhan commented Jan 28, 2025

@feanil You can consider this PR to be ready for next pass

@kdmccormick kdmccormick added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Jan 30, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@farhan farhan marked this pull request as ready for review February 4, 2025 09:07
@farhan farhan added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Feb 4, 2025
@farhan farhan closed this Feb 4, 2025
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@farhan
Copy link
Contributor Author

farhan commented Aug 4, 2025

@kdmccormick You can ignore last comment if didn't read yet. PR is available for the next pass.

Problem Cause: So it was just xblock.plugin.PLUGIN_CACHE that was creating problem, reseting it on tests setUpClass.

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ttqureshi
Copy link
Member

From adding the docs against the if conditions to having the CI checks run for both the Built-in and the Extracted word cloud blocks, we've made a good progress in this PR.

But before we plan to merge this PR, I want to bring one point into consideration that is the pointer tag issue.

I think we can't merge this PR and any of the test PRs until we resolve this issue. Because the extracted blocks don't support the parsing of the pointer tags format properly which can lead to the erroneous parsing of the previously exported Builtin Blocks if they are imported in the pointer tag OLX format (see this comment). For that, I am currently working on this issue.

@feanil @kdmccormick please share your thoughts on it.

cc to: @openedx/axim-aximprovements

@farhan
Copy link
Contributor Author

farhan commented Aug 6, 2025

I think we can't merge this PR and any of the test PRs until we resolve this issue.

@kdmccormick @ttqureshi
I think in this case we should merge this PR keeping USE_EXTRACTED_WORD_CLOUD_BLOCK flag disabled for now, we can enable it default once the pointer tag issue implementation (discussed in last commit) is done.

@feanil feanil changed the title Enable Extracted Word Cloud | Fix Test Cases Allow for Extracted Word Cloud Block | Fix Test Cases Aug 6, 2025
@kdmccormick
Copy link
Member

Great work on the tests. Good point @ttqureshi , I will turn my attention back to the pointer tag issue. I agree with @farhan , we can merge this PR so tests run on the extracted block, but keep the feature flag disabled until pointer tags are fixed.

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@kdmccormick kdmccormick self-requested a review August 8, 2025 14:12
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Great work!

@kdmccormick kdmccormick merged commit 4a9fc77 into master Aug 8, 2025
49 checks passed
@kdmccormick kdmccormick deleted the farhan/test-extracted-word-cloud branch August 8, 2025 15:22
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Aximprovements Team Aug 8, 2025
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

salman2013 pushed a commit to salman2013/edx-platform that referenced this pull request Sep 10, 2025
…35983)

Run tests for both the built-in and extracted WordCloud block.
The tests are mostly compatible with both versions of the block,
except for a few places where the XBlock framework and the
built-in XModule system differ which we've had to handle using
conditionals.

This moves us closer to enabling the extracted WordCloud block
by default and eventually removing the built-in block.

Part of: openedx#34840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-sandbox open-craft-grove should create a sandbox environment from this PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants