-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Data Liberation] "Fetch from a different URL" button for failed media downloads, Interactivity API support #2040
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 tasks
adamziel
changed the title
[Data Liberation] UI to manage attachments download errors
[Data Liberation] Interactive import UI to manage media frontloading errors
Dec 3, 2024
adamziel
changed the title
[Data Liberation] Interactive import UI to manage media frontloading errors
[Data Liberation] "Fetch from a different URL" button for failed media downloads
Dec 4, 2024
adamziel
changed the title
[Data Liberation] "Fetch from a different URL" button for failed media downloads
[Data Liberation] "Fetch from a different URL" button for failed media downloads, Interactivity API support
Dec 4, 2024
The CI failure is an unrelated, flaky test. This mostly works so I'll go ahead and merge. Any issues will be addressed in follow-up PRs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Ships:
User-driven error handling
When a remote asset cannot be downloaded, most importers either stop or ignore the error. This PR adds a user interaction to make an explicit decision about what should happen next – do we ignore the missing asset? Do we use another file instead?
CleanShot.2024-12-04.at.00.36.52.mp4
Auto-Refreshing Import Status
This PR also re-expresses the entire data liberation wp-admin page using the interactivity API, and auto-refreshes the progress:
CleanShot.2024-12-04.at.00.25.54.mp4
A part of #1894
Technical overview
User-driven error handling
During the frontloading stage, the
WP_Stream_Importer
exposes all the frontloaded entities to the API consumer. The consumer then creates a post of typefrontloading_placeholder
with an initial statusawaiting_download
for each asset, and updates it with progress information and status (success, failure, skipped) as the import progresses.The frontloading stage is not finished until all the frontloaded assets have been processed with a non-error outcome. There's a few ways to recover from errors:
WP_Stream_Importer
now retries the failed assets URL (viaWP_Retry_Frontloading_Iterator
) before moving on to entities provided by the usual entity source such as a WXR file.Sometimes we don't want to require user interactions, e.g. when running the
importWxr
Blueprint step. In those scenarios, we could choose a default error outcome, e.g. "skip failed downloads".Auto-refreshing admin page
Two
fetch()
requests running in an infinite loop are:Other changes
php_userstreamop_read
to the Asyncify list – it crashed the importer in@wp-playground/cli
running in bun.Follow-up work
Testing instructions