Skip to content

feat: replace enterprise imports in learner_home/views.py with pluggable_override - #383

Merged
marlonkeating merged 1 commit into
release-ulmofrom
mkeating/ENT-11571-ulmo
Jul 22, 2026
Merged

feat: replace enterprise imports in learner_home/views.py with pluggable_override#383
marlonkeating merged 1 commit into
release-ulmofrom
mkeating/ENT-11571-ulmo

Conversation

@marlonkeating

@marlonkeating marlonkeating commented Jul 10, 2026

Copy link
Copy Markdown

Sister PR to openedx#38107 as part of ENT-11571

Blocked on release of openedx/edx-enterprise#2554

Copilot AI review requested due to automatic review settings July 10, 2026 14:25
@marlonkeating
marlonkeating marked this pull request as draft July 10, 2026 14:25

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 aims to decouple learner_home from the built-in Enterprise support code by removing direct Enterprise imports in lms/djangoapps/learner_home/views.py and introducing a pluggable_override hook for Enterprise customer lookup. It also bumps the edx-enterprise dependency version across the platform requirements/constraints to align with the related Enterprise-side changes.

Changes:

  • Bump edx-enterprise from 8.3.0 to 8.5.0 in constraints and compiled requirements sets.
  • Remove openedx.features.enterprise_support.api imports from Learner Home and add a pluggable_override-decorated get_enterprise_customer hook.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
requirements/edx/testing.txt Bumps pinned edx-enterprise version for test requirements.
requirements/edx/doc.txt Bumps pinned edx-enterprise version for doc requirements.
requirements/edx/development.txt Bumps pinned edx-enterprise version for dev requirements.
requirements/edx/base.txt Bumps pinned edx-enterprise version in base requirements.
requirements/constraints.txt Bumps globally constrained edx-enterprise version.
lms/djangoapps/learner_home/views.py Removes Enterprise support imports and introduces a pluggable override for Enterprise customer retrieval.

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

return learner_data[0]["enterprise_customer"] if learner_data else None
else:
return enterprise_customer_from_session_or_learner_data(request)
return None
Comment thread lms/djangoapps/learner_home/views.py Outdated
@marlonkeating
marlonkeating force-pushed the mkeating/ENT-11571-ulmo branch 2 times, most recently from 119e0a0 to 9935474 Compare July 20, 2026 18:28
@marlonkeating
marlonkeating marked this pull request as ready for review July 20, 2026 20:27
Copilot AI review requested due to automatic review settings July 20, 2026 20:27

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 7 out of 7 changed files in this pull request and generated 3 comments.


import logging
from collections import OrderedDict
from typing import TYPE_CHECKING, Optional, TypedDict
Comment thread lms/djangoapps/learner_home/views.py Outdated
Comment on lines +216 to +219
uuid: str
slug: str
auth_org_id: Optional[str]
enable_learner_portal: bool
Comment thread requirements/edx/development.txt Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 19:15
@marlonkeating
marlonkeating force-pushed the mkeating/ENT-11571-ulmo branch from a357700 to 96ca085 Compare July 21, 2026 19:15
Comment thread lms/djangoapps/learner_home/views.py Outdated

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 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

lms/djangoapps/learner_home/views.py:219

  • EnterpriseDashboardSerializer explicitly supports missing auth_org_id (see TestEnterpriseDashboardSerializer.test_no_auth_org_id), but this TypedDict currently requires the auth_org_id key (even if its value is Optional). That makes the stated override contract stricter than the actual consumer and will cause type-checking friction for plugin authors who omit the key.
    slug: str
    auth_org_id: Optional[str]
    enable_learner_portal: bool

Comment thread lms/djangoapps/learner_home/test_views.py
Copilot AI review requested due to automatic review settings July 21, 2026 19:35

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 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 21, 2026 20:02

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 2 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +432 to +437
return {
"prev_fn": prev_fn,
"user": user,
"request": request,
"is_masquerading": is_masquerading,
}
Comment on lines +232 to 236
Return the enterprise customer dict for the given user, or None.

This function can be overridden by an installed plugin via the
OVERRIDE_LEARNER_HOME_GET_ENTERPRISE_CUSTOMER setting.
"""
Copilot AI review requested due to automatic review settings July 21, 2026 22:04

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 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

lms/djangoapps/learner_home/views.py:215

  • EnterpriseDashboardSerializer (and its tests) support auth_org_id being omitted entirely, but this TypedDict currently makes all keys required. That can make the stated override contract stricter than the data actually accepted/produced (and stricter than existing enterprise-customer dicts), which reduces the usefulness of the type hint for override implementers.
class EnterpriseCustomerData(TypedDict):

@pwnage101 pwnage101 left a comment

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.

LGTM! Please be careful to make sure what gets merged is one commit with a useful and accurate message. Ideally I'd like to have seen the commit message before approving

@marlonkeating
marlonkeating force-pushed the mkeating/ENT-11571-ulmo branch from 3e82a18 to 0e8792e Compare July 22, 2026 15:19
@marlonkeating
marlonkeating merged commit fadad02 into release-ulmo Jul 22, 2026
64 checks passed
@marlonkeating
marlonkeating deleted the mkeating/ENT-11571-ulmo branch July 22, 2026 16:11
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