chore: Updating Python Requirements - #245
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #245 +/- ##
==========================================
+ Coverage 87.46% 87.48% +0.02%
==========================================
Files 157 157
Lines 13287 13356 +69
Branches 1294 1296 +2
==========================================
+ Hits 11621 11685 +64
- Misses 1354 1361 +7
+ Partials 312 310 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
HEADLINE: Provisioning admin link rendering is hardened (switch to format_html) and Python dependencies are updated, but two admin link helpers can still crash when the underlying step record doesn’t exist.
Changes:
- Updated pinned Python dependencies across environment requirement sets (base/production/dev/test/quality/doc/validation), including Django
5.2.16and related tooling. - Added org-wide constraints for
social-auth-app-django/social-auth-coreto stay compatible withedx-drf-extensions<=10.6.0. - Replaced
mark_safe-based admin link HTML construction withformat_htmland added parameterized tests for link display methods.
Reviewed Changes (Structured Verdict)
House-Rule Findings
| Rule | Severity | Location | Finding | Should have used |
|---|---|---|---|---|
| — | — | — | No house-rule violations identified in this diff. | — |
Security & Tests
- moderate
enterprise_access/apps/provisioning/admin.py:136—enterprise_customer_admin_linkcan raise ifget_create_customer_step()returnsNone(admin page render failure). - moderate
enterprise_access/apps/provisioning/admin.py:148—subscription_plan_linkcan raise ifget_create_trial_subscription_plan_step()returnsNone(admin page render failure).
HOTSPOTS:
enterprise_access/apps/provisioning/admin.py:ProvisionNewCustomerWorkflowAdmin.*_link— admin readonly field rendering is brittle if step records are not yet present.
MERGE_READINESS: CHANGES_REQUIRED
Admin pages should not error when step records have not been created yet; these link helpers should return None like the other link display methods.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements/base.txt | Bumps core runtime pins; adds “via” notes reflecting common constraints usage. |
| requirements/production.txt | Updates production pin set consistent with base. |
| requirements/dev.txt | Updates dev/validation pin set consistent with base. |
| requirements/test.txt | Updates test pin set; adds “via” notes for common constraints. |
| requirements/quality.txt | Updates quality/lint pin set; adds “via” notes for common constraints. |
| requirements/doc.txt | Updates docs build pin set; adds “via” notes for common constraints. |
| requirements/validation.txt | Updates validation pin set. |
| requirements/django.txt | Updates Django pin to 5.2.16. |
| requirements/pip.txt | Updates build tooling pin (setuptools). |
| requirements/common_constraints.txt | Adds bounded constraints for social-auth-* packages for compatibility. |
| enterprise_access/apps/provisioning/admin.py | Switches admin link rendering to format_html; updates subscription plan step getter/URL target. |
| enterprise_access/apps/provisioning/tests/test_admin.py | Adds ddt-driven tests asserting correct link output and HTML escaping behavior. |
| step_record = obj.get_create_customer_step() | ||
| customer_uuid = step_record.output_object.uuid | ||
| url = f'{settings.LMS_URL}/admin/enterprise/enterprisecustomer/{customer_uuid}/change/' | ||
| return mark_safe(f'<a href="{url}">{url}</a>') | ||
| return format_html('<a href="{}">{}</a>', url, url) |
| step_record = obj.get_create_trial_subscription_plan_step() | ||
| plan_uuid = step_record.output_object.uuid | ||
| url = f'{settings.LICENSE_MANAGER_URL}/admin/subscriptions/subscriptionplan/{plan_uuid}/change/' | ||
| return mark_safe(f'<a href="{url}">{url}</a>') | ||
| return format_html('<a href="{}">{}</a>', url, url) |
| def create_subscription_plan_step_link(self, obj): | ||
| """ | ||
| Returns a link to the subscription plan creation step admin page for this workflow. | ||
| """ | ||
| step_record = obj.get_create_subscription_plan_step() | ||
| step_record = obj.get_create_trial_subscription_plan_step() |
There was a problem hiding this comment.
I think I'd agree with this, probably better to update the description and rename the function to include "trial" somewhere.
|
|
||
|
|
||
| @ddt.ddt | ||
| class ProvisioningAdminLinkDisplayTests(TestCase): |
There was a problem hiding this comment.
❌ As far as I'm concerned, you don't need to add these tests at all. The links displayed are only for use within a django admin page, not customer- or user-facing. I'd actually prefer you not add these tests because I don't think they're particularly helpful since the underlying change was straightforward and robust, and these tests set an unreasonable standard for testing other standard django functions.
There was a problem hiding this comment.
Let me put it this way: The next time you add a django admin page with a convenience link in the help text of a field, will you really want to write a unit test for that link?
| # 2026-07-06: Constrain social-auth-* packages to the latest version compatible with | ||
| # edx-drf-extensions<=10.6.0. (Newer versions require a POST instead of a GET.) | ||
| # Tracking issue: https://github.com/openedx/edx-drf-extensions/issues/561 | ||
| social-auth-app-django>=5.9.0,<6.0.0 | ||
| social-auth-core>=4.9.1,<5.0.0 |
There was a problem hiding this comment.
❌ This is outdated. Re-run make upgrade or alternatively just grab these lines from the source:
https://github.com/openedx/edx-lint/blob/master/edx_lint/files/common_constraints.txt#L22-L26
There was a problem hiding this comment.
This is also now redundant with the same constraints in constraints.txt. You can probably delete those lines from constraints.txt and just keep this common_constraints.txt version so that we don't have to remember to remove them later.
|
Closing as feedback is addressed in #253 |
Fixes for upgrade to pylint-django 2.8.0 causing quality CI failures due to
mark-safe-interpolation(W5151) rule.