Repository navigation
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (91.30%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #2702 +/- ##
==========================================
+ Coverage 87.06% 87.27% +0.21%
==========================================
Files 265 274 +9
Lines 17280 17872 +592
Branches 1709 1788 +79
==========================================
+ Hits 15044 15597 +553
- Misses 1898 1917 +19
- Partials 338 358 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c20ea12 to
79c8e7e
Compare
20ca3cc to
2f35c4b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The oversized migration has unresolved correctness, reliability, performance, and coverage issues.
13 open findings
Standalone POST crashes when platform models are unavailable · New Refund failures are swallowed without retrying · New Missing cache invalidation when enterprise access is revoked · New CSV error line numbers are off by one · New Consent service queried when enrollment is missing · New Enterprise enrollment task performs N+1 relationship queries · New Session cache serves stale enterprise portal after customer changes · New Assertion is unreachable inside pytest.raises · New Test sets portal flag on relationship instead of customer · New Missing coverage for consent_required behavior · New Missing direct tests for portal context builder · New Exception message fails to interpolate diagnostic values · New Missing direct tests for enterprise branding payload builder · New
What changed in this PR
Moves openedx-platform’s enterprise support package into enterprise.platform_support, rewires consumers, and adds standalone test infrastructure.
Changes:
- Adds platform-support APIs, utilities, signals, tasks, serializers, admin views, and templates.
- Repoints existing enterprise integrations to internal imports.
- Adds tests, compatibility stubs, signal registration, and release metadata.
Key concerns: stale enterprise caches, swallowed refund failures, standalone admin errors, and incomplete test coverage. The PR also substantially exceeds the repository’s 400-line/10-file review threshold.
| File | Description |
|---|---|
tox.ini |
Updates import formatting. |
tests/test_platform_support/test_utils.py |
Tests support utilities. |
tests/test_platform_support/test_signals.py |
Tests signal handlers. |
tests/test_platform_support/test_serializers.py |
Tests enrollment serialization. |
tests/test_platform_support/test_context.py |
Tests event context. |
tests/test_platform_support/test_api.py |
Tests support APIs. |
tests/test_platform_support/test_admin.py |
Tests CSV admin workflow. |
tests/test_platform_support/platform_stubs.py |
Stubs platform-only dependencies. |
tests/test_platform_support/mixins.py |
Provides API test helpers. |
tests/test_platform_support/factories.py |
Provides specialized factories. |
tests/test_platform_support/enrollments/test_utils.py |
Tests enrollment utilities. |
tests/test_platform_support/enrollments/__init__.py |
Marks test package. |
tests/test_platform_support/__init__.py |
Defines test fixtures. |
tests/test_apps.py |
Tests signal registration. |
tests/filters/test_logistration.py |
Updates migrated-path documentation. |
enterprise/views.py |
Uses internal login utility. |
enterprise/utils.py |
Uses internal enrollment utility. |
enterprise/templates/enterprise_support/enterprise_consent_declined_notification.html |
Adds consent notification template. |
enterprise/templates/enterprise_support/admin/enrollment_attributes_override.html |
Adds admin upload template. |
enterprise/signals.py |
Uses internal customer lookup. |
enterprise/settings/test.py |
Adds standalone support settings. |
enterprise/platform_support/utils.py |
Adds enterprise UI and cache utilities. |
enterprise/platform_support/tasks.py |
Adds consent-cache clearing task. |
enterprise/platform_support/signals.py |
Adds platform and model handlers. |
enterprise/platform_support/serializers.py |
Adds enrollment serializer. |
enterprise/platform_support/README.rst |
Documents package purpose. |
enterprise/platform_support/enrollments/utils.py |
Adds LMS enrollment logic. |
enterprise/platform_support/enrollments/exceptions.py |
Adds enrollment exceptions. |
enterprise/platform_support/enrollments/__init__.py |
Marks enrollment package. |
enterprise/platform_support/context.py |
Adds event context helper. |
enterprise/platform_support/api.py |
Adds enterprise and consent APIs. |
enterprise/platform_support/admin/views.py |
Adds CSV override view. |
enterprise/platform_support/admin/forms.py |
Adds CSV upload form. |
enterprise/platform_support/admin/__init__.py |
Marks admin package. |
enterprise/platform_support/__init__.py |
Marks support package. |
enterprise/overrides/program_nudge_email.py |
Uses internal learner lookup. |
enterprise/overrides/learner_home.py |
Uses internal support APIs. |
enterprise/overrides/course_home_progress.py |
Uses internal naming utility. |
enterprise/overrides/branding.py |
Uses internal branding utilities. |
enterprise/management/commands/email_drip_for_missing_dsc_records.py |
Uses internal access check. |
enterprise/filters/support.py |
Repoints support filter imports. |
enterprise/filters/logistration.py |
Repoints authentication filter imports. |
enterprise/filters/discounts.py |
Repoints learner check import. |
enterprise/filters/dashboard.py |
Repoints dashboard imports. |
enterprise/filters/course_modes.py |
Repoints customer lookup import. |
enterprise/core_api.py |
Repoints customer resolution import. |
enterprise/constants.py |
Adds signal dispatch identifiers. |
enterprise/apps.py |
Registers migrated signal handlers. |
enterprise/admin/__init__.py |
Registers migrated admin view. |
enterprise/__init__.py |
Bumps version to 8.18.0. |
consent/helpers.py |
Uses internal consent support APIs. |
CHANGELOG.rst |
Documents the migration release. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
625ab3d to
c04f8be
Compare
Moves openedx-platform's `openedx.features.enterprise_support` module into this repo as `enterprise.platform_support`, so the platform copy can be deleted and edx-enterprise stops being a mandatory platform dependency. Related changes: - The package's five signal handlers move into `enterprise/signals.py`, beside this app's others. `EnterpriseConfig.ready()` connects the three bound to openedx-platform grade and unenrollment signals, in the LMS only, since `EnterpriseSupportConfig` was never installed in Studio. - `enterprise/signals.py`'s four existing module-level `.connect()` calls move out of import time: the two `openedx_events` hookups become `@receiver`, and the two platform-only ones are connected in `EnterpriseConfig.ready()`. - `markupsafe`, which now stands in for the platform's `HTML`/`Text` wrappers, is declared in `requirements/base.in` instead of arriving only through jinja2. - Keep release-ulmo's `build_enterprise_branding_for_authn_mfe`. - Keep release-ulmo's `enterprise_slug` sidebar-context key. - Keep release-ulmo's `ENABLE_LEGACY_INTEGRATED_CHANNELS` switch. - Keep release-ulmo's null-safe SSO pipeline lookup. - Keep release-ulmo's `@set_code_owner_attribute` on the Celery task. - ``enterprise_enabled()`` is now a hybrid implementation which now honors both the top-level `ENABLE_ENTERPRISE_INTEGRATION` setting used by master and the `FEATURES` entry used by release-ulmo. The moved tests live at `tests/test_platform_support/` rather than beside the package, because this repo keeps every test under the top-level `tests/` tree and pytest's ``testpaths = tests`` collects nothing outside it; the signal-handler tests sit in `tests/test_enterprise/test_signals.py` with the module they test. 123 tests run and pass, bringing the moved package to 92% coverage. Adapting them to run without an openedx-platform install took more than an import flip: - `platform_stubs.py` registers stand-ins in `sys.modules` for the modules the package imports lazily at call time -- the enrollment error classes, the completion app and the branding API -- so that `except` clauses and `assertRaises` match the classes the tests raise. - Platform test base classes and fixtures give way to this repo's equivalents: Django's `TestCase` for `CacheIsolationTestCase`, `test_utils` factories for the platform's, and explicit cache clears in place of the cache isolation the platform's test settings used to provide. - The three modulestore-backed modules are rewritten against mocks: the admin view's two ORM entry points, the signal handlers invoked directly rather than through platform signals, and the completion app behind `is_course_accessed`. - release-ulmo's three tests for `build_enterprise_branding_for_authn_mfe` are ported. The rest come from master's test files, which never had the function. - HTTP mocking moves from httpretty, which this repo does not depend on, to `responses`, which it already pins and uses in 33 other test modules. - `test_enterprise_fields_only` now patches `get_configuration_value`. The move swapped the platform's `configuration_helpers` for this repo's helper, but the test kept patching the old name, which no longer exists on the module. - The unittest-style assertions the modules arrived with are converted to plain `assert` and `pytest.raises`, removing all eleven `# noqa: PT009`/`PT027` suppressions. The one `# noqa: PT019` goes too: its parameter was named `_` only because it was unused, so it is now named and asserted on instead. - `test_logout.py` is not migrated. It covers `LogoutView._is_enterprise_target`, which stays in the LMS, so it is relocated there instead. `enterprise/settings/test.py` gains the ten settings the moved package reads, including `ENTERPRISE_API_URL`, `ENTERPRISE_CONSENT_API_URL`, `BASE_COOKIE_DOMAIN` and `SUPPORT_SITE_LINK`. These still come from `lms/envs/common.py` at runtime; migrating them into `plugin_settings()` is ENT-11577. ENT-11576 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c04f8be to
1fc4e5a
Compare
brobro10000
left a comment
There was a problem hiding this comment.
Reviewed with Claude Code (pr-review-hil, cross-checked against the companion edx-platform#494/openedx-platform#39166 split). This is a faithful move — spot-checked signals.py, apps.py, and platform_stubs.py against the pre-image of the deleted openedx/features/enterprise_support/, and the moved logic is byte-for-byte unchanged aside from the new conditional signal-wiring in apps.py::ready(). A couple of non-blocking items:
codecov/patchis currently failing at 91.30% vs. the 95% target, concentrated in the newplatform_support/tree. Small, closeable gap — worth a look before merge, not blocking.- Heads up: edx-platform#494 and openedx-platform#39166 both pin
edx-enterprise==9.0.0, which doesn't exist on PyPI until this merges and releases. Worth confirming the merge/release order is coordinated before any of the three land.
See inline comment below. Otherwise LGTM.
|
|
||
|
|
||
| @receiver(post_save, sender=models.EnterpriseCourseEnrollment) | ||
| def update_dsc_cache_on_course_enrollment(sender, instance, **kwargs): # pylint: disable=unused-argument |
There was a problem hiding this comment.
update_dsc_cache_on_course_enrollment (here) and update_dsc_cache_on_enterprise_customer_update (line 566) have no SERVICE_VARIANT gate, so now that enterprise is registered under both lms.djangoapp and cms.djangoapp, they're reachable from Studio — which was structurally impossible before this move (EnterpriseSupportConfig was never installed in Studio). test_ready_activates_data_sharing_consent_cache_signal_handlers suggests this is intentional (these react to edx-enterprise's own models, unlike the three LMS-only grade/unenrollment handlers which do get a SERVICE_VARIANT gate in apps.py). Can you confirm that's deliberate? Non-blocking either way.



Moves openedx-platform's
openedx/features/enterprise_support/package into this repo asenterprise.platform_support, so the platform copy can be deleted and edx-enterprise stops being a mandatory platform dependency at the import level.ENT-11576