Skip to content

My Jetpack: add a setup wizard shell behind a feature flag - #52765

Merged
DevinWalker merged 24 commits into
trunkfrom
add/my-jetpack-onboarding-wizard
Oct 16, 2026
Merged

DevinWalker merged 24 commits into
trunkfrom
add/my-jetpack-onboarding-wizard

Conversation

@adampickering

@adampickering adampickering commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

A setup wizard for My Jetpack, behind the my-jetpack-onboarding-wizard feature 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):

  • The onboarding redirect runs from My Jetpack's own page load, as on trunk. page=jetpack connect URLs (action=register, connect_url_redirect) are untouched, with the flag on or off. There are tests for both.
  • With the wizard on, the redirect asks for a connected owner rather than just a connected site. A site that registered but never connected an account is sent back into setup.
  • How someone left is recorded through 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).
  • Skipping needs the site connection. From the My Jetpack / Onboarding / Connection alignment call: accepting the terms, which creates the site connection, is required before anyone reaches My Jetpack. Connecting a WordPress.com account is what becomes skippable. So a saved skip only stops the redirect on a connected site, and the settle route returns a 409 and records nothing before that.
  • The settle route is always registered and checks the wizard in its permission callback, so the check only runs when the route is hit.
  • With the flag on or off, other plugins' notices and JITMs are hidden on the full-screen setup page, and a missing space in the full-screen body class is fixed.

JS:

  • The rail, the question column and the brand panel, built from the components the Site Editor uses.
  • "Get started" accepts the terms, registers the site and hands off to WordPress.com, passing skip_pricing so the user lands back in the wizard.
  • "Skip setup" only shows once the site is registered. "Back to your WordPress site" always works, and before registration it leaves without recording anything.
  • The terms sentence uses the shared TermsOfService component.

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

  • My Jetpack, Onboarding, and Connection Alignment: Decisions & Next Steps (Connection P2, Oct 14)
  • Follow-ups: CONNECT-499 (button stuck loading after a failed hand-off, live on trunk too), CONNECT-502 (registration failures recorded in the connection package)

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_click gains flow: 'wizard', so flag-on and flag-off conversion is one query.
  • jetpack_my_jetpack_onboarding_connect_error, with an error_code from 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:

  • On a disconnected self-hosted site, go to Jetpack → My Jetpack. You get the same "Start with Jetpack for free" screen as trunk.
  • Visit 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:

add_filter( 'jetpack_feature_flag_enabled_my-jetpack-onboarding-wizard', '__return_true' );
  • On a disconnected site that has never had the Jetpack plugin connected, open Jetpack → My Jetpack. You land on the wizard.
  • There's no "Skip setup" on the first step. "Back to your WordPress site" takes you to wp-admin, and opening My Jetpack again brings you back to the wizard.
  • Click Get started, approve on WordPress.com, and you land back on the wizard at step 2 with no plans page in between.
  • Site-only connection: click Get started, then back out on WordPress.com. Open My Jetpack again and you're back in the wizard, now with "Skip setup". Skip it and you land on My Jetpack, which shows "Site connected". Opening My Jetpack again doesn't send you back into setup.
  • wp-admin/admin.php?page=jetpack&action=register still goes to WordPress.com authorization with the flag on.
  • wp user meta delete <user> <prefix>jetpack_my_jetpack_onboarding_dismissed resets a skip. wp option delete jetpack_my_jetpack_onboarding_completed resets a finish.

PHPUnit covers the redirect cases, the settle route and the skip rule: jp test php packages/my-jetpack.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/my-jetpack-onboarding-wizard branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/my-jetpack-onboarding-wizard

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

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.

@jp-launch-control

jp-launch-control Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/my-jetpack/_inc/components/onboarding-screen/index.tsx 0/6 (0.00%) 0.00% 3 ❤️‍🩹
projects/packages/my-jetpack/_inc/components/testimonials/slide-01-gradient.tsx 4/4 (100.00%) 100.00% -1 💚
projects/packages/my-jetpack/src/class-initializer.php 512/588 (87.07%) 1.26% -2 💚

8 files are newly checked for coverage. Only the first 5 are listed here.

