Skip to content

refactor: read the course optimizer from authoring v1 (FC-0118) - #3367

Draft
taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/fc0118-optimizer
Draft

taimoor-ahmed-1 wants to merge 1 commit into
openedx:masterfrom
taimoor-ahmed-1:taimoor-ahmed/fc0118-optimizer

Conversation

@taimoor-ahmed-1

Copy link
Copy Markdown
Contributor

Description

Part of #3361 (FC-0118 Phase 3, parent openedx/openedx-platform#39349).

Draft until openedx/openedx-platform#39304 merges: it adds the endpoint this PR calls. The old address stays live until it is removed through the DEPR process (openedx/openedx-platform#39128).

Moves the course optimizer's four calls to authoring v1:

Request Old New
Start a link check POST /api/contentstore/v0/link_check/{course_id} POST /api/authoring/v1/courses/{course_key}/link_check/
Read the link check GET …/v0/link_check_status/{course_id} GET …/v1/courses/{course_key}/link_check/?view=full
Start a link update POST …/v0/rerun_link_update/{course_id} POST …/v1/courses/{course_key}/previous_run_link_update/
Read the link update GET …/v0/rerun_link_update_status/{course_id} GET …/v1/courses/{course_key}/previous_run_link_update/?view=full
  • The reads send view=full because the page renders the report and the per-link update results, which the default view leaves out. While a run is in progress, output is null.
  • v1's status, created_at and output are mapped to the linkCheckStatus, linkCheckCreatedAt and linkCheckOutput the hooks use, so the hooks and components are unchanged.
  • Starts now answer 202, which axios treats as success like the old 200.

User roles impacted: Course Author (Tools → Course Optimizer). No visible change expected.

Supporting information

Testing instructions

  1. Studio → Tools → Course Optimizer: start a scan, watch it progress, and check that the report renders.
  2. On a rerun course with links to the previous run, start the link update and check the results.
  3. npm test -- src/optimizer-page

Other information

  • With the link-update feature off, the server now answers 404 instead of 400; the page only calls it when its own flag is on.
  • Tested against mocks shaped from the platform PR's serializers; the platform PR is not merged yet.
  • No migrations, no accessibility impact.

Best Practices Checklist

  • Any new files are using TypeScript (.ts, .tsx).
  • Avoid propTypes and defaultProps in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use. (None added.)
  • Avoid using ../ in import paths. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

The Course Optimizer page now starts and reads link checks and
previous-run link updates through the authoring v1 resources served by
openedx/openedx-platform#39304, instead of the four legacy contentstore
v0 routes:

- POST/GET api/contentstore/v0/link_check{,_status}/{course_id}
  -> POST/GET api/authoring/v1/courses/{course_key}/link_check/
- POST/GET api/contentstore/v0/rerun_link_update{,_status}/{course_id}
  -> POST/GET api/authoring/v1/courses/{course_key}/previous_run_link_update/

Both reads send view=full, since the page renders the link check's
report and matches each link update's per-link results; the default
view carries only the run's state.

The API layer maps the link check's status, created_at and output back
to linkCheckStatus, linkCheckCreatedAt and linkCheckOutput, and the
queued-run answer of a started check to linkCheckStatus, so hooks and
components are unchanged. The report's members arrive in snake_case and
are camel-cased as before. Starting a run now answers 202, and the
link check's fixed error message is not read, as the page derives its
failure state from the status. No change is visible to the user.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 17, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @taimoor-ahmed-1!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.38%. Comparing base (f2dab4e) to head (be13f48).
⚠️ Report is 15 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3367      +/-   ##
==========================================
+ Coverage   96.36%   96.38%   +0.01%     
==========================================
  Files        1467     1472       +5     
  Lines       36182    36467     +285     
  Branches     8692     8814     +122     
==========================================
+ Hits        34867    35148     +281     
+ Misses       1272     1262      -10     
- Partials       43       57      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Nov 24, 2026
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

3 participants