Skip to content

Conversation

@kraftbj
Copy link
Contributor

@kraftbj kraftbj commented Jun 30, 2020

Fixes #11798

Changes proposed in this Pull Request:

  • Uses wp_get_environment_type as the default value for the Status package is_staging_site value (by way of !== production is a staging site in how we handle them).
  • Uses the WP_LOCAL_DEV that Core site health does check. This activates our "Development Mode".
  • Renames "Development Mode" to "Offline Mode" to be clearer our intent of this mode.
  • Deprecation and updates relevant for ^.

Jetpack product discussion

n/a

Does this pull request change what data or activity we track or use?

n/a

Todo required

If this lands, we need to update documentation. I'm okay doing this in a folllow-up PR or adding a new commit here if this is otherwise approved.

If we're happy with this, I'll coordinate with Quill.

Testing instructions:

  • Ensure Offline mode works (try this on localhost without a dot in the domain, e.g. our docker without using ngrok/JT.
  • On a JN site running on WP trunk on a connected Jetpack site, set a constant define( 'WP_ENVIRONMENT_TYPE', 'staging' ); Does this activate staging mode?

Proposed changelog entry for your changes:

  • WordPress 5.5: Utilize new wp_get_environment_type function to determing Staging sites.
  • Rename Development Mode to Offline Mode to be clearer our intent for its use.

@kraftbj kraftbj added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it General [Status] Needs Review This PR is ready for review. [Package] Status labels Jun 30, 2020
@kraftbj kraftbj added this to the 8.8 milestone Jun 30, 2020
@kraftbj kraftbj requested a review from a team as a code owner June 30, 2020 17:07
@kraftbj kraftbj self-assigned this Jun 30, 2020
Copy link

@test-case-reminder test-case-reminder bot left a comment

Choose a reason for hiding this comment

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

Here are some suggested test cases for this PR.

Gutenberg extensions

  • Use Core's block editor
  • Use latest stable Gutenberg plugin

Blocks

  • Tiled Gallery
  • Business Hours
  • Calendly
  • Form
  • Contact Info
  • Eventbrite
  • Google calendar
  • Mailchimp
  • Map
  • OpenTable
  • Pinterest
  • Podcast player
  • Star rating
  • Recurring Payments
  • Repeat Visitor
  • Revue
  • Simple Payments
  • Slideshow

Extensions

  • Publicize
  • Likes

Connection

  • In-place connection with free plan
  • In-place connection with paid plan
  • In-place connection with product purchase
  • Classic connection. Use Safari, or set a constant JETPACK_SHOULD_USE_CONNECTION_IFRAME to false
  • Disconnect/reconnect connection
  • Secondary user connection
  • Connection on multisite

If you think that suggestions should be improved please edit the configuration file here. You can also modify/add test-suites to be used in the configuration file.

@github-actions github-actions bot added the [Status] Needs Package Release This PR made changes to a package. Let's update that package now. label Jun 30, 2020
@jetpackbot
Copy link
Collaborator

jetpackbot commented Jun 30, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-16338

Scheduled Jetpack release: August 4, 2020.
Scheduled code freeze: July 28, 2020

Generated by 🚫 dangerJS against 6bb0d46

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

I think that's a good change. I only have one minor remark.

@jeherve jeherve 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] Needs Review This PR is ready for review. labels Jun 30, 2020
@ebinnion
Copy link
Contributor

I believe the Infinity ping here is for the jetpack-cli.php file. For that file, I don't see any issues. 👍

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Should we update this little utility in the React dashboard as well?

/**
* Checks if the site is currently in development mode.
*
* @param {Object} state Global state tree
* @return {boolean} True if site is in dev mode. False otherwise.
*/
export function isDevMode( state ) {
return 'dev' === getSiteConnectionStatus( state );
}

We also have a few "Unavailable in Dev Mode" strings in the React dashboard that may be worth updating, as well as the "Dev Mode" badge:

const devNotice = this.props.siteConnectionStatus === 'dev' ? <code>Dev Mode</code> : '',

@kraftbj kraftbj force-pushed the core-compat/site-env branch 9 times, most recently from 05d2298 to 8aa6574 Compare July 6, 2020 22:15
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello kraftbj! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D46012-code before merging this PR. Thank you!
This revision will be updated with each commit to this PR

@kraftbj kraftbj 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 Jul 7, 2020
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Let's add WP_LOCAL_DEV here to avoid an empty message?

if ( devMode.filter ) {
reasons.push(
__( '{{li}}The jetpack_development_mode filter is active{{/li}}', {
components: {
li: <li />,
},
} )
);
}
if ( devMode.constant ) {
reasons.push(
__( '{{li}}The JETPACK_DEV_DEBUG constant is defined{{/li}}', {
components: {
li: <li />,
},
} )
);
}
if ( devMode.url ) {
reasons.push(
__( '{{li}}Your site URL lacks a dot (e.g. http://localhost){{/li}}', {
components: {
li: <li />,
},
} )
);
}

image


When I use the WP_LOCAL_DEV constant, I get both the staging notice and the local one:

image

Maybe we should set a site as staging only when it has the staging WP environment type?

jeherve
jeherve previously approved these changes Jul 27, 2020
@jeherve jeherve force-pushed the core-compat/site-env branch from 676bdce to c8b38df Compare July 27, 2020 12:29
@kraftbj
Copy link
Contributor Author

kraftbj commented Jul 27, 2020

Caution: This PR has changes that must be merged to WordPress.com
Hello kraftbj! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D46012-code before merging this PR. Thank you!
This revision will be updated with each commit to this PR

Note that this can not land until after the package update has been released and deployed on WP.com.

@brbrr brbrr force-pushed the core-compat/site-env branch from 34df120 to 6bb0d46 Compare July 27, 2020 16:22
@brbrr
Copy link
Contributor

brbrr commented Jul 27, 2020

Sorry folks, I have commited into this branch by mistake. removed the commit and force-pushed the branch

Copy link
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

Found a few things, but could be fixed in separate PRs since this one is already so big.

Found a reference to the old term "Development mode" here
image

When using WP_LOCAL_DEV constant, I see a notice saying I'm using a staging server (not true). This notice does not appear with the JETPACK_DEV_DEBUG constant.
image

Everything else seems to work as expected

  • Fresh build
  • jetpack_development_mode filter
  • localhost url

Copy link
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

Approving despite the comments above, in case you'd prefer to fix those in separate PR.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Jul 28, 2020
@jeherve jeherve merged commit 4392a22 into master Jul 28, 2020
@jeherve jeherve deleted the core-compat/site-env branch July 28, 2020 08:21
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jul 28, 2020
jeherve added a commit to Automattic/companion that referenced this pull request Jul 28, 2020
@jeherve
Copy link
Member

jeherve commented Jul 28, 2020

Found a reference to the old term "Development mode" here

Fixed that in #16608

When using WP_LOCAL_DEV constant, I see a notice saying I'm using a staging server (not true).

Yes, we may have to discuss this again, since we're not exactly sure how folks are going to be using the different environment types yet (see discussion above).

jeherve added a commit that referenced this pull request Jul 28, 2020
@jeherve jeherve removed the [Status] Needs Package Release This PR made changes to a package. Let's update that package now. label Jul 29, 2020
georgestephanis added a commit that referenced this pull request Oct 12, 2020
Since being added recently in r48856-core we may as well listen for the environment declaring itself `local` explicitly.

https://core.trac.wordpress.org/ticket/51064

Relevant prior art: #16338
@jeherve
Copy link
Member

jeherve commented May 13, 2021

r225659-wpcom

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

Labels

General [Package] Status Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Staging/Development Mode: Check and use WP_LOCAL_DEV

8 participants