refactor: remove dead FEATURES-derived assignments (xmodule + production) - #39016
Draft
feanil wants to merge 2 commits into
Draft
refactor: remove dead FEATURES-derived assignments (xmodule + production)#39016feanil wants to merge 2 commits into
feanil wants to merge 2 commits into
Conversation
xmodule/capa_block.py and xmodule/partitions/partitions_service.py each grabbed the
FEATURES dict at import time into a module-level variable that nothing reads:
FEATURES = getattr(settings, "FEATURES", {})
In capa_block this was orphaned when the flags it once gated were deprecated (the extracted
xblocks_contrib copy already omits it); in partitions_service it has been unused for a long
time. Neither module-level name is imported anywhere in the openedx GitHub org (confirmed by
org-wide code search) and AST analysis shows no reader.
Remove both assignments and the imports they leave unused: ImproperlyConfigured in
capa_block (settings is still used elsewhere and stays) and django.conf.settings in
partitions_service.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lms/envs/production.py and cms/envs/production.py defined
ENV_FEATURES = _YAML_TOKENS.get("FEATURES", {}) alongside the legacy ENV_TOKENS / AUTH_TOKENS
compat exports, but nothing reads ENV_FEATURES -- not in this repo, and not anywhere in the
openedx GitHub org (org-wide code search: 0 importers, in contrast to ENV_TOKENS, which many
plugins/IDAs still import). Remove it. ENV_TOKENS and AUTH_TOKENS (the actually-used exports)
are unchanged, so ENV_TOKENS["FEATURES"] still works for any external consumer.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes module-level assignments derived from the
FEATURESdict that nothing reads.xmodule/capa_block.py— thetry/except ImproperlyConfiguredFEATURES = getattr(settings, "FEATURES", {})grab, orphaned when the flags it once gated were deprecated (the extractedxblocks_contribcopy already omits it). Also drops the now-unusedImproperlyConfiguredimport (settingsstays).xmodule/partitions/partitions_service.py— a long-unused module-levelFEATURESgrab; drops it and the now-unusedsettingsimport.lms/envs/production.py&cms/envs/production.py—ENV_FEATURES = _YAML_TOKENS.get("FEATURES", {}), a legacy compat export alongsideENV_TOKENS/AUTH_TOKENSthat nothing reads.ENV_TOKENS/AUTH_TOKENS(the actually-used exports) are unchanged, soENV_TOKENS["FEATURES"]still works.Safety
capa_block.FEATURES,partitions_service.FEATURES, orENV_FEATURESis imported anywhere in theopenedxGitHub org (org-wide code search: 0 hits each). For contrast,ENV_TOKENSreturns many hits across the org — so the search works, and these three are genuinely unused.xmodule/partitions/tests/test_partitions.py+xmodule/tests/test_capa_block.pypass (218); modules import cleanly;ruffclean.