Skip to content

refactor: migrate 10 more flags off FEATURES-as-dict (batch 9)#38906

Open
feanil wants to merge 10 commits into
masterfrom
feanil/features-dict-batch-9
Open

refactor: migrate 10 more flags off FEATURES-as-dict (batch 9)#38906
feanil wants to merge 10 commits into
masterfrom
feanil/features-dict-batch-9

Conversation

@feanil

@feanil feanil commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates 10 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.

Each commit migrates a single flag:

  • EDITABLE_SHORT_DESCRIPTION
  • ENABLE_COSMETIC_DISPLAY_PRICE
  • ENABLE_EXTENDED_COURSE_DETAILS
  • ENABLE_FINANCIAL_ASSISTANCE_FORM
  • ENABLE_FOOTER_MOBILE_APP_LINKS
  • ENABLE_HIDE_FROM_TOC_UI
  • ENABLE_NEW_BULK_EMAIL_EXPERIENCE
  • ENABLE_PUBLISHER
  • ENABLE_SOFTWARE_SECURE_FAKE
  • FALLBACK_TO_ENGLISH_TRANSCRIPTS

Two flags (ENABLE_EXTENDED_COURSE_DETAILS, ENABLE_FINANCIAL_ASSISTANCE_FORM) had no flat definition in any envs/common.py, so those commits add an annotated DjangoSetting definition matching the prior inline default before switching the readers.

@feanil
feanil force-pushed the feanil/features-dict-batch-9 branch from c8362b5 to 68603f9 Compare July 20, 2026 14:41
feanil added 10 commits July 20, 2026 11:23
The flag was only ever read via settings.FEATURES.get with an inline
default and was never defined in any envs file. Add an annotated flat
DjangoSetting definition (default False, matching the old inline default)
to cms/envs/common.py so the CMS-only reader can use settings.X directly.
The flag had no envs definition and was only read via settings.FEATURES.get
(with lms/envs/test.py already setting the flat value, routed through the
FeaturesProxy bridge). Add an annotated flat DjangoSetting definition
(default False) to lms/envs/common.py and migrate the two LMS-only readers.
In course_tools.py this also drops the now-unnecessary 'FEATURES is None'
(Edge) guard, since the flat setting always resolves to its default.
The two test classes are plain unittest.TestCase, so @override_settings
can't decorate them; patch.object the flat setting directly instead,
mirroring the prior patch.object(settings, 'FEATURES', ...) approach.
@feanil
feanil force-pushed the feanil/features-dict-batch-9 branch from 68603f9 to 42168a7 Compare July 20, 2026 15:23
@feanil
feanil requested a review from kdmccormick July 20, 2026 15:27


@ddt.ddt
@patch.object(settings, 'FEATURES', create=True, new={

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We're not using override_settings here because these test classes don't use the django SimpleTestCase as the base test class which is needed for override_settings to work correctly as a class decorator.

I'm not sure if the fact that these are just unittest.TestCases is delibrate or not but that's out of scope of this migration which is just dropping the extra hop through the FEATURES dict.

@feanil
feanil marked this pull request as ready for review July 20, 2026 15:36
@feanil
feanil requested review from a team, farhan, irtazaakram and salman2013 as code owners July 20, 2026 15:36
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