wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Backup: add BackupRealtimeMessage component for displaying backup real-time info

Open Initsogar opened this issue 1 year ago • 7 comments

Resolves https://github.com/Automattic/jetpack-backup-team/issues/615

Proposed Changes

  • Add BackupRealtimeMessage component for displaying backup real-time info using the new fields introduced in https://github.com/Automattic/wp-calypso/pull/93885.
  • Add BackupRealtimeMessage unit tests
  • Render BackupRealtimeMessage on latest backup section in the backup page

CleanShot 2024-08-26 at 20 17 26@2x

Why are these changes being made?

For making clear daily vs real-time backups to end users. Project thread: peaFOp-2Iy-p2

Testing Instructions

[!NOTE] It could be tricky to test all scenarios on the UI because you might need to have a site with multiple backups and real-time events, so you can rely on unit tests for this PR. You can run unit tests locally by running:

yarn run test-client client/components/jetpack/daily-backup-status/test/backup-realtime-message.jsx

  • Spin up a Jetpack Cloud live branch
  • Pick a site with Jetpack VaultPress Backup with some backups and real-time events
  • Navigate to the Backup page
  • Search for a date where your last backup is a real-time event. If you can't find any, you could try doing some actions on your site like publishing/updating a post or uploading images.
  • If your last backup is a real-time event, you should see a message like this: CleanShot 2024-08-27 at 15 47 34@2x
  • If it is not a real-time event, you should not see the message: CleanShot 2024-08-27 at 15 49 33@2x

Pre-merge Checklist

  • [ ] Has the general commit checklist been followed? (PCYsg-hS-p2)
  • [ ] Have you written new tests for your changes?
  • [ ] Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • [ ] Have you checked for TypeScript, React or other console errors?
  • [ ] Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • [ ] Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • [ ] For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

Initsogar avatar Aug 27 '24 01:08 Initsogar

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~440 bytes added 📈 [gzipped])

name                           parsed_size           gzip_size
jetpack-cloud-agency-sites-v2      +1991 B  (+0.1%)     +440 B  (+0.1%)
backup                             +1991 B  (+0.2%)     +440 B  (+0.1%)
a8c-for-agencies-sites             +1991 B  (+0.1%)     +440 B  (+0.1%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

matticbot avatar Aug 27 '24 01:08 matticbot

As an example, I selected August 16, where there is a full backup for that day, and the last backup is a real-time backup Screenshot 2024-08-27 at 20 24 38

In this screenshot, the base backup for that real-time is for the same day (2024-08-16 11:44 AM), but it says 11-day old full backup because it is compared with today (August 27)

mavegaf avatar Aug 28 '24 00:08 mavegaf

In this screenshot, the base backup for that real-time is for the same day (2024-08-16 11:44 AM), but it says 11-day old full backup because it is compared with today (August 27)

@mavegaf Thanks for clarifying! It means that the we are using the full backup from today/yesterday will never apply, or will not be very consistent.

I will suggest rephrasing them like:

  • Scenario 1 - The base backup is from the same date as the selected backup
    • Before: We are using the full backup from today(...)
    • After: We are using a full backup from this day(...)
  • Scenario 2 - The base backup is from the day before as the selected backup
    • Before: We are using the full backup from yesterday(...)
    • After: We are using a full backup from the previous day(...)
  • Scenario 3 - The base backup is from 2 or more days before as the selected backup
    • (it remains the same): We are using a #-day old full backup(...)

Note that I'm also replacing the with a.

Any thoughts?

Initsogar avatar Aug 28 '24 01:08 Initsogar

In this screenshot, the base backup for that real-time is for the same day (2024-08-16 11:44 AM), but it says 11-day old full backup because it is compared with today (August 27)

@mavegaf Thanks for clarifying! It means that the we are using the full backup from today/yesterday will never apply, or will not be very consistent.

I will suggest rephrasing them like:

  • Scenario 1 - The base backup is from the same date as the selected backup

    • Before: We are using the full backup from today(...)
    • After: We are using a full backup from this day(...)
  • Scenario 2 - The base backup is from the day before as the selected backup

    • Before: We are using the full backup from yesterday(...)
    • After: We are using a full backup from the previous day(...)
  • Scenario 3 - The base backup is from 2 or more days before as the selected backup

    • (it remains the same): We are using a #-day old full backup(...)

Note that I'm also replacing the with a.

Any thoughts?

Yes, today/yesterday was a message only when the backup selected was the last one. I like the proposal, it's clear and simpler to implement 👍

mavegaf avatar Aug 28 '24 02:08 mavegaf

@mavegaf Great, thanks for your feedback! I just made the changes based on that. This is ready for a re-review :)

Also added the instructions to run the unit tests on the PR description:

yarn run test-client client/components/jetpack/daily-backup-status/test/backup-realtime-message.jsx

Initsogar avatar Aug 28 '24 03:08 Initsogar

@Initsogar With this PR I found that other cases need to be handled in the endpoint, so I've left it in Blocked/Hold until the changes in the API are ready

mavegaf avatar Aug 28 '24 23:08 mavegaf

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/backup-realtime-changes on your sandbox.

matticbot avatar Sep 05 '24 01:09 matticbot

Since we are still polishing the API to fetch the right base_rewind_id and rewind_step_count, I just added a feature flag (jetpack/backup-realtime-message) for rendering the realtime message, so we could safely merge this PR and continue working on https://github.com/Automattic/wp-calypso/pull/94218 which has this one as dependency.

@mavegaf could you take another look?

Initsogar avatar Sep 05 '24 15:09 Initsogar

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/16647738

Thank you @Initsogar for including a screenshot in the description! This is really helpful for our translators.

a8ci18n avatar Sep 05 '24 18:09 a8ci18n

Translation for this Pull Request has now been finished.

a8ci18n avatar Sep 13 '24 10:09 a8ci18n