Skip to content

refactor: migrate 6 more flags off FEATURES-as-dict (batch 11)#38910

Open
feanil wants to merge 7 commits into
masterfrom
feanil/features-dict-batch-11
Open

refactor: migrate 6 more flags off FEATURES-as-dict (batch 11)#38910
feanil wants to merge 7 commits into
masterfrom
feanil/features-dict-batch-11

Conversation

@feanil

@feanil feanil commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates 6 more feature flags off settings.FEATURES['X'] dict-style access onto flat settings (settings.X) with @override_settings(X=Y) in tests. Follows the pattern established in #38772.

This batch targets the subscript readers (settings.FEATURES['X']) plus one medium flag — several of these were invisible to the earlier .get()-only reference query.

Each refactor: commit migrates a single flag:

  • SQUELCH_PII_IN_LOGS
  • ENABLE_MAX_FAILED_LOGIN_ATTEMPTS
  • ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER
  • ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA
  • ENABLE_COURSEWARE_SEARCH
  • ENABLE_ENTERPRISE_INTEGRATION

Plus one docs: commit removing a stale FEATURES['ORGANIZATIONS_APP'] reference from a docstring (that flag is a removed pre-Lilac flag with no reader or setting).

Notes on a few flags:

  • SQUELCH_PII_IN_LOGS and ENABLE_MAX_FAILED_LOGIN_ATTEMPTS are already flat settings in both lms/envs/common.py and cms/envs/common.py (different per-process defaults); the readers just needed to stop going through the dict.
  • ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER and ENABLE_ENTERPRISE_INTEGRATION are LMS-only settings read from shared code, so those readers use getattr(settings, 'X', default).
  • ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA: the reader moves to getattr(settings, ...), but the user-facing To enable, set FEATURES["..."] message is intentionally left unchanged — the extracted xblocks_contrib.HtmlBlock (exercised by the same tests) still emits it, and flat @override_settings reaches that external reader through the FeaturesProxy bridge.
  • ENABLE_ENTERPRISE_INTEGRATION removes the shared FEATURES_WITH_ENTERPRISE_ENABLED test helper in favor of @override_settings(ENABLE_ENTERPRISE_INTEGRATION=True) at each call site.

feanil added 7 commits July 20, 2026 11:46
Already a flat setting in both lms/envs/common.py (True) and
cms/envs/common.py (False); switch the two subscript readers in shared
student user models to settings.X (resolves per-process) and convert the
four test overrides.
ORGANIZATIONS_APP is a removed pre-Lilac flag with no reader or settings
definition; the only reference was a historical docstring literally
containing FEATURES['ORGANIZATIONS_APP'], which kept surfacing in the
migration picker. Reword to plain prose so the eventual FEATURES-dict
deletion is clean. No behavior change.
Already a flat setting in both lms/envs/common.py (True) and
cms/envs/common.py (False); switch the subscript reader in shared student
user models to settings.X and convert the six test overrides (patch.dict
and whole-dict override_settings(FEATURES=...) forms) to flat overrides.
…RES-as-dict

Defined only in lms/envs/common.py (False) but read from shared
openedx/core/djangoapps user_authn code, so use getattr(settings, ..., False)
matching the prior default.
…s-dict

Switch the built-in HtmlBlock reader from settings.FEATURES.get(...) to
getattr(settings, self.ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA, False) (the
flag is LMS-only, read from shared xmodule code), and convert the test
overrides to flat @override_settings.

The user-facing 'To enable, set FEATURES[...]' message is intentionally
left unchanged: the extracted xblocks_contrib.HtmlBlock (exercised by the
same tests via USE_EXTRACTED_HTML_BLOCK) still emits it, and the shared
assertion must match both. Flat override_settings still reaches the
extracted block's FEATURES.get reader through the FeaturesProxy bridge.
Switch the enterprise_enabled() reader to getattr(settings, ..., False)
(LMS-only flag read from openedx/features code reachable from CMS), and
convert all test overrides to flat @override_settings. This removes the
shared FEATURES_WITH_ENTERPRISE_ENABLED test helper (a settings.FEATURES
copy with the flag set) in favor of @override_settings(ENABLE_ENTERPRISE_INTEGRATION=True)
at each call site, and pulls the flag out of a DISABLE_START_DATES
patch.dict (that skip-list flag stays on the dict for now).
@feanil
feanil requested a review from kdmccormick July 20, 2026 16:35
@feanil
feanil marked this pull request as ready for review July 20, 2026 17:10
@feanil
feanil requested review from a team, farhan, irtazaakram and salman2013 as code owners July 20, 2026 17:10
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