Honor the enrollment mode in the Open edX enrollment webhook - #3840
Open
Anas12091101 wants to merge 1 commit into
Open
Honor the enrollment mode in the Open edX enrollment webhook#3840Anas12091101 wants to merge 1 commit into
Anas12091101 wants to merge 1 commit into
Conversation
OpenAPI ChangesShow/hide changesUnexpected changes? Ensure your branch is up-to-date with |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Open edX enrollment webhook to preserve enrollment modes locally.
Changes:
- Forwards the payload’s optional mode with an audit fallback.
- Adds coverage for mode handling and existing enrollments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
openedx/views.py |
Processes and logs webhook enrollment modes. |
openedx/views_test.py |
Tests mode forwarding, defaults, and idempotency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
edx_enrollment_webhook now forwards the payload's optional "mode" to create_local_enrollment instead of always enrolling at the default audit mode. Absent or empty values fall back to the default, so the existing course access role callers are unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anas12091101
force-pushed
the
anas/enrollment-webhook-honor-mode
branch
from
August 11, 2026 11:54
998aa8d to
b21dd01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
mitodl/hq#12748
Description (What does it do?)
edx_enrollment_webhooknow forwards the payload's optionalmodetocreate_local_enrollmentinstead of always enrolling at the default audit mode. Absent or empty values fall back to the default, so the existing course access role callers are unaffected.Pairs with the
ol_openedx_events_handlerchange in mitodl/open-edx-plugins, which starts sendingmode.How can this be tested?
pytest openedx/views_test.py— 33 pass.Or POST to
/api/openedx_webhook/enrollment/with{"email": ..., "course_id": ..., "mode": "verified"}and confirm the resultingCourseRunEnrollment.enrollment_modeisverified. Existing enrollments keep their mode, sincecreate_local_enrollmentusesget_or_create.