Skip to content

Conversation

@nightnei
Copy link
Contributor

@nightnei nightnei commented Jan 7, 2026

Proposed Changes

I worked around the sync-support module and didn't get how to reproduce cases, since the conditions are not clear.
See comments.

Testing Instructions

Assert that everything still works well:

  1. Create jurassic.ninja site, install jetpack and conntect to dotcom, open Studio sync tab and assert that it's marked as unsupported.
  2. Create Business site, open bulk-delete-test-sites, revert to simple, open Studio sync tab and assert that the site is marked as "Enable hosting features"
  3. Test wp.com sites and assert that they are marked as "syncable" only for Business+ plan.
  4. Test Pressable sites and assert that they are always marked as "syncable"

if ( ! site.capabilities?.manage_options ) {
return 'missing-permissions';
}
if ( isJetpackSite( site ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why jetpack site is unsupported?
Jetpack is required. So I renamed to isUnsupported.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar as in my previous comment:

As far as I remember, we used this in the past to filter out self-hosted sites that are not hosted by us (via WPCOM and Pressable).

In that logic, "Jetpack site" referred to "self-hosted WordPress site".

}

export function isJetpackSite( site: SitesEndpointSite ): boolean {
return !! site.jetpack && ! isAtomicSite( site ) && ! isPressableSite( site );
Copy link
Contributor Author

@nightnei nightnei Jan 7, 2026

Choose a reason for hiding this comment

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

Why detection of jetpack includes ! isAtomic && ! isPressable? Theoretically !! site.jetpack should be enough.

I took a look at history and now the function directly says that jetpack site, which is not atomic is unsupported, and the example is jurasic.ninja

Copy link
Contributor

Choose a reason for hiding this comment

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

Why detection of jetpack includes ! isAtomic && ! isPressable?

As far as I remember, we used this in the past to filter out self-hosted sites that are not hosted by us (via WPCOM and Pressable).

In that logic, "Jetpack site" referred to "self-hosted WordPress site".

Copy link
Contributor Author

@nightnei nightnei Jan 8, 2026

Choose a reason for hiding this comment

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

The main point here - below we have a condition that Jetpack sites are unsupported:

if ( isJetpackSite( site ) ) {
	return 'unsupported';
}

But it's not true, since all supported sites must have Jetpack. I worked around this code, needed cases to reproduce it, and got stuck.

In that logic, "Jetpack site" referred to "self-hosted WordPress site".

Then it should be either isUnsupported or isSelfHosted, but not isJetpackSite.

}

export function needsTransfer( site: SitesEndpointSite ): boolean {
return ! isJetpackSite( site ) && ! isPressableSite( site ) && ! isAtomicSite( site );
Copy link
Contributor Author

@nightnei nightnei Jan 7, 2026

Choose a reason for hiding this comment

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

If we read this condition, it says:

  1. NOT !! site.jetpack && ! isAtomicSite( site ) && ! isPressableSite( site )
    &&
  2. && ! isPressableSite( site ) && ! isAtomicSite( site )

It's dificult to undersathnd when it's actually true. I have read the history of comits and simplified to just ! site.jetpack && ! isAtomicSite( site ). And added the comment to how to reproduce the case.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was a workaround to check for a Simple site (a site that is not Jetpack, not Atomic and not Pressable).

It was as long time again since I looked at the old logic, but I believe there was some edge case that resulted in this more complex check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main point here, that the condition is - ! ( !! site.jetpack && ! isAtomicSite( site ) && ! isPressableSite( site ) ) && ! isPressableSite( site ) && ! isAtomicSite( site ), and it's not possible to understand it. And I haven't found any use case for something like this. Also reading commits history - I haven't found any "Testing instruction" or some PR description which says about some unusual use case.

if ( isUnsupported( site ) && ! isPressableSite( site ) ) {
return 'unsupported';
}
if ( ! hasSupportedPlan( site ) && ! isPressableSite( site ) ) {
Copy link
Contributor Author

@nightnei nightnei Jan 7, 2026

Choose a reason for hiding this comment

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

In this condition we keep isPressableSite here, outside the hasSupportedPlan and imo it's good idea, to be clear at the upper level that the plan is about only dotcom, and it's not about Pressable.
So I added the same approach to two other cases (isUnsupported and needsTransfer).
Also, it's for consistency.

@wpmobilebot
Copy link

📊 Performance Test Results

Comparing 33366f8 vs trunk

site-editor

Metric trunk 33366f8 Diff Change
load 7138.00 ms 6991.00 ms -147.00 ms 🟢 -2.1%

site-startup

Metric trunk 33366f8 Diff Change
siteCreation 9082.00 ms 9069.00 ms -13.00 ms 🟢 -0.1%
siteStartup 3957.00 ms 3956.00 ms -1.00 ms 🟢 -0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

@nightnei nightnei requested a review from a team January 7, 2026 13:37
@nightnei nightnei self-assigned this Jan 7, 2026
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements, Vova. This logic is indeed difficult to troubleshoot.

So far the changes look generally good to me and I haven't noticed any regressions so far. I have left a couple of comments.

Tomorrow I will give this a second look with fresh 🧠 . 🙂

}

export function isJetpackSite( site: SitesEndpointSite ): boolean {
return !! site.jetpack && ! isAtomicSite( site ) && ! isPressableSite( site );
Copy link
Contributor

Choose a reason for hiding this comment

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

Why detection of jetpack includes ! isAtomic && ! isPressable?

As far as I remember, we used this in the past to filter out self-hosted sites that are not hosted by us (via WPCOM and Pressable).

In that logic, "Jetpack site" referred to "self-hosted WordPress site".

}

export function needsTransfer( site: SitesEndpointSite ): boolean {
return ! isJetpackSite( site ) && ! isPressableSite( site ) && ! isAtomicSite( site );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was a workaround to check for a Simple site (a site that is not Jetpack, not Atomic and not Pressable).

It was as long time again since I looked at the old logic, but I believe there was some edge case that resulted in this more complex check.


export function isJetpackSite( site: SitesEndpointSite ): boolean {
return !! site.jetpack && ! isAtomicSite( site ) && ! isPressableSite( site );
// Sites hosted outside wp.com and Pressable (e.g. jurassic.ninja).
Copy link
Contributor

Choose a reason for hiding this comment

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

While reviewing the code I wanted to suggest moving isPressableSite check into the isUnsupported helper function directly, but then I read your other comment below:

In this condition we keep isPressableSite here, outside the hasSupportedPlan and imo it's good idea, to be clear at the upper level that the plan is about only dotcom, and it's not about Pressable.
So I added the same approach to two other cases (isUnsupported and needsTransfer).
Also, it's for consistency.

Sounds good to me. 👍🏼 With that I think we may want to update the comment above:

// Sites hosted outside wp.com and Pressable (e.g. jurassic.ninja).

As now it looks as if isUnsupported also checks for Pressable sites.

if ( ! site.capabilities?.manage_options ) {
return 'missing-permissions';
}
if ( isJetpackSite( site ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar as in my previous comment:

As far as I remember, we used this in the past to filter out self-hosted sites that are not hosted by us (via WPCOM and Pressable).

In that logic, "Jetpack site" referred to "self-hosted WordPress site".

Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

The changes looks good to me. 👍🏼 I have tested the Sync modal with different kinds of sites and did not observe any regressions:

Image Image

@nightnei nightnei merged commit 6ab139b into trunk Jan 9, 2026
25 checks passed
@nightnei nightnei deleted the refactorSyncSupport branch January 9, 2026 14:10
Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

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

I just wanted to approve this but it looks like it is already merged. The changes looked good to me, I did not see any regressions in the Connect your site modal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants