Skip to content

Revert: Cannot rerun courses - authz role assignment expects rerun to already exist (#38840) - #38973

Open
efortish wants to merge 7 commits into
openedx:masterfrom
eduNEXT:ks/revert-38840-issue381
Open

Revert: Cannot rerun courses - authz role assignment expects rerun to already exist (#38840)#38973
efortish wants to merge 7 commits into
openedx:masterfrom
eduNEXT:ks/revert-38840-issue381

Conversation

@efortish

@efortish efortish commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

This is a clean revert of #38840, prepared ahead of time per openedx-authz#381

Background

#38840 worked around a limitation in openedx-authz: role assignment required the destination CourseOverview/ContentLibrary to already exist. This is not the case for a course rerun, where the role needs to be granted before the clone happens.

The workaround therefore:

  • Deferred add_instructor until after clone_course().
  • Added a created_user fallback in get_in_process_course_actions() so the initiating user could still see the in-process rerun status in the meantime.

Long-term fix

The long-term fix is to allow role assignment on a scope key before its backing object exists, and backfill the link once the object is created.

This is being implemented in [openedx-authz#352], specifically [openedx-authz#369].

Once that fix ships, this workaround will no longer be necessary, and add_instructor can run unconditionally at its original call site again.

Draft: This PR is blocked on openedx-authz#369 being merged and released. Do not merge before that happens.

Opening this PR now so the revert is ready to go and can be reviewed ahead of time.

Testing Instructions

Once openedx-authz#369 is released and pinned:

  1. Enable the authz.enable_course_authoring flag globally.
  2. Trigger a course rerun from Studio.
  3. Verify that the rerun completes without a CourseOverview.DoesNotExist error.
  4. Verify that the user has instructor/staff access to the new course afterward.
  5. Disable the flag and repeat steps 2–4 to confirm that the legacy path still works.

Manual verification

This was manually verified in a sandbox with openedx-authz#369 installed and this revert applied:

  • The course rerun completed successfully.
  • Instructor/staff access was granted correctly afterward.

See openedx-authz#381 for tracking.

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

openedx-webhooks commented Aug 12, 2026

Copy link
Copy Markdown

Thanks for the pull request, @efortish!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

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.

test_create_course_disabled_by_flag and its 'authorized_staff_client'
fixture belonged to the old TestCourseHandlerAuthz class, which an
unrelated refactor (not openedx#38840) had already replaced with the leaner
TestCourseHandlerStaffAccess before openedx#38840 was even merged. The revert's
merge conflict was between that refactor and openedx#38840's insertion point,
not a real need to restore this method.
@BryanttV BryanttV linked an issue Aug 12, 2026 that may be closed by this pull request
@efortish
efortish marked this pull request as ready for review August 13, 2026 16:03
1.22.0 ships the fix for openedx-authz#352 (role assignment on a
course/library scope before its CourseOverview/ContentLibrary exists),
which this revert depends on.
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: Needs Triage

Development

Successfully merging this pull request may close these issues.

Revert changes in openedx-platform#38840

2 participants