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

Rotate unlock string for GB unstable APIs in Calypso apps v18.7.0 #92384

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

sejas
Copy link
Member

@sejas sejas commented Jul 4, 2024

Note

This PR should be released just after v18.7.0 is available in simple sites.

Proposed Changes

  • Update the string to unlock GB APIs to match what's required on v18.7.0
  • Previous String: I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.

  • New String: I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.

  • My Plan is to remove the condition and the old string once I've deployed the new GB version. https://github.com/Automattic/dotcom-forge/issues/8118

Why are these changes being made?

Testing Instructions

  • Run yarn dev --sync
  • Sandbox widgets.wp.com
  • Access a the post editor from wp-admin in a simple site, for example: https://20240701gutenbergrotation.wordpress.com/wp-admin/post.php?post=2&action=edit
  • Observe in the console that there are no errors related to unlock APIs Error: Unable to get the unlock api. Reason: Error: You tried to opt-in to unstable APIs without confirming you know the consequences.
  • Access a simple site with the gutenberg-edge sticker.
  • Observe there are no errors related to unlock APIs.

Test in atomic sites:

  • Follow "ETK and Atomic Sites" and observe the editor works as expected.

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)?

@matticbot
Copy link
Contributor

matticbot commented Jul 4, 2024

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

Sections (~77 bytes added 📈 [gzipped])

name      parsed_size           gzip_size
patterns       +372 B  (+0.0%)      +77 B  (+0.0%)

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 (~144 bytes added 📈 [gzipped])

name                                                                         parsed_size           gzip_size
async-load-automattic-global-styles-src-components-global-styles-variations       +186 B  (+0.0%)      +72 B  (+0.0%)
async-load-automattic-design-preview                                              +186 B  (+0.0%)      +72 B  (+0.0%)

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.

@sejas
Copy link
Member Author

sejas commented Jul 4, 2024

@okmttdhr, just a heads-up that as part of my GB release I'm updating these unlock strings that were introduced in:

Let me know if you have any suggestion for a more solid fix.

@matticbot
Copy link
Contributor

matticbot commented Jul 4, 2024

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

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

  • editing-toolkit
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/wpcom-block-editor-rotate-gb-unstable-apis on your sandbox.

@@ -17,7 +17,10 @@ export const getUnlock = () => {
let unlock: ( object: any ) => any | undefined;
try {
unlock = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
( window as any ).wpcomGutenberg?.pluginVersion?.startsWith( 'v18.7' )
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for addressing this, @sejas!

I believe we should support => v18.7 as well (e.g., v18.8, v19.x, etc).

Copy link
Member Author

@sejas sejas Jul 5, 2024

Choose a reason for hiding this comment

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

Yes!, my plan is to remove the condition and the old string once I've deployed the new GB version!
I've created this issue to track it!
https://github.com/Automattic/dotcom-forge/issues/8118

Copy link
Member

Choose a reason for hiding this comment

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

This script also runs on Atomic, so I thought we should continue supporting the old string 🥲
(Sorry if I misunderstand something)

Copy link
Member Author

@sejas sejas Jul 5, 2024

Choose a reason for hiding this comment

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

After investigating, I've found that window.wpcomGutenberg.pluginVersion is not accessible in Atomic sites.

Screenshot 2024-07-05 at 12 09 50

I also think users cannot install other Gutenberg versions since it's a managed plugin. In the same way, users cannot use a different WP version. I've confirmed that users can install different GB plugin versions.

What's true is that users can deactivate the Gutenberg plugin, and then the unlock would need the previous string version.

One last thought is that we don't support the previous string version I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.

@okmttdhr okmttdhr requested a review from a team July 5, 2024 08:43
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 5, 2024
@sejas sejas changed the title Rotate text for GB unstable APIs in wpcom-block-editor v18.7.0 Rotate text for GB unstable APIs in Calypso Apps v18.7.0 Jul 5, 2024
@sejas sejas changed the title Rotate text for GB unstable APIs in Calypso Apps v18.7.0 Rotate text for GB unstable APIs in Calypso apps v18.7.0 Jul 5, 2024
@sejas
Copy link
Member Author

sejas commented Jul 5, 2024

I've asked for help in Slack p1720180332965009-slack-C7YPUHBB2 about how to handle Atomic sites.

@sejas
Copy link
Member Author

sejas commented Jul 5, 2024

Confirmed, we just need to support the "latest" unlock string even for atomic sites:
p1720181014685329/1720180332.965009-slack-C7YPUHBB2

@sejas sejas changed the title Rotate text for GB unstable APIs in Calypso apps v18.7.0 Rotate unlock string for GB unstable APIs in Calypso apps v18.7.0 Jul 5, 2024
@sejas sejas merged commit 32d489a into trunk Jul 8, 2024
18 of 19 checks passed
@sejas sejas deleted the update/wpcom-block-editor-rotate-gb-unstable-apis branch July 8, 2024 11:26
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 8, 2024
@sejas sejas self-assigned this Jul 8, 2024
gabrielcaires pushed a commit that referenced this pull request Jul 22, 2024
…2384)

* Rotate Gutenberg unlock string for unstable APIs
* Handle temporarily both string versions to be able to pass tests and deploy before releasing GB
gabrielcaires pushed a commit that referenced this pull request Jul 22, 2024
…2384)

* Rotate Gutenberg unlock string for unstable APIs
* Handle temporarily both string versions to be able to pass tests and deploy before releasing GB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants