Skip to content

feat: decouple enterprise from course start-date validation - #339

Merged
pwnage101 merged 1 commit into
release-ulmofrom
pwnage101/ENT-11544-edx-CourseStartDateValidationFailed
Jun 23, 2026
Merged

feat: decouple enterprise from course start-date validation#339
pwnage101 merged 1 commit into
release-ulmofrom
pwnage101/ENT-11544-edx-CourseStartDateValidationFailed

Conversation

@pwnage101

@pwnage101 pwnage101 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Instead of enterprise-specific logic throwing an enterprise-specific start date validation error, CourseStartDateValidationFailed filter can now be used by plugins to throw a custom start date error.

ENT-11544


blocked by:

blocks:


Integration Testing

I ran scripts/provision-integration-test-ENT-11544.sh then manually tested the following scenarios in devstack:

  1. Enterprise learner has a subsidized enrollment in a future course:
  2. Enterprise learner has a subsidized enrollment in an unscheduled course:
  3. Enterprise learner has a NON-subsidized enrollment in a future course:
  4. NON-enterprise learner has a NON-subsidized enrolled in a future course:

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR decouples enterprise-specific behavior from the core course start-date access check by introducing an Open edX Filters hook (CourseStartDateValidationFailed) that lets plugins substitute a custom start-date error payload, instead of hard-coding enterprise-specific errors in edx-platform.

Changes:

  • Replaced enterprise-specific start-date error branching with a CourseStartDateValidationFailed filter hook in check_start_date.
  • Extended StartDateError to support optional error-code and message overrides, and removed the dedicated StartDateEnterpriseLearnerError.
  • Updated/trimmed tests to remove enterprise enrollment setup and to validate the new filter override behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
lms/djangoapps/courseware/access_utils.py Runs CourseStartDateValidationFailed on start-date denial and converts filter overrides into StartDateError overrides.
lms/djangoapps/courseware/access_response.py Adds override fields to StartDateError and removes the enterprise-specific start-date error class.
lms/djangoapps/courseware/tests/test_views.py Updates access-utils tests to mock the new filter override path instead of enterprise enrollment plumbing.
lms/djangoapps/courseware/tests/test_access.py Removes enterprise-specific query-count test and renames the remaining query-count test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lms/djangoapps/courseware/access_utils.py
Comment thread lms/djangoapps/courseware/tests/test_views.py Outdated
Instead of enterprise-specific logic throwing an enterprise-specific
start date validation error, CourseStartDateValidationFailed filter can
now be used by plugins to throw a custom start date error.

ENT-11544
@pwnage101
pwnage101 force-pushed the pwnage101/ENT-11544-edx-CourseStartDateValidationFailed branch from eb81f50 to b6e4b1e Compare June 22, 2026 23:58
@pwnage101
pwnage101 requested a review from Copilot June 23, 2026 00:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@kiram15 kiram15 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks good! Should we consider pinning the openedx-filters version?

@pwnage101

Copy link
Copy Markdown
Member Author

openedx-filters has already been pinned to the version I need in the previous PR: #338

@pwnage101
pwnage101 merged commit cf52fbb into release-ulmo Jun 23, 2026
65 checks passed
@pwnage101
pwnage101 deleted the pwnage101/ENT-11544-edx-CourseStartDateValidationFailed branch June 23, 2026 19:07
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.

3 participants