Skip to content

Conversation

@Serj-N
Copy link
Contributor

@Serj-N Serj-N commented Aug 6, 2025

Summary
This PR extends the MFE Config API in order to return MFE configuration values using the following hierarchy, in the order from most specific to least specific:

  1. site configuration MFE_CONFIG_OVERRIDES
  2. settings MFE_CONFIG_OVERRIDES
  3. site configuration MFE_CONFIG
  4. settings MFE_CONFIG
  5. site configuration plain value
  6. settings plain value

The following fields have been added to the configuration being returned:

  • ENABLE_COURSE_SORTING_BY_START_DATE
  • HOMEPAGE_PROMO_VIDEO_YOUTUBE_ID
  • HOMEPAGE_COURSE_MAX
  • COURSE_ABOUT_TWITTER_ACCOUNT
  • NON_BROWSABLE_COURSES
  • ENABLE_COURSE_DISCOVERY

Usage
Usage remains exactly as before:
Get common config:
GET /api/mfe_config/v1

Get app config (common + mfe-specific overrides):
GET /api/mfe_config/v1?mfe=name_of_mfe

Example of a GET response
(abbreviated)

{
  "ENABLE_COURSE_SORTING_BY_START_DATE": true,
  "HOMEPAGE_PROMO_VIDEO_YOUTUBE_ID": "your-youtube-id",
  "HOMEPAGE_COURSE_MAX": 9,
  "BASE_URL": "apps.local.openedx.io",
  "CSRF_TOKEN_API_PATH": "/csrf/api/v1/token",
  "CREDENTIALS_BASE_URL": "",
  ...
}

Dependent PRs:
feat: [FC-86] Home page banner section
feat: [FC-86] Added Home page courses list
feat: [FC-86] Created Intro section for Course About page
feat: [FC-86] Added Course About sidebar
feat: [FC-86] Added course overview and updated sidebar
feat: [FC-86] Updated Header links
feat: [FC-86] Added DataTable for Catalog page
feat: [FC-86] Added filtration for Catalog page
feat: [FC-86] Added course search for DataTable

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Aug 6, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Aug 6, 2025

Thanks for the pull request, @Serj-N!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Aug 6, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Aug 6, 2025

# Based config values, used in tests to build a correct expected response
default_base_config = {
'course_about_twitter_account': '@YourPlatformTwitterAccount',
Copy link
Contributor

@cmltaWt0 cmltaWt0 Aug 7, 2025

Choose a reason for hiding this comment

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

Do we still use Twitter even if it is called X now? Just wondering, no actions required.

"course_about_twitter_account",
settings.PLATFORM_TWITTER_ACCOUNT
),
"is_cosmetic_price_enabled": settings.FEATURES.get("ENABLE_COSMETIC_DISPLAY_PRICE"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to clarify whether we need a MFe config here? I believe the preliminary decision was to allow to override from MFE_CONFIG.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still marked as "Unknown" in the "Do we want this functionality?" column of the spreadsheet.

I left a comment there asking:

Could you elaborate on this? I found https://github.com/openedx/edx-platform/blob/0bf88d225f563ad5a81205706a5ed9be91fe0794/lms/templates/courseware/course_about.html#L222-L228 and it's not clear to me how the "when there is no registration price" part of this fits in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed as discussed in the spreadsheet

settings.PLATFORM_TWITTER_ACCOUNT
),
"is_cosmetic_price_enabled": settings.FEATURES.get("ENABLE_COSMETIC_DISPLAY_PRICE"),
"courses_are_browsable": settings.FEATURES.get("COURSES_ARE_BROWSABLE")
Copy link
Contributor

@cmltaWt0 cmltaWt0 Aug 7, 2025

Choose a reason for hiding this comment

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

Non clear decision yet but it looks like we are leaning toward the following fallback in frontend-app-learner-dashboard:

NON_BROWSABLE_COURSES fall back to !(not)COURSES_ARE_BROWSABLE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to NON_BROWSABLE_COURSES

