Skip to content

feat: add FrontendSiteConfigView for frontend-base site configuration#38061

Open
arbrandes wants to merge 1 commit intoopenedx:masterfrom
arbrandes:frontend-site-config
Open

feat: add FrontendSiteConfigView for frontend-base site configuration#38061
arbrandes wants to merge 1 commit intoopenedx:masterfrom
arbrandes:frontend-site-config

Conversation

@arbrandes
Copy link
Contributor

@arbrandes arbrandes commented Feb 27, 2026

Description

  • Adds a new FrontendSiteConfigView endpoint at /api/mfe_config/v1/frontend_site that translates the existing flat MFE_CONFIG / MFE_CONFIG_OVERRIDES Django settings into the camelCase structure expected by frontend-base's SiteConfig.
  • Refactors the existing MFEConfigView to use shared helper functions (get_legacy_config, get_mfe_config, get_mfe_config_overrides), reducing duplication.
  • Keys matching RequiredSiteConfig / OptionalSiteConfig are promoted to the top level under their camelCase names; remaining keys go into commonAppConfig (pending feat: support commonAppConfig site config option frontend-base#179); each MFE_CONFIG_OVERRIDES entry becomes an element of the apps array.
Work log (Claude Code sessions)

Session 1: Initial implementation

Started from a scaffold FrontendSiteConfigView with a docstring describing the desired behavior. Built the implementation iteratively:

  1. Core translation logic — Implemented SITE_CONFIG_TRANSLATION_MAP mapping all known RequiredSiteConfig and OptionalSiteConfig fields from frontend-base's types.ts. Keys in MFE_CONFIG matching the map are promoted to camelCase top-level fields; all others become app configuration.
  2. Removed "custom" section — Initial implementation put unmapped keys in a custom dict; this was removed in favor of including them directly in app config.
  3. Per-app config from overrides — Each MFE_CONFIG_OVERRIDES entry becomes an element of the apps array with its overrides merged on top of the shared base config.
  4. Helper extraction — Refactored get_legacy_config(), get_mfe_config(), and get_mfe_config_overrides() into shared module-level functions, eliminating duplication between MFEConfigView and the new view. Removed the intermediate get_merged_mfe_config() function in favor of inline composition.
  5. Legacy config optimization — Moved get_legacy_config() directly into app_base_config since none of its keys map to frontend-base types, avoiding a split-then-recombine step.
  6. Site-level key stripping — Added filtering to remove SITE_CONFIG_TRANSLATION_MAP keys from per-app override configs so they don't leak into app configuration.
  7. mfe_name_to_app_id helper — Converts kebab-case MFE names to reverse-domain appIds (e.g. learner-dashboardorg.openedx.frontend.app.learnerDashboard).
  8. Tests — Wrote tests for each of the above behaviors, updating them as the implementation evolved.

Session 2: Code review and commonAppConfig refactor

A code review identified that per-app configs were duplicating all shared keys (legacy + unmapped MFE_CONFIG) into every app entry. This was both wasteful and divergent from frontend-base's design where shared config should be separate.

  • Discussed whether the lost-keys problem (site-level keys from overrides being silently dropped) could be solved without a pre-defined app list — concluded it cannot, since the endpoint doesn't know which apps exist beyond what's in overrides.
  • Introduced commonAppConfig as a top-level field containing legacy config + unmapped MFE_CONFIG keys, shared across all apps. Per-app entries in apps now carry only their own overrides, since frontend-base merges commonAppConfig into each app's config client-side.

Session 3: Final review

A final review confirmed the implementation is correct and identified remaining items for consideration:

  • Per-app site-level keys in overrides (e.g. per-app BASE_URL) are silently discarded — by design, since frontend-base treats these as site-wide, but worth documenting for operators.
  • siteId (a RequiredSiteConfig field in frontend-base) has no legacy Django equivalent and is not emitted.
  • The URL path uses a leading slash (/frontend_site) as a workaround for the parent URL lacking a trailing slash.

🤖 Generated with Claude Code

Add a new endpoint at /api/mfe_config/v1/frontend_site that translates
legacy MFE_CONFIG / MFE_CONFIG_OVERRIDES settings into the camelCase
structure expected by frontend-base's SiteConfig interface.

Site-level keys (RequiredSiteConfig/OptionalSiteConfig) are promoted to
the top level. Shared app-level config (legacy + unmapped MFE_CONFIG
keys) is returned in a commonAppConfig key. Per-app overrides from
MFE_CONFIG_OVERRIDES are returned in the apps array with only their
override keys, as frontend-base handles merging with commonAppConfig.

Also refactors shared config helpers (get_legacy_config, get_mfe_config,
get_mfe_config_overrides) out of MFEConfigView for reuse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant