Skip to content

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

Draft
marlonkeating wants to merge 3 commits into
release-ulmofrom
mkeating/ENT-11571-ulmo
Draft

feat: replace enterprise imports in learner_home/views.py with pluggable_override#383
marlonkeating wants to merge 3 commits 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

@pluggable_override('OVERRIDE_LEARNER_HOME_GET_ENTERPRISE_CUSTOMER')
@function_trace("get_enterprise_customer")
def get_enterprise_customer(user, request, is_masquerading):

@pwnage101 pwnage101 Jul 10, 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.

Now that the actual business logic is disjoint from this repo, we need to be as clear as possible about the contract. This function returns an object whose keys are hard-coded downstream, so at the very least those keys should be documented here at the plugin interface.

In the past, we'd just document the keys in the docstring, but I think nowadays I'd explicitly type the dict:

class EnterpriseCustomerData(TypedDict):
    """Contract for the OVERRIDE_LEARNER_HOME_GET_ENTERPRISE_CUSTOMER return value."""
    name: str
    uuid: str
    slug: str
    auth_org_id: Optional[str]
    enable_learner_portal: bool

Then update the function signature:

def get_enterprise_customer(
    user: "User",
    request: Request,
    is_masquerading: bool,
) -> Optional[EnterpriseCustomerData]:

pwnage101 and others added 3 commits July 15, 2026 14:56
…ble_override

Remove enterprise_customer_from_session_or_learner_data and get_enterprise_learner_data_from_db
imports. Replace get_enterprise_customer body with a default return None, decorated with
@pluggable_override('OVERRIDE_LEARNER_HOME_GET_ENTERPRISE_CUSTOMER').

ENT-11571
@marlonkeating marlonkeating force-pushed the mkeating/ENT-11571-ulmo branch from b201542 to 119e0a0 Compare July 15, 2026 14:59
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