Skip to content

Conversation

@Akanshu-2u
Copy link
Contributor

@Akanshu-2u Akanshu-2u commented Sep 26, 2025

Description:

Refactored FEATURES settings to top-level in core files and updated related tests for consistency and maintainability.

Solution:

  • Modified the SettingDictToggle class to SettingToggle.
  • Moved FEATURES setting to top level in core file.
  • Fixed the related settings in test files leaving other unrelated FEATURE references intact.

Note: The unrelated FEATURE references are working fine due to the use of featureproxy , hence for the time being left those unchanged.

Private JIRA Link:

BOMS-200

Reference PR:

#37067

Note:

  • On investigating how the top-level-settings are working in edx platform , found these few settings are still getting derived from the FEATURES dict.
  • Planned to move these settings to top level.

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.

Thanks for the PR @Akanshu-2u, it looks like the right changes but maybe not enough fixes in the tests which may be trying to override the features dict still. Once the tests get fixed up, I think this would be fine to land. Let me know when you've got the tests passing. Until then, I'm gonna mark this as a draft PR.

@feanil feanil marked this pull request as draft October 9, 2025 14:12
@Akanshu-2u Akanshu-2u force-pushed the BOMS-200-handle-features-setting-dict-depr branch from 1f8e60f to e3f8473 Compare October 10, 2025 15:51
@Akanshu-2u Akanshu-2u marked this pull request as ready for review October 21, 2025 09:44
}

utils.update_course_details(mock_request, self.course.id, payload, None)
utils.update_course_details(mock_request, self.course.id, payload, self.course)

Choose a reason for hiding this comment

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

why are we changing the args ? This is un-related to features.

Was it because of tests failing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the CI test was failing with this error AttributeError: 'NoneType' object has no attribute 'entrance_exam_enabled' . So changed the arg to fix this.

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 this is happening because the setting value for ENTRANCE_EXAMS is now being set to true instead of false which is not the correct expected behavior. So I think the fix needs to be to patch the toggle rather than the item in the features dictionary not to change the test code here.

Copy link

@jcapphelix jcapphelix left a comment

Choose a reason for hiding this comment

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

While core file changes are all good.

I have some questions on test cases, mainly :-

  • Why are some feature flags not removed ?
  • Is it something that is supposed to be removed later ?

@Akanshu-2u
Copy link
Contributor Author

Akanshu-2u commented Oct 27, 2025

While core file changes are all good.

I have some questions on test cases, mainly :-

  • Why are some feature flags not removed ?
  • Is it something that is supposed to be removed later ?
  • The settings which where removed from features dict in the core files. Only those are modified in the test files leaving the other feature settings in place as due to featureproxy those will not create any issue.
  • Secondly, some args and cache changes are mainly due to the failure of the CI checks so have included those to prevent anything from breaking.
  • The remaining feature instances in the test files can be removed, waiting on confirmation.

Copy link

@jcapphelix jcapphelix left a comment

Choose a reason for hiding this comment

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

My Queries are all answered.

Good to go from my side.

@Akanshu-2u Akanshu-2u requested a review from feanil October 27, 2025 09:42
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Thanks @Akanshu-2u , these changes all look good.

But, I am confused why you chose to update these references in particular. There are many remaining references to FEATURES that we will need to clean up in a future PR.

Were these particular references causing bugs?

@Akanshu-2u
Copy link
Contributor Author

Thanks @Akanshu-2u , these changes all look good.

But, I am confused why you chose to update these references in particular. There are many remaining references to FEATURES that we will need to clean up in a future PR.

Were these particular references causing bugs?

I focused on fixing only the test files that referenced the FEATURES dictionary settings, which had been removed from the core files within this PR.
The settings were causing bugs resulting in test failures so was essential to update those test cases with override-settings.

@kdmccormick
Copy link
Member

which had been removed from the core files within this PR.

Why did you choose to refactor those settings within this PR?

@Akanshu-2u
Copy link
Contributor Author

which had been removed from the core files within this PR.

Why did you choose to refactor those settings within this PR?

I guess this may help you with the explanation: #37396 (comment)

@kdmccormick
Copy link
Member

Okay, so you have chosen some remaining references, but not all of them, correct? That is fine, but the description of this PR says that it "moved remaining features dicts settings" and "Removed FEATURES dictionary". These are not true, and it is misleading to have them in the PR description when there are still so many FEATURES references remaining in the platform. Could you please edit your PR and commit message?

@Akanshu-2u Akanshu-2u changed the title refactor: moved remaining feature dicts settings into top-level setting Refactored: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. Oct 28, 2025
@Akanshu-2u Akanshu-2u changed the title Refactored: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. refactored: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. Oct 28, 2025
@Akanshu-2u Akanshu-2u changed the title refactored: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. refactor: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. Oct 28, 2025
@Akanshu-2u Akanshu-2u changed the title refactor: migrated remaining FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. refactor: migrated FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. Oct 28, 2025
@Akanshu-2u Akanshu-2u changed the title refactor: migrated FEATURES dictionary settings to top-level settings in core files and updated corresponding test files. refactor: migrated FEATURES dict to top-level settings in core files and fixed related test files. Oct 28, 2025
@Akanshu-2u Akanshu-2u changed the title refactor: migrated FEATURES dict to top-level settings in core files and fixed related test files. refactor: migrated FEATURES dict settings to top-level in core files and fixed related test files. Oct 28, 2025
@Akanshu-2u
Copy link
Contributor Author

Okay, so you have chosen some remaining references, but not all of them, correct? That is fine, but the description of this PR says that it "moved remaining features dicts settings" and "Removed FEATURES dictionary". These are not true, and it is misleading to have them in the PR description when there are still so many FEATURES references remaining in the platform. Could you please edit your PR and commit message?

Addressed. Modified the PR title and description which shall be more convenient for the changes achieved in this PR.

@feanil feanil force-pushed the BOMS-200-handle-features-setting-dict-depr branch from 6cfcc78 to a3cad1f Compare January 9, 2026 17:27
@feanil
Copy link
Contributor

feanil commented Jan 14, 2026

I rebased and resolved conflicts but it looks like some change maybe broke some rate limiting. @Akanshu-2u can you look into that when you have some time?

@robrap
Copy link
Contributor

robrap commented Jan 14, 2026

I apologize @feanil, but @Akanshu-2u is on to other things. He created this PR to begin with out of a misunderstanding of what was required of him for handling the DEPR on the 2U-side. Hopefully this PR helps get the work started by someone, but I need him working on some other things right now.

Note: I thought the PR was ready to merge. I didn't realize it would involve additional work.

@feanil
Copy link
Contributor

feanil commented Jan 14, 2026

In that case, closing this for now as I don't think we have anyone to work on it and it will probably get stale and full of conflicts pretty regularly given the number of things it touches.

@feanil feanil closed this Jan 14, 2026
@Akanshu-2u Akanshu-2u reopened this Jan 16, 2026
@Akanshu-2u
Copy link
Contributor Author

In that case, closing this for now as I don't think we have anyone to work on it and it will probably get stale and full of conflicts pretty regularly given the number of things it touches.

Hii @feanil , I’ve rebased the latest master onto my branch and the CI is now passing successfully. Please feel free to review, approve, and merge the PR. Thanks!

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.

Mostly looks good, just had a couple of questions.

}

utils.update_course_details(mock_request, self.course.id, payload, None)
utils.update_course_details(mock_request, self.course.id, payload, self.course)
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 this is happening because the setting value for ENTRANCE_EXAMS is now being set to true instead of false which is not the correct expected behavior. So I think the fix needs to be to patch the toggle rather than the item in the features dictionary not to change the test code here.

)
@override_waffle_flag(toggles.LEGACY_STUDIO_SCHEDULE_DETAILS, True)
def test_visibility_of_entrance_exam_section(self, feature_flags):
@patch.object(milestones_helpers.ENABLE_MILESTONES_APP, 'is_enabled', return_value=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why patch the toggle rather than just using override_setting which is more standard and what you're using in some of the later files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented the suggestion.


@mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_CONTENT_LIBRARIES': False})
def test_with_libraries_disabled(self):
@patch.object(toggles.ENABLE_CONTENT_LIBRARIES, 'is_enabled', return_value=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 think it's much clearer if you just override the django settings rather than the toggle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, following the suggestion I added override setting instead of patch toggle.


def setUp(self):
self.mfe_config_api_url = reverse("mfe_config_api:config")
cache.clear()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was needed because CI checks were repeatedly failing due to cached data being retained for the test file. Clearing the cache ensures the tests run cleanly and pass as expected.

@Akanshu-2u Akanshu-2u requested a review from feanil January 19, 2026 09:57
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.

Looks like one more file needs to be updated and then this is good to land I think.


@patch.dict(settings.FEATURES, {'ENABLE_EXPORT_GIT': True})
def test_fetch_giturl_present(self):
@patch.object(toggles.EXPORT_GIT, 'is_enabled', return_value=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this isn't using override_settings as well?

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 this to override settings and ensured other files do not require changes for override settings.

@Akanshu-2u Akanshu-2u requested a review from feanil January 20, 2026 16:20
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.

Changes look great, thanks @Akanshu-2u

@feanil feanil merged commit 2d82d90 into openedx:master Jan 20, 2026
65 checks passed
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.

5 participants