Skip to content

Enforce export compliance verification on course/program enrollment - #3786

Open
annagav wants to merge 7 commits into
mainfrom
ag/export-compliance-enrollment
Open

Enforce export compliance verification on course/program enrollment#3786
annagav wants to merge 7 commits into
mainfrom
ag/export-compliance-enrollment

Conversation

@annagav

@annagav annagav commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

Related to #3706

Description (What does it do?)

  • Wires the compliance app's CyberSource export check into create_run_enrollments and create_program_enrollments via a new _verify_exports_compliance_for_enrollment helper in courses/api.py, gated
    behind the EXPORT_COMPLIANCE_CHECK_ENABLED feature flag (main/features.py)
  • Enrollment is blocked and an ExportComplianceError is raised when CyberSource does not accept the check, for both course-run and program enrollments (audit and verified modes)
  • Surfaces ExportComplianceCheckError as a user-facing error from the v1–v3 enrollment surfaces:
    • courses/serializers/v1/v2/v3/courses.py — raises a DRF ValidationError with exc.to_error_detail()
    • courses/views/v1/init.py — redirects with a user-facing enrollment-blocked message
    • courses/views/v2/init.py — returns a 400 response, including for the verified-program-enrollment reconciliation path
    • courses/views/v3/init.py — raises a ValidationError
  • Adds an autouse mocked_export_compliance conftest fixture so existing tests continue to pass with the check enabled by default, and updates drf_lint_baseline.json for line shifts in the touched
    serializers
  • Updates _verify_exports_compliance_for_enrollment to pass a courseware object (a CourseRun for run enrollments, a Program for each program enrollment) through to verify_user_with_exports, matching that function's (user, courseware_object) signature from Add CyberSource export compliance data model #3793

Stacked on nl/export-compliance-cache (#3793), which adds the ExportComplianceLog caching model this PR's compliance checks read/write through, and which is itself stacked on ag/export-compliance-app (#3785). This PR only contains the enrollment integration; diff against the base branch reflects just that.

Test plan

  • docker compose exec web pytest courses/api_test.py
  • docker compose exec web pytest courses/
  • Manually exercise course-run and program enrollment with EXPORT_COMPLIANCE_CHECK_ENABLED=True for both an accepted and a rejected CyberSource decision

@annagav annagav changed the title Ag/export compliance enrollment Enforce export compliance verification on course/program enrollment Jul 23, 2026
@rhysyngsun
rhysyngsun force-pushed the ag/export-compliance-enrollment branch from d4b62f3 to 3f99def Compare July 29, 2026 16:50
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@rhysyngsun
rhysyngsun changed the base branch from main to nl/export-compliance-cache July 29, 2026 16:51
@rhysyngsun
rhysyngsun force-pushed the ag/export-compliance-enrollment branch from 3f99def to 1681ec8 Compare August 4, 2026 21:00
Base automatically changed from nl/export-compliance-cache to main August 6, 2026 17:09
@rhysyngsun
rhysyngsun force-pushed the ag/export-compliance-enrollment branch from 1681ec8 to 7127b7e Compare August 6, 2026 20:41
@annagav
annagav force-pushed the ag/export-compliance-enrollment branch 2 times, most recently from 860d7c6 to 50d381c Compare August 7, 2026 11:40
@annagav
annagav force-pushed the ag/export-compliance-enrollment branch 2 times, most recently from 38210bc to 7ee0b27 Compare August 10, 2026 19:51
annagav and others added 7 commits August 11, 2026 11:44
Wires the compliance app's CyberSource export check into
create_run_enrollments/create_program_enrollments behind the
EXPORT_COMPLIANCE_CHECK_ENABLED feature flag, and surfaces
ExportComplianceCheckError as a user-facing validation error from the
v1-v3 enrollment serializers/views.
verify_user_with_exports now takes (user, courseware_object). Pass the
representative course run for run enrollments, and check each program
individually for program enrollments (Program is now the accepted
courseware object type, and a batch may contain multiple programs).
ExportComplianceResult.accepted now checks against
ExportComplianceLog.ACCEPTED_DECISIONS ({COMPLETED, MANUALLY_APPROVED}),
so tests asserting an accepted outcome need decision="COMPLETED" rather
than the no-longer-recognized "ACCEPT".
@annagav
annagav force-pushed the ag/export-compliance-enrollment branch from 7ee0b27 to 6b5b2bf Compare August 11, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants