Skip to content

Conversation

@kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Dec 19, 2025

Backports #37711

I tested a variety of migration scenarios, both using the migration UI and the REST API.

Backport note: Compared to the original commit, this backport commit
excludes the REST APIs which were not defined at the time of the
Ulmo cutoff:

  • /api/v1/modulestore_migrator/libraries
  • /api/v1/modulestore_migrator/migration_info
  • /api/v1/modulestore_migrator/migration_blocks

@kdmccormick kdmccormick force-pushed the kdmccormick/migration-api-ulmo branch from d496a9f to eacda30 Compare December 19, 2025 17:33
@kdmccormick kdmccormick marked this pull request as ready for review December 19, 2025 18:06
@kdmccormick kdmccormick force-pushed the kdmccormick/migration-api-ulmo branch 2 times, most recently from e791ca6 to 79c905d Compare December 19, 2025 18:31
@kdmccormick kdmccormick requested a review from ormsbee December 19, 2025 18:32
@kdmccormick kdmccormick force-pushed the kdmccormick/migration-api-ulmo branch from 79c905d to 18628b0 Compare December 19, 2025 18:35
@kdmccormick kdmccormick enabled auto-merge (squash) December 19, 2025 18:47
For legacy library_content references in courses, this PR:
- **Removes the spurious sync after updating a reference to a migrated
  library**, so that users don't need to "update" their content _after_
  updating their reference, _unless_ there were real content edits that
  happened since they last synced. We do this by correctly associating a
  DraftChangeLogRecord with the ModulestoreBlockSource migration artifact,
  and then comparing that version information before offering a sync.
  (related issue:
  openedx/frontend-app-authoring#2626).
- **Prompts users to update a reference to a migrated library with higher
  priority than prompting them to sync legacy content updates for that
  reference**, so that users don't end up needing to accept legacy content
  updates in order to get a to a point where they can update to V2 content.
- **Ensures the library references in courses always follow the correct
  migration,** as defined by the data `forwarded` fields in the data model,
  which are populated based on the REST API spec and the stated product UI
  requirements.

For the migration itself, this PR:

- **Allows non-admins to migrate libraries**, fixing:
  openedx#37774
- **When triggered via the UI, ensures the migration uses nice title-based
  target slugs instead of ugly source-hash-based slugs.** We've had this as an
  option for a long time, but preserve_url_slugs defaulted to True instead of
  False in the REST API serializer, so we weren't taking advantage of it.
- **Unifies logic between single-source and bulk migration**. These were
  implement as two separate code paths, with drift in their implementations. In
  particular, the collection update-vs-create-new logic was completely
  different for single-souce vs. bulk.
- **When using the Skip or Update strategies for repeats, it consistently
  follows mappings established by the latest successful migration** rather than
  following mappings across arbitrary previous migrations.
- **We log unexpected exceptions more often**, although there is so much more
  room for improvement here.
- **Adds more validation to the REST API** so that client mistakes more often
  become 400s with validation messages rather than 500s.

For developers, this PR:
- Adds unit tests to the REST API
- Ensures that all migration business logic now goes through a general-purpose
  Python API.
- Ensures that the data model (specifically `forwarded`, and
  `change_log_record`) is now populated and respected.
- Adds more type annotations.

Backports: 91e521e
Backport note: Compared to the original commit, this backport commit
excludes the REST APIs which were not defined at the time of the
Ulmo cutoff:
* /api/v1/modulestore_migrator/libraries
* /api/v1/modulestore_migrator/migration_info
* /api/v1/modulestore_migrator/migration_blocks
@ormsbee ormsbee force-pushed the kdmccormick/migration-api-ulmo branch from 18628b0 to 7853289 Compare December 19, 2025 19:30
@kdmccormick kdmccormick merged commit a0c83f7 into openedx:release/ulmo Dec 19, 2025
43 checks passed
@kdmccormick kdmccormick deleted the kdmccormick/migration-api-ulmo branch December 19, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants