Skip to content

feat: course search "newest first" sort behind flag + Optimizely experiment#1511

Draft
macdiesel wants to merge 2 commits into
openedx:masterfrom
macdiesel:bbeggs/search-newest-sort-experiment
Draft

feat: course search "newest first" sort behind flag + Optimizely experiment#1511
macdiesel wants to merge 2 commits into
openedx:masterfrom
macdiesel:bbeggs/search-newest-sort-experiment

Conversation

@macdiesel

Copy link
Copy Markdown
Contributor

What

Points the course search <Index> (SearchCourse.jsx) at the recency-sorted Algolia replica when both gates pass:

  1. the search_default_sort_newest enterprise waffle flag is enabled (kill-switch, via useEnterpriseFeatures), and
  2. the Optimizely Web "newest" experiment variant is active for the user (isExperimentVariant(EXPERIMENT_3_ID, EXPERIMENT_3_VARIANT_2_ID)).

Falls back to the relevance (primary) index otherwise, and is a safe no-op until ALGOLIA_RECENTLY_PUBLISHED_REPLICA_INDEX_NAME is configured. Adds the replica + EXPERIMENT_3 config vars and their types.

Testing

New SearchCourse.test.jsx (4 cases: flag off, flagged-but-not-variant, flag+variant → replica, no-replica fallback) — 4 passed, eslint clean. Existing search-tree suites (Search, SearchSections, SearchPage, which render SearchCourse) still pass → no regression. (The pre-existing tsc error at index.tsx:15 and a flaky parallel-run failure in the untouched SearchUnavailableAlert were confirmed independent of this change.)

Rollout / ops

Set env ALGOLIA_RECENTLY_PUBLISHED_REPLICA_INDEX_NAME, EXPERIMENT_3_ID, EXPERIMENT_3_VARIANT_2_ID, and create the Optimizely Web experiment (control vs "newest" variant) in the dashboard.

Related (rollout order)

  1. enterprise-catalog recency replica → feat: "newest courses first" Algolia sort — config-gated replica registry + fail-safe edx/enterprise-catalog#118
  2. edx-enterprise waffle flag → feat: add search_default_sort_newest waffle flag (ENT-11384) edx-enterprise#2638
  3. this PR (index swap + experiment)

ENT-11384.

🤖 Generated with Claude Code

…experiment

Points the course search <Index> at the recency-sorted Algolia replica when the search_default_sort_newest enterprise waffle flag is enabled AND the Optimizely "newest" experiment variant is active for the user; falls back to the relevance index otherwise. Adds the ALGOLIA_RECENTLY_PUBLISHED_REPLICA_INDEX_NAME and EXPERIMENT_3 config vars + types.

ENT-11384

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the enterprise-catalog rename (ENT-11386 alignment): the "newest courses first"
sort now keys off the earliest course-run start of any status (the release date), not
published runs only. Rename the config/env var and the index-name variable to match the
backend:
  ALGOLIA_RECENTLY_PUBLISHED_REPLICA_INDEX_NAME -> ALGOLIA_RECENTLY_RELEASED_REPLICA_INDEX_NAME
  recentlyPublishedIndexName                    -> recentlyReleasedIndexName

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

1 participant