Repository navigation
My Jetpack: add a setup wizard shell behind a feature flag - #52765
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. Boost 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. Search 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. Social 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. Starter Plugin 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. Protect 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. Videopress 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. Stats Data 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 3 files.
8 files are newly checked for coverage. Only the first 5 are listed here.
|
A full-screen onboarding wizard for My Jetpack, off by default behind `my-jetpack-onboarding-wizard`. With the flag off the existing single-screen takeover renders exactly as before. The shell is built from the components the WordPress Site Editor itself uses rather than a lookalike: NavigableRegion from @wordpress/admin-ui, ItemGroup and Item from @wordpress/components, and a ThemeProvider seeded dark so the rail's colours come from the same --wpds-* tokens resolving differently in that subtree. No dark colour is hardcoded anywhere. Three columns: the step rail, the question column, and a brand panel carrying a CSS mesh gradient, the Jetpack bolt artwork, and display copy outlined from Söhne Breit. The font file is not part of this repository, so the display lines are pre-outlined by tools/generate-panel-type.py and only the paths ship. They are brand copy and read the same in every locale by design, which replaces an earlier version that split each line into half-sentence translatable strings no translator could have worked with. Step 1 is the start screen, ported from the prototype. Steps 2 to 4 are scaffolding and their copy says so plainly: nothing is connected, activated or saved yet. That work follows in a second PR, which is blocked on two open connection PRs and on the final feature list. Accessibility is 100 in Lighthouse with no failing nodes. Contrast was measured rather than assumed throughout, including the mint display copy against the worst frame of the animated mesh rather than its first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
On WordPress.com the platform owns the connection and nobody chose to install Jetpack, so a screen inviting them to start with it and connect an account does not apply. Host::is_wpcom_platform() covers Simple and WordPress.com on Atomic, and it requires wpcomsh, so other Atomic-hosted products still count as self-hosted here. Atomic is the case that prompted this. wpcomsh filters jetpack_is_connection_ready to require a connection owner, so a WoA site whose owner was removed reports disconnected and gets redirected into onboarding while WordPress.com is still managing its connection. With the flag on it would have been shown "Start with Jetpack for free" and asked to connect an account. Only the wizard is gated. is_onboarding_available() still returns true on WoA, so the existing single-screen takeover is unchanged there, and a test asserts that rather than leaving it implied. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
Get started now registers the site and hands the browser to WordPress.com to create or sign in to an account, then returns to the wizard. It is the same connection the rest of My Jetpack uses, with its own from value so the two onboarding flows stay separable in the connection funnel. A connection is required rather than optional because Jetpack loads no modules at all without one, so every feature the later steps offer needs an owner. The second button, I already have an account, is gone: WordPress.com's own screen already offers both, and a second entry point here only split the funnel. The wizard reads its opening step off the user connection rather than a step parameter, so the round trip resumes at the site-type question and cannot be skipped by editing the URL. get_onboarding_redirect_args() gained a wizard_enabled argument for the same reason: without it a connected user is bounced off the onboarding page, which is exactly where the wizard returns them. A failed registration shows a plain sentence with the server's own words under it. Only the error code goes to Tracks. The message interpolates whatever the server said and can carry the site's own URL, and mapping those causes to copy people can act on is its own piece of work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
The bolt has never been visible. Two things were hiding it, and the prototype this was ported from has the same pair, so its own start screen does not show the artwork either. pathLength normalises a path's length so one dash rule can draw all fourteen, but Chrome only applies that normalisation to presentation attributes. The dash length came from the stylesheet, so it stayed in user units: a 1px dash on a 1995-unit path, drawn at a third of a pixel wide. Each path now measures itself and publishes --draw-length, which the dash rules read, and pathLength is gone. vector-effect went with it, since non-scaling-stroke moves the same lengths into screen pixels and reopens the same hole. The second is that Chrome rasterises a dashed hairline at much lower coverage than a plain one, so a finished path left dashed is about a third as bright as the static artwork on the later steps. The dash comes off on animationend, and under reduced motion the stylesheet takes it off, because no animation runs there to raise the event. Measured on the running screen by differencing the panel with the artwork hidden against the same frame with it shown. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
Connecting worked and the return never happened. The site builds the right handoff: the authorize URL it sends to WordPress.com carries a redirect_uri pointing at this site's own connection webhook, with our wizard URL nested inside it as the redirect param, and the webhook handler ends by sending the user there. Read off a real site, the nested value is exactly wp-admin/admin.php?page=my-jetpack&step=onboarding. What breaks it is the plans page. After the authorization WordPress.com offers its plans, and picking one does not carry that nested redirect, so the user lands on My Jetpack and the wizard is over. The connectors card in the connection package already documents the same behaviour and works around it the same way. skip_pricing takes that page out of the flow. Nothing is being sold here: all six features the wizard offers are free, so there was never a choice to make on that screen. The test asserts the flag because it is load-bearing rather than a preference, and a silent removal would look like a styling change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
Step two was a stand-in that said so. It now asks the prototype's question, with the prototype's five answers and its wording: Tell us what you're building, and under it the line that promises none of this is final. Something else opens a text field. That is the one answer in the wizard that is not from a fixed set, so what gets typed is held apart from the rest and stays on this screen. A test asserts it is not reported, because the shape of that is easy to get wrong later when the wizard starts sending anything at all. The answers are slugs rather than the prototype's prose. Its own label and stored value disagree on the business row, and these are the values that go to Tracks. The rows now arrive the way the prototype's do: a 10px rise over 0.3s, staggered 0.05s apart after a 0.12s wait. Those numbers are the prototype's second pass, not its first: it cut them because at five options the commit button sat unusable for over a second. The row index is a custom property rather than a rule per row, so a step with a different number of answers still staggers. The field opens as grid rows rather than height, which cannot animate to auto, with the opacity lagging so the text does not smear as it grows. Focus moves into it on mount rather than through autofocus, which would also fire on a step opened with the answer already chosen. PlaceholderStep is now ChoiceStep, since it is no longer standing in for anything on the step that uses it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
…ry Jetpack screen Two things were wrong. Nothing was recorded, so a disconnected site was sent into setup on every visit to My Jetpack, and Skip setup was a loop: it went to My Jetpack, which sent you straight back. And the takeover only ever fired on My Jetpack, so someone who activated the plugin and opened the Jetpack dashboard first never met it. Leaving now records how. Finishing is site-wide, because the flow connects the site and switches modules on, so a second admin arriving afterwards does not need it again. Skipping is kept on the person: one admin saying not now must not answer for the next admin on a site nobody has set up. Both stop the automatic redirect; only finishing stops it for everybody. Asking for the onboarding URL directly still works either way, so a skip is reversible and a colleague the site-wide flag does not cover can still run it. The redirect moved from the My Jetpack page load onto admin_init, and now fires on the Jetpack plugin's own screens as well. It stays off the standalone products: Boost, Protect, Social and the rest each ship a connection screen of their own, and taking those over is their teams' call. The filter is how they would opt in. The exit navigates whether or not the record lands. A failed write costs the user being offered setup once more; holding them on a screen they asked to leave would cost a great deal more. Navigation goes through a one-line module for the same reason the connection package has one: jsdom makes both location and its href non-configurable, so nothing else can see where the wizard tried to go. Verified on a running site: Skip now leaves and stays left, the Jetpack dashboard redirects into setup where it did not before, and the onboarding URL still opens when asked for by name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
The question column carried a row of dots and a Step 2 of 4 chip while the rail said the same thing three inches to the left. One of them had to go, and the rail is the one that also names the steps. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011XJPU4NkU2i8B89rcfisWG
An Automattic for Agencies banner was sitting above the wizard, full width, with no way to scroll past it on a screen that has no scroll. It is a Just In Time Message, and the takeover never had a chance of catching it: the only thing hiding notices was CSS on .notice, .error and .updated, and the JITM uses none of those. Nor do plenty of plugin banners, so this was going to keep happening with whatever the site had installed. Two hooks, because one does not reach both. The notice channels are emptied on in_admin_header, which is the last hook before admin-header.php prints them, so a notice registered late is caught too. That is where the mu-wpcom Write screen does the same thing and for the same reason. It covers every plugin that announces itself through WordPress rather than through its own markup, which the CSS could never do. JITMs are opted out of through the package's own filter rather than left to that sweep. Emptying the channels would drop the message, but only after it had enqueued its script and stylesheet; the filter runs before either. The screen id the filter is handed cannot decide this on its own, because the takeover and the My Jetpack dashboard are the same screen and only the query arg separates them. Scoped, and checked on a real site rather than assumed: the takeover enqueues no JITM assets at all, and the dashboard still enqueues both. This fixes the single-screen takeover that ships today as well as the wizard. Both wear the same full-screen class and both had the same hole. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
c2da611 to
ef3daea
Compare
Phan's duplicate-assignment plugin: the null coalescing assignment says the same thing in one operator. It surfaced now because the rebase onto trunk finally got this PR its full static analysis run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ReATUyBCovcuj1bAfZ4VNJ
The tool's docstring made a claim about the typeface that is not ours to make in a public repository. What matters to anyone reading it is the same either way: the font file is not in the repo, so the lines are outlined and only the paths ship. The same sentence in the branch's first commit message is reworded too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ReATUyBCovcuj1bAfZ4VNJ
311806d to
b6a3123
Compare
fgiannar
left a comment
There was a problem hiding this comment.
Many thanks for all your work here!
Quick question, as I noticed the following behaviour when I choose to skip the wizard without connecting (1st step):
I land in My Jetpack, which is empty. No errors or warnings - The Jetpack Connection card highlights Jetpack is not connected with a prompt to "connect my account with one click" but there's nothing to click there.
I believe this is related to how My Jetpack is designed currently, under the logic that the user can land there only after a Connection is established.
|
Thanks Karen. Thanks for your patience on this one, again really appreciate the detailed review. Here's the current status of the PR Done
Done a different way
Not done
Tracks, partly
One more thing. Your stuck button is live on trunk. connection-form.tsx is the screen people get with the flag off. It builds the same loading state and only shows an error for registration. A failed hand-off sets neither. So you get a dead button, no message, and no way to retry, on every plugin that ships My Jetpack. It will need its own PR, and it should go before this one. Mind taking another look? I'm going to give this another smoke test to make sure everything is working well. |
The comment explained that the check is repeated but not the case that makes it necessary: with the wizard on, a connected user is deliberately left on the onboarding screen to finish setup rather than redirected away from it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Thanks @adampickering for the changes and explanations here. The main thing I want to come back to is the My Jetpack complete disconnection state. We're trying to optimize the wording and make sure the link and action correct, but there are more decisions involved here than just tweaking these, primarily around whether seeing My Jetpack in this state should even be allowed just now (up to this point it was a deliberate decision not to), and also whether we want to allow a site only connection here rather than complete connection. Rather than optimizing for this just now, it would probably make sense to get some alignment with Eder and Devin and the rest of the Connection folk on what should be happening. Until then the safest thing seems to be to keep things as they were before in that respect (though I know the wizard will be behind a feature flag for now). Sorry for the sidetracking on this though, I assumed it made sense to try to optimize if there's a chance we're heading that way, but it would be good to get full confirmation. You'll likely have seen the call suggestion in Slack that was just made, about this :)
Assuming the reason for moving the logic is to create a tracks-safe code helper, and assuming the only reason you want this is to record registration errors, then instead of a helper that only My Jetpack uses, ideally
Yes, that is part of the bug I mentioned. I've covered its effects in more detail in CONNECT-499. In short the first part of fixing this should have no side effects, but the second part would need testing with all the different consumers who drive their spinner from
Right, it can't be the whole picture, which is where a tracks event recording the failures comes in. Then you're recording success and failure. A funnel could then capture wizard click, then WPcom authorize success, with failures counted from the site side. I moved on to give the rest of the changes a review as well, though we're only really famiilar with how connection interacts with My Jetpack. Not sure if you'll be wanting some other eyes who are more familiar with the TS/JS code for My Jetpack to have a look as well, but here are a few things I found. Not in any particular pri order, most small, though point 5 might be worth a closer look as it's performance related. TS related:
In
Other: The notice-hiding entry (eg. 'Onboarding: Hide other plugins' notices ....' ) reaches fewer plugins than the code does. The takeover, and so the notice hiding, shows up in every plugin that ships My Jetpack with the flag off, so those plugins should have changelog entries mentioning that as well. Do we need the wizard check at registration time? Every other My Jetpack route registers unconditionally and does any connection check in its
Looking specifically at
I notice there are still tests that test the TOS text and links. That should not need to be there anymore since we're using a defined component which has it's own tests. And the PR description is stale now, for example with the tracks event mentions :) |
Takes trunk's connection status card and drops this branch's changes to it. They were for a fully disconnected My Jetpack, which the connection alignment call ruled out, and trunk has reworked the card since. Trunk's offline-features path in admin_init() now runs before the onboarding redirect.
The connection alignment call settled it: My Jetpack requires the site connection that accepting the terms creates, and the account connection is what becomes skippable. So "Skip setup" shows only once the site is registered, a saved skip suppresses the redirect only on a connected site, and the settle route records nothing before that. Also from the third review: - Register the settle route unconditionally and check the wizard in its permission callback, so the check runs only when the route is hit. - Type onboardingWizard as optional, matching what the accessor returns. - Drop the Terms of Service link test; the shared component covers it. - Add the notice-hiding changelog to every plugin that shows the takeover.
…rding-wizard # Conflicts: # projects/plugins/backup/composer.lock # projects/plugins/boost/composer.lock # projects/plugins/jetpack/composer.lock # projects/plugins/protect/composer.lock # projects/plugins/search/composer.lock # projects/plugins/social/composer.lock # projects/plugins/starter-plugin/composer.lock # projects/plugins/stats/composer.lock # projects/plugins/videopress/composer.lock
Get started registers the site before handing off to WordPress.com. Pressing Back there returns the start screen from history rather than loading it: from the HTTP cache, still carrying the connection it was rendered with, or from bfcache, still marked as connecting. Either way Skip setup stayed hidden on a site that could now skip, and Get started either registered the site a second time or ignored the click. The start screen now clears the hand-off and re-reads the connection when the page comes back from history. Sending no-store instead would have undone #44322, which dropped it from My Jetpack to keep bfcache working.
coder-karen
left a comment
There was a problem hiding this comment.
Looking really nice! Tests well for me, I also tried breaking the flow in different ways but couldn't access My Jetpack unless there was a site connection at least 👍
I see there were quite a few updates including some of the suggestions above too.
I saw a couple of tests failing which are related to the PR though, just needed E2E wording changed back to what it was on trunk, so I pushed a commit to fix that. Then trunk bumped @wordpress/ui from 0.22.0 to 0.24.0 which has a breaking rename: LinkButton becomes ButtonLink, so fixed that here too.
I just have a few questions really, nothing should be blocking from my pov, esp. given the time spent on this - anything here could be addressed in followups if needed. I'm also approving just to make sure this is unblocked from my previous review request now.
For the error code helper: Assuming the onboarding flow won't be live for some time, then connectionErrorCode can be removed here, as well as tracks event jetpack_my_jetpack_onboarding_connect_error. We'll then add tracking in CONNECT-502.
Seems better to me to use tracking from the Connection package rather than use an event from My Jetpack separately in the interim, which will then end up being removed (and would still need to be registered if it was to be in use).
With connectionErrorCode going, connectionErrorDetail can be dropped too. We can show getConnectScreenErrorMessage( code ) (from the Connection package), then the message, then nothing, with the message narrowed inline. Or, at the very least, leave out the code fallback and show the message only when there is one. For the handoffError, a small type guard where it's caught should be enough to read the message safely.
If the preferred decision is to keep the helpers in the interim until CONNECT-502 adds tracking (or just follow up later), then I can update the issue there.
The TS nits 1 and 2 I mentioned are still there. Just wanted to check if they were left intentionally though. Same with point 6 - looks like the FlexBlock -> Stack change was made, not sure if the other option wasn't valid. Ultimately minor.




Proposed changes
A setup wizard for My Jetpack, behind the
my-jetpack-onboarding-wizardfeature flag, which is off. This PR is the shell: the frame, the first screen, connecting, and the server side that decides when the wizard shows. The later steps are placeholders here and are built in #52775.Where it applies: self-hosted sites only, and only where the Jetpack plugin has never registered the site (
unique_registrations). WordPress.com Simple and Atomic never see it.PHP (the part to review closely):
page=jetpackconnect URLs (action=register,connect_url_redirect) are untouched, with the flag on or off. There are tests for both.POST my-jetpack/v1/site/onboarding/settled. Finishing is site-wide (a plain My Jetpack option, not autoloaded). Skipping is per user and per site (a user option).JS:
skip_pricingso the user lands back in the wizard.TermsOfServicecomponent.The connection status card changes from earlier versions of this PR are gone. They were for a fully disconnected My Jetpack, which the call ruled out, and trunk has reworked that card since.
Related product discussion/links
Does this pull request change what data or activity we track or use?
Two events, both only while the flag is on:
jetpack_my_jetpack_onboarding_clickgainsflow: 'wizard', so flag-on and flag-off conversion is one query.jetpack_my_jetpack_onboarding_connect_error, with anerror_codefrom a fixed set, never the server's message.Tracks only loads once the site has agreed to the terms, so on a fresh install these queue and are not sent. That gate is intentional.
Testing instructions
Flag off first. Nothing should change:
wp-admin/admin.php?page=jetpack&action=register. You go to WordPress.com authorization, as on trunk.Then turn the flag on in a mu-plugin:
wp-admin/admin.php?page=jetpack&action=registerstill goes to WordPress.com authorization with the flag on.wp user meta delete <user> <prefix>jetpack_my_jetpack_onboarding_dismissedresets a skip.wp option delete jetpack_my_jetpack_onboarding_completedresets a finish.PHPUnit covers the redirect cases, the settle route and the skip rule:
jp test php packages/my-jetpack.