Skip to content

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Sep 30, 2025

Description

Allows authors to migrate legacy library content block in course to library v2 if the source library was migrated. The block works with the new library and has the same functionality as the new ItemBankBlock.

This PR also fixes some issues with Problem Bank like Add components button not working in the preview page and iframe postMessage failure after syncing of component in the preview page.

screencast.mp4

Requirements as per The LegacyLibraryContentBlock OLX must work forever.

  • The LegacyLibraryContentBlock OLX must work forever.
  • L points at a legacy library, which has been migrated to a new V2 library.
    • Block Behavior: Preview and settings editor should look just like a modern ItemBank block.
    • Child Behavior: If updates are available (see below), they are shown per-child on the View page, using the migrated child blocks as the update source.
  • L points at a legacy library, which has not been migrated.
    • Block and Child Behavior: Use existing LegacyLibraryContentBlock interface behavior.
  • L is None, malformed, or doesn't point to an existing or migrated legacy library:
    • Block Behavior: Display a validation error. Syncing is not allowed. (existing behavior)
    • Child Behavior: Children are displayed if they exist, but no option to sync is offered.
      Sync behavior
  • The parent LegacyLibraryContentBlock's version does not equal the migrated source library version (indicating that the legacy library received updates before its migration happened)

Useful information to include:

  • Which edX user roles will this change impact? "Course Author" and "Developer"

Supporting information

Testing instructions

  • Create a legacy library with some components.
  • Add a legacy library content block in course unit.
  • Now migrate the legacy library.
  • Refresh the course unit page, a new alert should appear on top of the library content block.
  • Click on migrate button in the alert and verify that the block is migrated to Problem bank and behaves like it.
  • The children blocks have upstream field set and show sync button if the v2 library component is updated.

Deadline

"None" if there's no rush, or provide a specific date or event (and reason) if there is one.

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • If your database migration can't be rolled back easily.

@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 Sep 30, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Sep 30, 2025

Thanks for the pull request, @navinkarkera!

This repository is currently maintained by @openedx/wg-maintenance-edx-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.


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 Sep 30, 2025
@navinkarkera navinkarkera force-pushed the navin/fal-4251/legacy-lib-content-to-item-bank branch 3 times, most recently from 6dbd6db to 8c646c1 Compare October 2, 2025 11:23
@navinkarkera navinkarkera force-pushed the navin/fal-4251/legacy-lib-content-to-item-bank branch from 7ad846c to 06de64c Compare October 2, 2025 11:48
Comment on lines 362 to 365
if self.is_source_lib_migrated_to_v2 and not self.is_migrated_to_v2:
# If the source library is migrated but this block still depends on legacy library
# Migrate the block by setting upstream field to all children blocks
self._v2_update_children_upstream_version()
Copy link
Member

Choose a reason for hiding this comment

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

@navinkarkera I'm not sure this is the best approach. The point of this method is to render the block, not to modify it--sticking the migration here is surprising and auto-magical. It will also update the children when the block is rendered in LMS, which would either fail or be a no-op, and would be confusing either way. In general, we should not be modifying content except in response to the action of a Studio user.

I had tried to outline an idea to follow library_content child references without a child migration process, but since writing that, I've also come to dislike the idea, because it would break the simplifying assumption that we can just check self.upstream on any block to see its upstream link. So, I like that your PR uses a migration child step, but I think we need some explicit way to trigger it.

Here's an idea:

  • When a legacy library_content block has (a) unmigrated chidlren and (b) a migrated source library, it gives the users the option to "sync" the latest content, regardless of whether are new changes in the target library.
  • Syncing, in this case, will migrate the children.

It's a slight product behavior change. In particular, every legacy library content block would have a "sync available" as soon as an operator migrates its source library. But, I think it would be worth the simplified behavior information architecture. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kdmccormick This is not the final version, locally I have something like this:
image

Sorry for the confusion.

Copy link
Contributor Author

@navinkarkera navinkarkera Oct 2, 2025

Choose a reason for hiding this comment

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

Once the author clicks on Migrate it looks like this:

image

I'll update the PR description once I push the changes.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, thanks. I think this is a good approach. I'll ask precisely what the UI should be at the sync-up tomorrow.

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Oct 2, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Oct 2, 2025
@navinkarkera navinkarkera force-pushed the navin/fal-4251/legacy-lib-content-to-item-bank branch from 82767cb to c2094f2 Compare October 3, 2025 11:51
@navinkarkera navinkarkera marked this pull request as ready for review October 3, 2025 14:13
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). FC Relates to an Axim Funded Contribution project 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.

4 participants