Skip to content

Conversation

@bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Apr 30, 2025

Description

Fixes openedx/frontend-app-authoring#1871

To fix it, this PR:

  1. Separates events that affect the published version of things (new _PUBLISHED events) from events that affect the draft versions (CREATED, UPDATED, DELETED, etc.)
  2. Eliminates most "re-index the whole library" events, and uses the PublishLog/DraftChangeLog to emit much more targeted events for only the components/containers/collections that were actually affected, whether directly or indirectly.
  3. For bulk actions like "publish all changes", creates the list of events and emits them in a celery task. The main thread (the REST API handler) waits up to 15 seconds for this async task to complete and then returns a 200 response, or otherwise lets it keep running in the background while still returning a 200 response to avoid a timeout error. This way we get the best of both worlds: long/slow updates to the search index still eventually get completed asynchronously if necessary, but in most cases the updates are done synchronously before the REST API response is returned.

Dependencies

Requires openedx/openedx-events#494 for the new _PUBLISHED events.

Testing instructions

  1. Create a unit. Publish it.
  2. Add/create a component in the unit. Edit the component so it shows "unpublished changes"
  3. Click on "Library Info" and "Publish all changes"
  4. (Refresh the page) - note that fixing it to auto-refresh will be in a separate Authoring MFE PR. If you don't have that PR checked out, manually refresh.
  5. Verify that no units/components in the library search results still show as having unpublished changes. (Before this PR you would still see unpublished changes).

Read through all the consolidated event tests in test_events.py and make sure they make sense.

Try other combinations of changes and make sure that the right search index updates are getting made.

Deadline

ASAP. Also will need to be backported to Teak as well.

Private ref: FAL-4156

@openedx-webhooks
Copy link

openedx-webhooks commented Apr 30, 2025

Thanks for the pull request, @bradenmacdonald!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

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.

Details
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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 30, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Apr 30, 2025
@bradenmacdonald bradenmacdonald marked this pull request as draft April 30, 2025 22:02
@bradenmacdonald bradenmacdonald added the FC Relates to an Axim Funded Contribution project label May 1, 2025
@mphilbrick211 mphilbrick211 removed the FC Relates to an Axim Funded Contribution project label May 1, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions May 1, 2025
@bradenmacdonald bradenmacdonald force-pushed the braden/fix-publish-all branch 2 times, most recently from 215f23b to 4701a25 Compare May 2, 2025 02:42
@bradenmacdonald bradenmacdonald force-pushed the braden/fix-publish-all branch from 2a05d58 to 6fb0614 Compare May 7, 2025 23:32
@bradenmacdonald bradenmacdonald marked this pull request as ready for review May 7, 2025 23:32
Copy link
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@bradenmacdonald Looks good to me.

👍

  • I tested this: (Created, updated, deleted and published components and containers)
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@bradenmacdonald bradenmacdonald force-pushed the braden/fix-publish-all branch from 93397ed to 463a23c Compare May 8, 2025 17:11
@bradenmacdonald bradenmacdonald changed the title fix: Bugs with "Publish All Changes" in Library fix: Bugs with "Publish All Changes" in Library [FC-0083] May 8, 2025
@bradenmacdonald bradenmacdonald added the FC Relates to an Axim Funded Contribution project label May 8, 2025
@bradenmacdonald bradenmacdonald merged commit 2e91a05 into openedx:master May 8, 2025
49 checks passed
@bradenmacdonald bradenmacdonald deleted the braden/fix-publish-all branch May 8, 2025 18:57
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions May 8, 2025
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

pomegranited pushed a commit to open-craft/edx-platform that referenced this pull request May 9, 2025
)

* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events

(cherry picked from commit 2e91a05)
pomegranited pushed a commit to open-craft/edx-platform that referenced this pull request May 9, 2025
)

* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events

(cherry picked from commit 2e91a05)
ChrisChV pushed a commit that referenced this pull request May 9, 2025
…36687)

* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events

(cherry picked from commit 2e91a05)

Co-authored-by: Braden MacDonald <braden@opencraft.com>
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events
marlonkeating pushed a commit that referenced this pull request Jul 15, 2025
* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events
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

Archived in project

Development

Successfully merging this pull request may close these issues.

Bugs with "Publish All Changes" in Library: cards not refreshing, units still show changes

7 participants