Skip to content

refactor: migrate COURSEWARE_SEARCH_INCLUSION_DATE off FEATURES-as-dict - #39004

Open
feanil wants to merge 1 commit into
masterfrom
feanil/features-dict-courseware-search-inclusion-date
Open

refactor: migrate COURSEWARE_SEARCH_INCLUSION_DATE off FEATURES-as-dict#39004
feanil wants to merge 1 commit into
masterfrom
feanil/features-dict-courseware-search-inclusion-date

Conversation

@feanil

@feanil feanil commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This gets its on PR because it's a date string (YYYY-MM-DD), not a boolean, and its two readers had conflicting absence-defaults.

What it controls

A cutoff date: courseware search is exposed for courses whose start date is after it — the mechanism for rolling search out to newer courses without enabling it for the whole back catalog.

  • LMS courseware_mfe_search_enabled (GET .../courseware-search/enabled/, consumed by the Learning MFE) — read FEATURES.get('COURSEWARE_SEARCH_INCLUSION_DATE'), default None = date-based rollout off (search only where the courseware.mfe_courseware_search waffle flag turns it on). Learner-facing.
  • Studio reindex_course --from_inclusion_date (operator-run) — read FEATURES.get(..., '2020-01-01') and strptime()s it, so it needs a non-None floor.

Approach (chosen after review)

One annotated flat setting COURSEWARE_SEARCH_INCLUSION_DATE = None in openedx/envs/common.py (the configured value is genuinely shared by both processes). LMS reads it bare; the reindex command keeps its 2020-01-01 floor for the unconfigured case via an explicit fallback that now also logs a warning so operators see the default is being assumed. Updated the command's --from_inclusion_date help text and docstring, and converted both tests' FEATURES overrides to @override_settings(...) (plus a new test for the warn-and-default path).

No behavior change: LMS absence still disables the date gate; the reindex command still floors an unset value at 2020-01-01.

This flag is a YYYY-MM-DD cutoff date, not a boolean: courseware search is
exposed for courses whose start date is after it. Its two readers had
conflicting inline defaults, which is why it was deferred:

- LMS `courseware_mfe_search_enabled` view read
  `settings.FEATURES.get('COURSEWARE_SEARCH_INCLUSION_DATE')` (default None
  → date-based rollout off; search only where the courseware.mfe_courseware_search
  waffle flag enables it).
- The Studio `reindex_course --from_inclusion_date` command read
  `settings.FEATURES.get('COURSEWARE_SEARCH_INCLUSION_DATE', '2020-01-01')` and
  immediately strptime()s it, so it needs a non-None string floor.

Introduce a single annotated flat setting `COURSEWARE_SEARCH_INCLUSION_DATE = None`
in openedx/envs/common.py (the configured value is genuinely shared by both
processes). The LMS reads it bare; the reindex command keeps its 2020-01-01
floor for the unconfigured case, now via an explicit fallback that also logs a
warning so operators can see the default is being assumed. Documented the
`--from_inclusion_date` behavior in the command help/docstring, and converted
both tests' FEATURES overrides to `@override_settings(...)` (plus a new test for
the warn-and-default path).

No behavior change: LMS absence still disables the date gate; the reindex
command still floors an unset value at 2020-01-01.

Co-Authored-By: Claude Opus 4.8 <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.

2 participants