Repository navigation
Backup: Open any backup from the Activity Log's backup links - #53929
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 8 files. Only the first 5 are listed here.
|
|
@RafaelFunchal I pushed four review fixes to #53755 (067a167), which left this branch behind the PR below it and blocked the stack. I merged #53755 in here (19d8e3a) the way you did in 83e59b8: a merge commit and a normal push, no rebase or force-push. It merged cleanly, since the two PRs share no files, and the combined tree passes the Generated by Claude. |
Accept optional `after` and `before` ISO 8601 date-times on the rewindable-activity route and pass them to WordPress.com, so the Overview can fetch one backup that isn't on any page it has loaded. Anything else is refused with a 400 before a request goes out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5F1MsbPHYHzXLzuK4rCES
The Overview resolved `?selected=` only against the activity pages it had loaded, so a link to an older backup landed on "That item isn't on this page". When the loaded pages answer without a backup id, ask the log for the few seconds around its rewind id, and only report it missing when that comes back empty too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5F1MsbPHYHzXLzuK4rCES
Bring back the jetpack_activity_log_backup_url_template filter, its initial-state field, and the link a backup range renders when it is set. The Backup dashboard's Overview can now open any backup, not just one on a page it has loaded. Only well-formed rewind ids are linked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5F1MsbPHYHzXLzuK4rCES
Answer jetpack_activity_log_backup_url_template with the Overview URL and the backup selected, when the modernized dashboard is on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5F1MsbPHYHzXLzuK4rCES
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D5F1MsbPHYHzXLzuK4rCES
19d8e3a to
2882e45
Compare
Review at
|
WordPress.com only honours the lookup's few-second window on sites with the full activity log. Elsewhere it returns the whole log, and an id that isn't there would be paged through one request at a time. Treat three pages as "not found".
|
@dhasilva Thanks for the review and for merging #53755 in here. On your items:
Checked: |
Re-review at
|
Backups with warnings use the notice gridicon, so the Overview classified them as other and their links failed. Classify by the rewind__backup complete names as well, keeping entries that cannot be restored as other.
|
@dhasilva Both items are addressed in 07e4c21. 3. Backups with warnings: the Overview now treats an entry as a backup when its gridicon is
4. Description: it now says the lookup reads up to three pages. Testing steps 1 and 3 use the "N Warnings" link (or the date on "Known threats acknowledged"), and the Activity Log bullet says which links exist. |
dhasilva
left a comment
There was a problem hiding this comment.
Re-review at 07e4c21
@RafaelFunchal thanks, the blocker is fixed. Treating a backup-named entry as a backup unless it's is_rewindable: false matches WordPress.com. The server gives every non-rewindable backup the "Backup failed - Retention or storage limit reached." summary and the notice gridicon, so a cloud row is always rewindable, and the name check adds only backups with warnings. With the normalizer change reverted, both new tests fail. The description now matches the links that exist.
Two small things, neither blocking:
- [suggestion] Changelog wording. The
plugins/backup,plugins/jetpackandpackages/activity-logentries still say "Link backup dates". On backup entries the link is the "N Warnings" text, so "backup links" would be accurate. The warnings fix also shows up in both plugins, since those backups can now be opened and restored from the dashboard, but onlypackages/backuphas an entry for it. It could fold into the two plugin entries you already have. - [suggestion] Test comments. "WPCOM sends
noticeinstead ofcloud…" appears in two test files, and "Storage-limit failures share the backup names…" in a third. The docblock innormalize/activity-log.tsalready covers both, and the test names say the rest, so those test comments can go.
Tests at 07e4c21: packages/backup 1104 passed, packages/activity-log 8 passed. CI is green.
Verdict: approving. The changelog wording is worth fixing before merge.
Generated by Claude.
|
@dhasilva Both suggestions are in: |
Proposed changes
Review of #53755 took the Activity Log's backup links out because the Backup dashboard's Overview could only open a backup on a page it had already loaded: a link to an older backup landed on "That item isn't on this page of the activity log…". This makes the Overview open any backup, then brings the links back.
/jetpack/v4/site/rewindable-activity): accepts optionalafterandbefore(ISO 8601 date-times) and forwards them to WordPress.com. Anythingrest_parse_date()can't read is refused with a 400 before any request is made.?selected=names a backup that no loaded or cached page holds, it asks for the few seconds of the log around that backup's rewind id (a backup's "Backup complete" row is stamped with it) and opens the row it finds.noticegridicon) are treated as backups, so they open and restore like any other. Entries named as backups that can't be restored, such as storage-limit failures, stay as other activity.jetpack_activity_log_backup_url_template, when the modernized Backup dashboard is on. Only well-formed rewind ids are linked; anything else stays plain text.Related product discussion/links
Part of TSCODE-757.
Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm testandcomposer test-phpinprojects/packages/backupandprojects/packages/activity-log.?selected=set to a made-up rewind id (e.g.1000000000). It says the backup couldn't be found and offers Clear selection.