File Coverage
projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/choice-step.tsx 16/24 (66.67%) 💚
projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/panel-art.tsx 16/18 (88.89%) 💚
projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/lib.ts 19/20 (95.00%) 💚
projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/steps/start-step.tsx 20/21 (95.24%) 💚
projects/packages/my-jetpack/_inc/components/onboarding-screen/wizard/use-restored-connection.ts 15/15 (100.00%) 💚

Full summary · PHP report · JS report

@ederrengifo

Copy link
Copy Markdown
Contributor

A few comments:

  • In cases like where we expect for the users only to select one option, we could trigger the "Continue" action on the selection, otherwise seems like an unnecessary extra click (unless we expect multiple-selection)
Screenshot 2026-09-24 at 10 58 03 AM
  • Is it a good idea to have a back action in all the steps? For example, once the account is connected, what happens if I click "back" ?
Screenshot 2026-09-24 at 11 10 10 AM
  • It seems we are repeating "Step 2 of 4" in two places on the same UI
Screenshot 2026-09-24 at 11 10 19 AM
  • Are we expecting to make use of the right side to illustrate something? Otherwise, I'm not sure what values provide vs give more focus to the content.
Screenshot 2026-09-24 at 11 11 16 AM

@adampickering
adampickering requested a review from a team as a code owner September 24, 2026 18:46
@adampickering adampickering reopened this Sep 24, 2026
@github-actions github-actions Bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] In Progress labels Sep 24, 2026
Adam Pickering and others added 9 commits September 26, 2026 12:08
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>
@adampickering
adampickering force-pushed the add/my-jetpack-onboarding-wizard branch from c2da611 to ef3daea Compare September 26, 2026 16:10
Adam Pickering and others added 2 commits September 26, 2026 12:47
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
@adampickering
adampickering force-pushed the add/my-jetpack-onboarding-wizard branch from 311806d to b6a3123 Compare September 26, 2026 17:36

@fgiannar fgiannar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Image

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.

@adampickering adampickering removed the [Plugin] Social Issues about the Jetpack Social plugin label Oct 8, 2026
@adampickering

adampickering commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks Karen. Thanks for your patience on this one, again really appreciate the detailed review.

Here's the current status of the PR

Done

  • The redirect runs from My Jetpack's own page load again. All four guards are gone. A test checks it's on that hook and not the global one.
  • The filter is deleted. The only thing using it was the test that proved it worked.
  • Settled state is only checked when the wizard is on.
  • The terms sentence uses the shared component now.
  • The card says what the next screen does: "To use Jetpack, connect this site and your account to WordPress.com."
  • The admin_page() comment now says why the check is repeated: with the wizard on, a connected user is left on that screen on purpose.

Done a different way

  • settle() asks for a connected owner, not is_connected(). A site-only connection makes is_connected() true, and that's the state you said hadn't finished.
  • The completion record is a plain My Jetpack option now, so the connection package is out of this PR.
  • The skip record was shared across a whole multisite. It's per-site now.

Not done

  • I left the handoffError comment alone. Resetting the flag won't make the store save the error, so "temporary" would be wrong. I put the CONNECT-499 note where the bug actually hits.
  • Clearing the records on disconnect. I don't think it works. unique_registrations is never deleted, so the wizard is already off by then. Clearing only brings back the old screen, and that screen can't connect a user. The same hook fires when someone picks "Start fresh" after a domain move.
  • Moving the error code helper. You're right that it belongs in the package. Doing it puts that package back into this PR.
  • calypso_jpc_authorize_success. It fires on WordPress.com, and only for people who got that far. Every failure we need to count sends nothing.

