Skip to content
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

Storage add-ons v2: Expose the extended storage add-ons behind the feature flag. #97794

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

southp
Copy link
Contributor

@southp southp commented Dec 26, 2024

Related to #97221

Proposed Changes

This PR exposes the extended storage add-ons to the client side behind the feature flag, upgrades/storage-add-on-v2. The flag will be enabled by default in the development environment.

/add-ons with the feature flag on:

CleanShot 2024-12-26 at 14 33 34@2x

/plans with the feature flag on:

CleanShot 2024-12-26 at 16 14 58@2x

Caution:

  • It's known issue that a Business site can't purchase the add-ons over 200G. It will be fixed from the backend.
  • Another known issue is that the total spaces shown in the storage dropdown are wrong for a site owning a storage add-on. This will also be fixed as a follow-up.

Why are these changes being made?

For establishing the foundation of exposing the extended storage add-ons, i.e. 150G, 200G, 250G, 300G and 350G. It is feature-gated for now so we will be able to continuously deploy improvements without disturbing the production experience.

Testing Instructions

  • Without the feature flag in any environment except for the development, the extended storage add-ons are not available in /add-ons or the storage dropdown in /plans.
  • Enabling the feature flag by appending ?flags=upgrades/storage-add-on-v2 , the extended storage add-ons should be available in /add-ons and the storage dropdown in /plans.

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 UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • 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)?

@southp southp added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 26, 2024
@southp southp requested a review from a team December 26, 2024 06:39
@southp southp self-assigned this Dec 26, 2024
@southp southp requested a review from aneeshd16 December 26, 2024 06:39
@matticbot
Copy link
Contributor

matticbot commented Dec 26, 2024

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

Sections (~1784 bytes added 📈 [gzipped])

name                     parsed_size           gzip_size
update-design-flow           +1008 B  (+0.1%)     +195 B  (+0.0%)
plugins                      +1008 B  (+0.0%)     +196 B  (+0.0%)
plans                        +1008 B  (+0.1%)     +199 B  (+0.0%)
link-in-bio-tld-flow         +1008 B  (+0.0%)     +195 B  (+0.0%)
jetpack-app                  +1008 B  (+0.2%)     +199 B  (+0.2%)
site-overview                 +898 B  (+0.1%)     +208 B  (+0.0%)
hosting                       +898 B  (+0.1%)     +208 B  (+0.0%)
add-ons                       +898 B  (+0.3%)     +153 B  (+0.1%)
theme                         +896 B  (+0.1%)     +166 B  (+0.1%)
stats                         +896 B  (+0.1%)     +184 B  (+0.1%)
site-purchases                +896 B  (+0.1%)     +165 B  (+0.0%)
purchases                     +896 B  (+0.0%)     +165 B  (+0.0%)
posts-custom                  +896 B  (+0.1%)     +163 B  (+0.1%)
posts                         +896 B  (+0.1%)     +163 B  (+0.1%)
migrate                       +896 B  (+0.2%)     +166 B  (+0.1%)
import-hosted-site-flow       +896 B  (+0.1%)     +183 B  (+0.1%)
domains                       +896 B  (+0.0%)     +205 B  (+0.0%)
checkout                      +896 B  (+0.0%)     +165 B  (+0.0%)
tailored-ecommerce-flow       +170 B  (+0.2%)      +54 B  (+0.7%)
signup                        +170 B  (+0.1%)      +46 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.

Async-loaded Components (~312 bytes added 📈 [gzipped])

name                                             parsed_size           gzip_size
async-load-design-blocks                              +896 B  (+0.0%)     +163 B  (+0.0%)
async-load-signup-steps-plans-theme-preselected       +838 B  (+0.2%)     +149 B  (+0.1%)
async-load-signup-steps-plans                         +838 B  (+0.2%)     +149 B  (+0.1%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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
Copy link
Contributor

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

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

  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/expose-the-extended-storage-addons on your sandbox.

Copy link
Contributor

@aneeshd16 aneeshd16 left a comment

Choose a reason for hiding this comment

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

Tested that the additional storage add-ons are displayed correctly when the flag is enabled. However, I was not able to add the 350GB addon to the cart. All other storage options worked.

Kapture.2024-12-30.at.16.00.32.mp4

featureSlugs: null,
icon: spaceUpgradeIcon,
quantity: 150,
name: i18n.translate( '150 GB Storage' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I know that 100 GB Storage and 50 GB Storage are already translated, but I am wondering if changing the string to i18n.translate( '%d GB Storage', [ 150 ] ) could result in fewer strings to be translated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point. I've added it here: 6e34a48. For 100G and 50G, I can update them later when everything is translated :)

@@ -1,17 +1,35 @@
export const STORAGE_LIMIT = 203;
export const STORAGE_LIMIT = 403;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please explain this change? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the client side filter used here: https://github.com/Automattic/wp-calypso/blob/trunk/packages/data-stores/src/add-ons/hooks/use-available-storage-add-ons.ts#L19. From what I recall, that 3 was from when the Free plan had 3GB of storage. More details can be found here: fbhepr%2Skers%2Sjcpbz%2Sjc%2Qpbagrag%2Snqzva%2Qcyhtvaf%2Sjcpbz%2Qovyyvat%2Sqrsnhyg%2Qfubccvat%2Qpneg%2Qinyvqngbe.cuc%3Se%3Qn9n7n897%232327-og

While I'm thinking it's worth confirming whether it is needed from the client side, I choose to keep it for now.

Does that make sense to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! Going by my naive logic, when the max addon size was 100GB, the storage limit was 203. So if we increase the max addon size to 350GB, should it be 453 instead?

@southp
Copy link
Contributor Author

southp commented Dec 31, 2024

@aneeshd16 Thanks for the review 🙇🏼

Re:

Tested that the additional storage add-ons are displayed correctly when the flag is enabled. However, I was not able to add the 350GB addon to the cart. All other storage options worked.

I've confirmed that it is part of the same known issue as I described in the PR description:

It's known issue that a Business site can't purchase the add-ons over 200G. It will be fixed from the backend.

I will open a follow-up backend PR for fixing it later.

Comment on lines +19 to +21
const isWithinStorageLimit = STORAGE_LIMIT >= currentMaxStorage - existingAddOnStorage + quantity;

return existingAddOnStorage < quantity && quantity <= availableStorageUpgrade;
return existingAddOnStorage < quantity && isWithinStorageLimit;
Copy link
Contributor

Choose a reason for hiding this comment

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

I missed this in my first pass - is there a way to test this change?

Rewriting the existing code, it should be:

const isWithinStorageLimit = STORAGE_LIMIT >= currentMaxStorage + quantity;

I do not understand why we subtract existingAddOnStorage here. 🤔

@@ -1,17 +1,35 @@
export const STORAGE_LIMIT = 203;
export const STORAGE_LIMIT = 403;
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! Going by my naive logic, when the max addon size was 100GB, the storage limit was 203. So if we increase the max addon size to 350GB, should it be 453 instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Storage Addon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants