Skip to content

feat: migrate the games block to xblocks-core - #316

Open
samuelallan72 wants to merge 5 commits into
openedx:mainfrom
open-craft:samuel/games-xblock
Open

samuelallan72 wants to merge 5 commits into
openedx:mainfrom
open-craft:samuel/games-xblock

Conversation

@samuelallan72

@samuelallan72 samuelallan72 commented Oct 29, 2026 •

Copy link
Copy Markdown

Description

Migrate the XBlock from https://github.com/edx/gamesxblock to this repository.

I've tried to keep things as close to the source as possible to make review easier. I have done some very minor refactoring (mostly renaming games to xblock_games to match conventions and fixing lints with ruff check . --fix and ruff format .).

Supporting information

Private-ref: https://tasks.opencraft.com/browse/BB-11332

This is being developed in tandem with openedx/frontend-app-authoring#3351

Testing instructions

cd path/to/your/tutor/devstack
git clone https://github.com/open-craft/xblocks-core
cd xblocks-core
git checkout samuel/games-xblock
cd ..

tutor mounts add ./xblocks-core
tutor dev launch -I
tutor dev exec lms -- pip install -e /mnt/xblocks-core
tutor dev exec cms -- pip install -e /mnt/xblocks-core

tutor dev stop
tutor dev start -d
  • navigate to a test course in studio
  • add "openedx_flashcards" and "openedx_matching" to the course's "Advanced Settings"
  • add some instances of the flashcards and matching blocks to the course
  • [NOTE: the editor is not implemented; how to test is pending] play with the editor in studio, including both game types
  • verify the editor works as expected and it saves correctly
  • save and view the student view in the live course and/or course preview
  • verify the student view works as expected
  • verify the tests pass in CI

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 29, 2026
@openedx-webhooks

openedx-webhooks commented Oct 29, 2026 •

Copy link
Copy Markdown

Thanks for the pull request, @samuelallan72!

This repository is currently maintained by @openedx/axim-engineering.

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.

Comment thread xblock_games/locale/config.yaml Resolved
@samuelallan72
samuelallan72 force-pushed the samuel/games-xblock branch 2 times, most recently from fbba15d to 4a9cac9 Compare October 29, 2026 04:35
Comment thread .gitignore Resolved
Comment thread xblock_games/tests/test_translations.py Resolved

@Kelketek Kelketek left a comment

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.

@samuelallan72 I've given this an initial pass. I think I need to do some research before merging this in (and also double-check we're clear to on the product side.) See my comments for potential pitfalls.

I see there's a bunch of encryption machinery. It doesn't appear to actually be used. Can you verify if it's used, and if it's not, rip it and its associated tests out?

}

# Games XBlock specific settings
GAMESXBLOCK_STORAGE = None # Use default storage for tests

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.

Noting that if we have settings like this, they should use the XBLOCKS_SETTINGS convention.

We probably need to refactor this. Using an external storage breaks import/export guarantees. We may need to do this in a follow-up-- we'd need to update the frontend and backend to handle the uploads differently. The PDF block editor in frontend-app-authoring has an example of how uploads can be handled there, and we already know how we can handle uploaded images from our experience in the exemplar blocks.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@Kelketek Yep I figured this would be a follow up change, because it would involve deprecating the GAMESXBLOCK_STORAGE setting.

@samuelallan72

Copy link
Copy Markdown
Author

@Kelketek

I see there's a bunch of encryption machinery. It doesn't appear to actually be used. Can you verify if it's used, and if it's not, rip it and its associated tests out?

Huh it's not used. I've removed them now. Nice catch :)

@samuelallan72
samuelallan72 marked this pull request as ready for review October 30, 2026 00:33
Comment thread pyproject.toml Outdated
# 'Done' XBlocks -- ones that are ready for general use today,
# and have been migrated fully from edx-platform or their original repository.
pdf = "xblock_pdf:PDFBlock"
games = "xblock_flashcards_matching:FlashcardsMatchingXBlock"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please let me know if this entrypoint id should be updated. Leaving it at "games" will enable backward compatibility with any existing components. However, it may be confusing long-term.

We may also want a temporary id for testing, like some of the others above.

@Kelketek Kelketek Nov 2, 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.

@samuelallan72 It should be updated, yes. A temporary ID would be fine for now, and making sure the README is updated to indicate 'In Development' status would be important here-- which it looks like you've already done.

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.

Actually, it looks like we'll need to do two separate IDs for two different blocks.