Tracks, partly

  • The click event is jetpack_my_jetpack_onboarding_click with flow: 'wizard'.
  • The success event is gone. You were right, it only meant the browser left.
  • I renamed all eleven wizard events from myjetpack_ to my_jetpack_.
  • Still open: the two flows use different names for the error, the old flow sends no flow property, and nothing is registered yet.

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>
@github-actions github-actions Bot added [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] Stats Data [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. E2E Tests [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Oct 8, 2026
@coder-karen

Copy link
Copy Markdown
Contributor

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

Moving the error code helper. You're right that it belongs in the package. Doing it puts that package back into this PR.

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 ConnectScreen or useConnection records registration failure itself, with a bounded error_code an context. Then every consumer would get these counts for free. Nothing would be needed for My Jetpack in particular.
Am I understanding the need here properly?
That would then make jetpack_my_jetpack_onboarding_connect_error redundant too, and there shouldn't be a need for any of the helpers at all.
This does seem like a better option, and is something we should be adding tracking for anyway imo so I created another issue at CONNECT-502. There is another PR in draft that will also by default do some of this work for us - #53289 - and then 502 can build on that.

Your stuck button is live on trunk

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 userIsConnecting. Because of that, and because that has been live for some time as well, I do not think this needs fixing before your PR. Additionally each of the other consumers are less likely to reach this state as to do so they would be failing to fetch an authorization URL rather than failing to register.

calypso_jpc_authorize_success. It fires on WordPress.com, and only for people who got that far. Every failure we need to count sends nothing.

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:

WizardStep is a hand-written 0 | 1 | 2 | 3, and these three sites force arithmetic into it with as: Math.max( step - 1, firstStep ), step + 1, and Number( event.currentTarget.value ). The assertion hides an out-of-range value. If step ever reached 4, steps[ step ] would be undefined and the render would throw.
Today isLastStep( step ) hides Next on the last step, so it can't happen. The compiler isn't what protects that, though. A possible fix (not verified): a small helper function such as clampStep( n: number ): WizardStep in lib.ts, bounded by TOTAL_STEPS, would let all three sites drop the cast and keep the invariant in one place. The comment above TOTAL_STEPS already notes the union can drift from the step list.

In wizard/assign-location.ts, you have defined assignLocation. My Jetpack already has _inc/hooks/use-notification-watcher/assignLocation.jsx, which wraps window.location.href = url for the same reason. The connection status card already imports it. This new module wraps window.location.assign instead, but could the wizard reuse the existing one?

onboardingWizard is typed OnboardingWizardState | null, but getMyJetpackWindowInitialState( 'onboardingWizard' ) ends in ?.[ key ] ?? {}, so an absent value comes back as {}, never null. {} isn't assignable to OnboardingWizardState either.
The wizard?.exitUrl check in onboarding-screen/index.tsx handles it correctly, but the declared type doesn't match what the accessor returns. Typing it as onboardingWizard?: OnboardingWizardState would make the check read as plain narrowing. The ?? {} cast is pre-existing, so I wouldn't change the accessor in this PR.

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 permission_callback, where it only runs when the route is actually hit (for example REST_Purchases::permissions_callback()).
is_onboarding_wizard_enabled() here runs on every REST request on the site, because register_rest_endpoints() is hooked on rest_api_init. With the flag off, which is the only state shipping now, that is two apply_filters calls, so it's negligible. With the flag on, each request also pays for is_connected() and an option read, to decide whether to add one route.
The route is already guarded by current_user_can( 'jetpack_connect' ) and settle() is safe to call repeatedly, so registering it when the wizard isn't running looks harmless. Two options that stay closer to the package's pattern:

  • Register it unconditionally, like its siblings (in register_rest_endpoints, within class-initializer.php), and put the "wizard enabled" check in permissions_callback() in class-rest-onboarding.php.
  • Keep the conditional registration but gate on Feature_Flags::is_enabled() alone, which removes is_connected() from the hot path.
    If the connection check is there on purpose, such as not exposing the route at all where the wizard can't run, a one-line comment saying so would help.

Looking specifically at wizard.tsx and the Wizard component, there are a few components that come from @wordpress/components and that use __experimental* aliases with eslint-disables. I've not checked the feability of this, but some alternatives to shift more towards @wordpress/ui could be:

  • Heading → Text variant="heading-md" render={ <h2 /> }. Drops the experimental import.
  • FlexBlock → Stack's flex child or a plain flex-grow.

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.
@DevinWalker DevinWalker added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Oct 15, 2026
@DevinWalker
DevinWalker requested a review from kraftbj October 15, 2026 03:03
DevinWalker and others added 4 commits October 14, 2026 20:04
…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 coder-karen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@DevinWalker
DevinWalker merged commit f2afc12 into trunk Oct 16, 2026
124 checks passed
@DevinWalker
DevinWalker deleted the add/my-jetpack-onboarding-wizard branch October 16, 2026 19:32
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Review This PR is ready for review. labels Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E2E Tests [Package] My Jetpack [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] Stats Data [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants