Skip to content

feat: replace enterprise support contact-tag import with filter call - #455

Open
brobro10000 wants to merge 1 commit into
release-ulmofrom
brobro10000/ENT-11574
Open

feat: replace enterprise support contact-tag import with filter call#455
brobro10000 wants to merge 1 commit into
release-ulmofrom
brobro10000/ENT-11574

Conversation

@brobro10000

@brobro10000 brobro10000 commented Sep 3, 2026

Copy link
Copy Markdown

ENT-11574

Sibling of the openedx/openedx-platform PR of the same name, carrying the same call-site
change to this deployable fork so it can go through stage/prod ahead of the upstream merge,
per the enterprise plugin ticket runbook. Devstack only boots this repo (not
openedx/openedx-platform), so this is also the branch used for local integration testing.

Swaps the direct openedx.features.enterprise_support import in the support contact-us view
for a call to the SupportContactContextRequested openedx-filter. No settings changes in
this PR: OPEN_EDX_FILTERS_CONFIG registration for the pipeline step lives entirely in
edx-enterprise's own plugin_settings() (enterprise/settings/common.py), per the ENT-11830
ownership handoff — already merged in this repo (#281) well before this branch existed.
(An earlier version of this PR incorrectly re-added OPEN_EDX_FILTERS_CONFIG to
lms/envs/common.py; that's been reverted.)

lms/djangoapps/support/views/enrollments.py is untouched — this PR is scoped to the
contact-tag filter only.

Update: filter shape corrected per review feedback

Per pwnage101's review feedback
(and the follow-up comment
on user), the filter's original shape was wrong — it claimed to request the whole page
"context" but only ever passed/returned a bare tags list. SupportContactContextRequested.run_filter
now accepts/returns the entire context dict (the call is made after context['tags'] = tags),
and the unused user argument was dropped entirely (pipeline steps fetch it via crum
internally, matching the convention used elsewhere). Acknowledged directly on the review thread.

Since the original shape (#390 / openedx#2688 below) had already merged and released, this required new
PRs in openedx-filters and edx-enterprise rather than amendments — both are now merged and
released (3.11.0 / 8.11.0), and this PR's call site and requirements pins are updated to match,
verified locally against the real released packages.

Related PRs

Merge order (per the enterprise plugin ticket runbook)

Merge this after local devstack testing and before the openedx/openedx-platform PR.
Auto-deploys to stage on merge — test in stage, then deploy to prod and confirm working, before
the openedx-platform PR is rebased and merged.

CI note

Previously CI here was expected to be red until openedx-filters/edx-enterprise released — that
dependency chain has since resolved. Both packages are now released (openedx-filters 3.11.0,
edx-enterprise 8.11.0, carrying the shape-fix above) and this PR's requirements pins are bumped
to match. CI is green.

Testing

Same test change as the openedx-platform PR: SupportContactContextRequested.run_filter is
mocked at the call site in lms/djangoapps/support/tests/test_views.py; the pipeline-step
behavior itself is covered by edx-enterprise's own test suite.

Local devstack integration testing (with the openedx-filters, edx-enterprise, and this branch
checked out together) is required before merging — see handoff prompt for exact steps.

@brobro10000
brobro10000 force-pushed the brobro10000/ENT-11574 branch from 68d03c8 to f47a2ac Compare September 8, 2026 12:37
@brobro10000 brobro10000 changed the title feat: replace enterprise support view imports with filter calls feat: replace enterprise support contact-tag import with filter call Sep 8, 2026
@brobro10000
brobro10000 force-pushed the brobro10000/ENT-11574 branch 5 times, most recently from 8b6d59a to be4d946 Compare September 9, 2026 18:42
@brobro10000
brobro10000 marked this pull request as ready for review September 9, 2026 19:31
Comment on lines -49 to 52
enterprise_customer = enterprise_api.enterprise_customer_for_request(request)
if enterprise_customer:
tags.append('enterprise_learner')
tags, _ = SupportContactContextRequested.run_filter(tags=tags, user=request.user)

context['tags'] = tags

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.

Crap I just realized the naming and shape of this filter is completely wrong. The context is not being requested, the tags are being requested. Either:

  1. The name of this filter should be changed to SupportContactTagsContextRequested, or
  2. The filter call should come AFTER the context['tags'] = tags line and accept an entire context dictionary: context, _ = SupportContactContextRequested.run_filter(context=context, user=request.user)

I'm partial to the latter because it's more generally useful outside of enterprise.

This is unfortunately going to require patching both the openedx-filters and edx-enterprise related code, and re-releasing them, but now is the best time (before the filter is in-use).

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.

Also, I just realized since we're passing request.user, we don't even need to pass the user because it's available to the pipeline via crum, so the final call should look even simpler:

context = SupportContactContextRequested.run_filter(context=context)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch — addressed. Moved the filter call after context['tags'] = tags and changed SupportContactContextRequested.run_filter to accept/return the whole context dict instead of a bare tags list (also dropped the unused user arg per your follow-up comment). Landed in openedx-filters #394 and edx-enterprise openedx#2691 (both merged and released — 3.11.0 / 8.11.0), and this PR's call site + pins are now updated to match.

Sibling of the openedx/openedx-platform PR of the same name, carrying the
same call-site change to this deployable fork so it can go through
stage/prod ahead of the upstream merge, per the enterprise plugin ticket
runbook. Swaps the direct openedx.features.enterprise_support import in the
support contact-us view for a call to the SupportContactContextRequested
openedx-filter. Per pwnage101's review feedback, the filter call is made
after context['tags'] = tags and operates on the whole page context dict
rather than a bare tags list, since it's the context (not just the tags)
that's conceptually being requested; the unused user argument is dropped
entirely since pipeline steps that need it fetch it via crum internally.
No settings changes here: OPEN_EDX_FILTERS_CONFIG registration for the
pipeline step lives in edx-enterprise's own plugin_settings()
(enterprise/settings/common.py), per the ENT-11830 ownership handoff.

Also bumps openedx-filters (3.10.0 -> 3.11.0, carrying the context-shape
change above) and edx-enterprise (8.10.0 -> 8.11.0, carrying the matching
SupportContactEnterpriseTagStep update) in requirements/constraints.txt and
the compiled requirements files, now that both releases are published on
PyPI. Verified locally against the real released packages (not just the
mocked unit test) that SupportContactContextRequested.run_filter accepts
and returns a bare context dict as expected.

ENT-11574

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

looking much better, just one nit to simplify the code a bit.

if enterprise_customer:
tags.append('enterprise_learner')

context['tags'] = tags

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.

Nit: you could delete this line and just do context['tags'] = ['LMS'] above on line 38.

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.

2 participants