Skip to content

Preserve course subjects across discovery syncs and document the precedence rule#63

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-course-categories-subcategories
Draft

Preserve course subjects across discovery syncs and document the precedence rule#63
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-course-categories-subcategories

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 31, 2026

Course subjects were being populated through two discovery sync paths with different overwrite behavior, which led to inconsistent categories/subcategories across otherwise similar courses. This change aligns subject handling across incremental and full metadata updates, and captures the rule in an ADR.

  • Keep subjects fresh during incremental syncs

    • Add subjects to COURSE_FIELDS_TO_PLUCK_FROM_SEARCH_ALL.
    • Existing course records now pick up subject changes from /api/v1/search/all/ without replacing the rest of the stored full-course payload.
  • Prevent empty full-course payloads from erasing known-good subjects

    • Update _update_single_full_course_record() so an empty or missing subjects value from /api/v1/courses/ does not overwrite an existing non-empty value.
    • Non-empty subjects from the full payload still replace the stored value.
  • Document the decision

    • Add docs/decisions/0010-preserving-course-subjects-across-syncs.rst.
    • The ADR describes:
      • the inconsistent behavior
      • the split between /search/all/ and /courses/
      • the field-level precedence rule for subjects
      • the tradeoff of preserving known-good values over clearing them on empty full payloads
existing_subjects = metadata_record._json_metadata.get('subjects')
metadata_record._json_metadata.update(course_metadata_dict)

if existing_subjects and not metadata_record._json_metadata.get('subjects'):
    metadata_record._json_metadata['subjects'] = existing_subjects

…rve subjects in full metadata update

Agent-Logs-Url: https://github.com/edx/enterprise-catalog/sessions/046b734f-760b-4c27-9d31-24eb6f288e98

Co-authored-by: macdiesel <67862+macdiesel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing categories and subcategories in course queries Fix missing subjects (categories/subcategories) in catalog API course metadata Mar 31, 2026
Copilot AI requested a review from macdiesel March 31, 2026 17:25
Copilot AI changed the title Fix missing subjects (categories/subcategories) in catalog API course metadata Keep course subjects populated across catalog syncs Mar 31, 2026
Copilot AI changed the title Keep course subjects populated across catalog syncs Preserve course subjects across discovery sync paths Mar 31, 2026
Copilot AI changed the title Preserve course subjects across discovery sync paths Preserve course subjects across discovery syncs and document the precedence rule Mar 31, 2026
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