Skip to content

chore: Updating Python Requirements - #245

Closed
marlonkeating wants to merge 2 commits into
mainfrom
mkeating/upgrade-python-requirements-f976d5b
Closed

chore: Updating Python Requirements#245
marlonkeating wants to merge 2 commits into
mainfrom
mkeating/upgrade-python-requirements-f976d5b

Conversation

@marlonkeating

@marlonkeating marlonkeating commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Fixes for upgrade to pylint-django 2.8.0 causing quality CI failures due to mark-safe-interpolation (W5151) rule.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.48%. Comparing base (f976d5b) to head (70b44b5).
⚠️ Report is 7 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marlonkeating
marlonkeating marked this pull request as ready for review July 24, 2026 20:43
@marlonkeating
marlonkeating requested review from a team as code owners July 24, 2026 20:43
Copilot AI review requested due to automatic review settings July 24, 2026 20:43

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

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.16 and related tooling.
  • Added org-wide constraints for social-auth-app-django / social-auth-core to stay compatible with edx-drf-extensions<=10.6.0.
  • Replaced mark_safe-based admin link HTML construction with format_html and 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

  1. moderate enterprise_access/apps/provisioning/admin.py:136enterprise_customer_admin_link can raise if get_create_customer_step() returns None (admin page render failure).
  2. moderate enterprise_access/apps/provisioning/admin.py:148subscription_plan_link can raise if get_create_trial_subscription_plan_step() returns None (admin page render failure).

HOTSPOTS:

  1. 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.

Comment on lines 136 to +139
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)
Comment on lines +148 to +151
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)
Comment on lines 116 to +120
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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❌ 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Comment on lines +23 to +27
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❌ 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

@pwnage101 pwnage101 Jul 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@marlonkeating

Copy link
Copy Markdown
Contributor Author

Closing as feedback is addressed in #253

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.

5 participants