response = self.client.get(self.mfe_config_api_url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json(), settings.MFE_CONFIG)
self.assertEqual(response.json(), settings.MFE_CONFIG | default_base_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it differs from this order:

 # Merge the three configs in the order of precedence
merged_config = base_config | mfe_config | mfe_config_overrides

Could you explain why?

Copy link
Contributor Author

@Serj-N Serj-N Aug 7, 2025

Choose a reason for hiding this comment

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

This was appended to make the existing tests pass, and in those particular tests the order of precedence didn't matter much, considering the test values returned. But you are right, it is better to use the established order everywhere to avoid confusion. Thanks for noticing. Done.

Comment on lines 103 to 106
"show_homepage_promo_video": configuration_helpers.get_value(
"show_homepage_promo_video",
False
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we can remove this.

From our conversations on the spreadsheet:

@brian-smith-tcril: I added a "Yes (needs DEPR)" option to this dropdown. This is functionality we want to keep, but I believe the implementation change will require a DEPR.

@PKulkoRaccoonGang: Am I understanding correctly that the approval will come after we pass the DEPR?

@brian-smith-tcril: My understanding is that we should:

  • Not expose show_homepage_promo_video to the MFE
  • Ensure the functionality provided by the show_homepage_promo_video toggle (having a homepage without a promo video) still exists in the MFE. This will be covered by the suggested check for a valid homepage_promo_video_youtube_id value and a plugin slot.
  • During the release where site operators can choose to use the legacy pages or the MFE, we will have a large DEPR covering the removal of the legacy pages
  • We need to make sure to note this change in that DEPR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

"show_homepage_promo_video",
False
),
"homepage_promo_video_youtube_id": configuration_helpers.get_value(
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the case of other fields in MFE config it makes sense for the new ones to also be in the format upper case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to uppercase (even though apparently the official docs do not enforce this).
Done.

@cmltaWt0 cmltaWt0 requested a review from feanil August 12, 2025 11:30
@sarina
Copy link
Contributor

sarina commented Aug 12, 2025

We've updated the spreadsheet and I think we're quite close to this. @Serj-N if you could work on fixing the tests I think we can take this out of draft when they pass and get @feanil 's review

Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

The general approach and code makes sense to me and I approve of it, I have one question where I'm looking for more information and a bit more documenting and ticketing that I'd like to see before this merges.

I think we should create the relevant DEPR for the dropping of the legacy settings from the MFE config and maybe fully from the settings as well if they're not used anywhere else. That DEPR should be created and linked in the comments here so that it's easy to go find out why we're doing this in the future and come cleanup after ourselves.

I'm assuming the number of settings that are getting pulled here may change so I'm fine with creating the DEPR once that has all been settled but it should be done before we merge this code.

),
"HOMEPAGE_PROMO_VIDEO_YOUTUBE_ID": configuration_helpers.get_value(
"homepage_promo_video_youtube_id",
"your-youtube-id"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a default value that is being set in the code here? Does it makes sense for this to be None by default? I'm not sure if it's important for this to be a valid string and my assumption is that if this is not some sort of null object, the consumer of the API might try to use it thinking it's valid and then have an unexpected failure because it wouldn't know that this is a string that is not a valid id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, changed to None

@@ -31,6 +31,13 @@ class MFEConfigView(APIView):
def get(self, request):
"""
Return the MFE configuration, optionally including MFE-specific overrides.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Return the MFE configuration, optionally including MFE-specific overrides.
Return the MFE configuration, optionally including MFE-specific overrides.
This configuration currently also pulls specific settings from site configuration or
django settings. This is a temporary change as a part of the migration of some legacy
pages to MFEs. This is a temporary compatibility layer which will eventually be deprecated.
See [Link to DEPR ticket] for more details.
The compatability means that settings from the legacy locations will continue to work but
the settings listed below in the `_get_legacy_config` function should be added to the MFE
config by operators.

Copy link
Contributor Author

@Serj-N Serj-N Aug 13, 2025

Choose a reason for hiding this comment

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

Docstring added with a todo (add link)

Copy link
Contributor

Choose a reason for hiding this comment

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

@Serj-N would you be willing to create the new DEPR ticket for this and link to it here and in #36785?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Serj-N I landed this PR with the todo, and created an issue to track splitting up the DEPR and adding the link. #37210

return JsonResponse(merged_config, status=status.HTTP_200_OK)

@staticmethod
def _get_base_config() -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def _get_base_config() -> dict:
def _get_legacy_config() -> dict:

You'll need to update the calls as well but these are specifically a compatibility layer that is meant to be temporary, the naming should indicate that as should the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@brian-smith-tcril
Copy link
Contributor

I think we should create the relevant DEPR for the dropping of the legacy settings from the MFE config and maybe fully from the settings as well if they're not used anywhere else. That DEPR should be created and linked in the comments here so that it's easy to go find out why we're doing this in the future and come cleanup after ourselves.

I know #36785 has been updated to include information about changes from this PR.

@Serj-N Serj-N marked this pull request as ready for review August 13, 2025 09:59
@Serj-N
Copy link
Contributor Author

Serj-N commented Aug 13, 2025

We've updated the spreadsheet and I think we're quite close to this. @Serj-N if you could work on fixing the tests I think we can take this out of draft when they pass and get @feanil 's review

@sarina Now that I added new commits with the requested changes, the pipeline reran and all the tests pass. I went ahead and changed the PR status from draft to open, too.

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

This is looking great! I've gone through to check that the implementations match the decisions in the spreadsheet.

Here's an overview of what has been implemented at time of review:

Status Legacy Implementation
settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"])
📤 homepage_overlay_html in Site Configuration or modifying index_overlay.html
📤 show_partners - in Site Configuration
📤 show_homepage_promo_video - in Site Configuration
homepage_promo_video_youtube_id - in Site Configuration
homepage_course_max - in Site Configuration or Django settings
📤 sidebar_html_enabled - WaffleSwitch "course_experience.enable_about_sidebar_html"
📤 course_about_show_social_links - in Site Configuration
course_about_twitter_account - in Site Configuration or Django settings
is_cosmetic_price_enabled - settings.FEATURES['ENABLE_COSMETIC_DISPLAY_PRICE']
courses_are_browsable - settings.FEATURES['COURSES_ARE_BROWSABLE']
enable_course_discovery - settings.FEATURES['ENABLE_COURSE_DISCOVERY']

Status Key:

Emoji Meaning
Implementation in this PR matches decision in spreadsheet
📤 Implementation intentionally not in this PR, matches decision in spreadsheet
Implementation in this PR does not match decision in spreadsheet

"course_about_twitter_account",
settings.PLATFORM_TWITTER_ACCOUNT
),
"IS_COSMETIC_PRICE_ENABLED": settings.FEATURES.get("ENABLE_COSMETIC_DISPLAY_PRICE"),
Copy link
Contributor

Choose a reason for hiding this comment

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

In the spreadsheet the decision is documented as:

We should handle this in the same way as show_homepage_promo_video. If there isn't a price don't show it, and wrap the price in a plugin slot so people can remove it using FPF

so this should be removed.

Suggested change
"IS_COSMETIC_PRICE_ENABLED": settings.FEATURES.get("ENABLE_COSMETIC_DISPLAY_PRICE"),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Thanks for a detailed breakdown!

@Serj-N Serj-N force-pushed the nanai/axm-2658/extend-mfe-api branch from 3445554 to d0ea0ee Compare August 14, 2025 07:19
Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

Thank you so much for your patience throughout the review process on this one!

I'm very happy with how this turned out!


Here's an updated overview of what has been implemented at time of approval:

Status Legacy Implementation
settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"])
📤 homepage_overlay_html in Site Configuration or modifying index_overlay.html
📤 show_partners - in Site Configuration
📤 show_homepage_promo_video - in Site Configuration
homepage_promo_video_youtube_id - in Site Configuration
homepage_course_max - in Site Configuration or Django settings
📤 sidebar_html_enabled - WaffleSwitch "course_experience.enable_about_sidebar_html"
📤 course_about_show_social_links - in Site Configuration
course_about_twitter_account - in Site Configuration or Django settings
📤 is_cosmetic_price_enabled - settings.FEATURES['ENABLE_COSMETIC_DISPLAY_PRICE']
courses_are_browsable - settings.FEATURES['COURSES_ARE_BROWSABLE']
enable_course_discovery - settings.FEATURES['ENABLE_COURSE_DISCOVERY']

Status Key:

Emoji Meaning
Implementation in this PR matches decision in spreadsheet
📤 Implementation intentionally not in this PR, matches decision in spreadsheet

I also believe all of @feanil's comments have been addressed, so this should be good to merge!

@brian-smith-tcril
Copy link
Contributor

@cmltaWt0 have all of your change requests been addressed on this one?

@cmltaWt0
Copy link
Contributor

@cmltaWt0 have all of your change requests been addressed on this one?

Looking at it.

@brian-smith-tcril brian-smith-tcril changed the title feat: [FC-0086] Extend MFE Config API feat: Extend MFE Config API for frontend-app-catalog [FC-0086] Aug 15, 2025
@brian-smith-tcril brian-smith-tcril merged commit 55a3757 into openedx:master Aug 15, 2025
49 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Aug 15, 2025
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

rpenido pushed a commit to open-craft/openedx-platform that referenced this pull request Aug 16, 2025
…nedx#37130)

* feat: return response merged from base config, mfe config and mfe overrides

* test: adjust existing tests

* test: add new test methods

* fix: add blank line

* fix: remove homepage_overlay_html

* fix: typo in a comment

* test: change dict merge order to follow the correct hierarchy

* fix: change response keys to uppercase

* fix: add enable_course_discovery

* fix: change COURSES_ARE_BROWSABLE to NON_BROWSABLE_COURSES

* fix: remove show_homepage_promo_video

* fix: use None as default for promo video youtube id

* docs: expand docstrings, rename method/variables

* fix: remove is_cosmetic_price_enabled field
salman2013 pushed a commit to salman2013/edx-platform that referenced this pull request Sep 10, 2025
…nedx#37130)

* feat: return response merged from base config, mfe config and mfe overrides

* test: adjust existing tests

* test: add new test methods

* fix: add blank line

* fix: remove homepage_overlay_html

* fix: typo in a comment

* test: change dict merge order to follow the correct hierarchy

* fix: change response keys to uppercase

* fix: add enable_course_discovery

* fix: change COURSES_ARE_BROWSABLE to NON_BROWSABLE_COURSES

* fix: remove show_homepage_promo_video

* fix: use None as default for promo video youtube id

* docs: expand docstrings, rename method/variables

* fix: remove is_cosmetic_price_enabled field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

9 participants