I'd rather we not use temporary IDs now that I think about it, since we want the frontend authoring functionality to work with the actual names we'll be using. So this will mean we need to use 'flashcards' and 'matching' as the names. That may cause conflicts with the separate 'matching' and 'flashcards' blocks we've made for WGU, but they won't be hitting this newer version of XBlocks-core for a while (it wouldn't land until Willow) so there will be lead-time to migrate. cc @pkulkark

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@Kelketek got it, thanks.

this will mean we need to use 'flashcards' and 'matching' as the names. That may cause conflicts with the separate 'matching' and 'flashcards' blocks we've made for WGU

These names are arbitrary though, so can we namespace them and use something like "openedx_flashcards_ and "openedx_matching"?

One concern: do we want this games block to be backwards compatible with any existing components/courses?

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.

@samuelallan72 Now that it's split, and the names are changed, it can't be backwards-compatible. edX will have to migrate their data or else recreate the blocks in their relevant courses. However, they would have to do so anyway, as the file storage method alone will require migration work.

We will just need to keep them posted so they know what they need to do, and how they can keep the old block alive a while longer if they need to. We're already giving them a path there by making sure the name isn't overwritten, so the old block will still work for learners until they migrate. We will have to change the authoring to recognize the new names, though, and remove the 'type' switch toggle, so those old blocks will lose editability and will be frozen.

cc @jristau1984 see above

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Disappointing that we need to migrate content even before the block is fully in the core... but it appears there is nothing we can do about it, so I have no further objections.

@Kelketek

Kelketek commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@samuelallan72 Per your question on the proposal, and discussion with WGU: Yes, we'd like to bifurcate the block. Do you think you'd be able to do so in this PR or would that be too much to carry in this sprint?

We will need an additional ticket for next sprint that updates frontend-app-authoring to adjust to this change. Could you create one?

@samuelallan72

Copy link
Copy Markdown
Author

@Kelketek it probably makes sense to split the block is this PR; I can do that. I can also create the ticket 👍

Comment thread xblock_flashcards/flashcards.py Resolved
Comment thread xblock_flashcards/flashcards.py Resolved
Comment thread src/xblock_matching/utils.py Resolved
Comment thread xblock_flashcards/static/README.txt Resolved
Comment thread pyproject.toml Resolved
@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Nov 4, 2026
@Kelketek

Kelketek commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

@samuelallan72 The CI is failing, and a good part of it is untested code. Part of it is easy-to-fix lint issues, but another part is test coverage. I'm guessing a lot of the code that is uncovered is intended to be removed.

We have two options here: We could just remove the soon-to-be-dead code now and add tests for what remains even if that means a non-functional block, since it will be non-functional anyway due to lack of authoring being ready.

The other option would be to put this PR on ice until authoring is ready to go with it and merge them together. That option is probably cleaner.

In any case there are still a couple of threads talking on the product proposal, so maybe icing it is the best way. What do you think? Anything else you think we should hit before hitting pause here, if so?

@samuelallan72

Copy link
Copy Markdown
Author

@Kelketek re the missing tests, I still need to re-add tests. I removed them when I split the xblocks because of course that broke every test. I can absolutely do that, but I'm a little loath to while things are in flux still.

Agreed regarding putting it on ice until authoring is sorted out, because currently it's hard to test them without authoring. It would be nice to figure out some more simplifications and modernisations too before merging - including the obfuscation which I don't think is necessary any more, and porting more things to pydantic.

Comment thread xblock_matching/constants.py Resolved
Migrate the XBlock from https://github.com/edx/gamesxblock to this
repository. In the process, split them into two separate xblocks:
matching and flashcards.

Also do some rework on the new blocks to modernise the code, remove
unused functions, etc.

Private-ref: https://tasks.opencraft.com/browse/BB-11332
samuelallan72 added a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 9, 2026
samuelallan72 added a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 10, 2026
samuelallan72 added a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 10, 2026
samuelallan72 added a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 10, 2026
- we'll use course/library asset storage for uploads, so we won't need the custom file handling here
- for ease of use, the card data structure has been updated
@farhan

farhan commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Hi @feanil, @Kelketek, @samuelallan72

I'd like to understand whether this block would be a good fit for xblocks-core. Are there any decision notes on this that could help.

@Kelketek

Copy link
Copy Markdown
Contributor

Hi @farhan !

The main product proposal for this is here. The editor for the games block is already merged into the authoring MFE, although now that it's been decided to bifurcate the games block into two separate blocks, Sam is also working on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

5 participants