Skip to content

[Blueprints]: Skip steps that set the Site Visibility to Live #59579

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

Merged
merged 5 commits into from
Jul 15, 2025

Conversation

jimjasson
Copy link
Contributor

@jimjasson jimjasson commented Jul 10, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

Taking inspiration from this issue: #59369, we revisited how we deal with import steps that set the Site Visibility to Live.

Blueprint imports are only allowed on Coming Soon sites. However, if the Blueprint was exported from a Live site and then imported to a Coming Soon site, then the latter would automatically be transformed to Live after the import without giving the admin the chance to double-check their configuration. Moreover, since paid plugins/themes are cannot be imported via Blueprints yet, this would potentially lead to a half-finished site, that is not 1-1 the same as the original site and therefore is not ready to be published.

This PR skips all import steps that set the site to Live. It also fixes the type definition of BlueprintStep, which was incomplete.

Closes #59369
Closes https://linear.app/a8c/issue/WOOPLUG-4871

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Start with a brand new site.
  2. Ensure that the site is in Coming Soon mode, under WooCommerce > Settings > Site Visibility.
  3. Go to WooCommerce > Settings > Advanced > Blueprints.
  4. Click to import the following configuration file that changes the site's visibility option to Live:

woo-blueprint-live.json

  1. Ensure that the import is completed without errors.
  2. Refresh the page and ensure that your site is still in Coming Soon.

Testing that has already taken place:

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Skip steps that change the Site Visibility to Live when importing a Blueprint.

Changelog Entry Comment

Comment

@jimjasson jimjasson self-assigned this Jul 10, 2025
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jul 10, 2025
Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

📝 Walkthrough

Walkthrough

A changelog entry was added documenting that blueprint steps setting Site Visibility to Live are now skipped during import. The importBlueprint function was updated to ignore steps with the woocommerce_coming_soon option set to 'no'. The BlueprintStep type was extended to include an optional options property.

Changes

File(s) Change Summary
plugins/woocommerce/changelog/59579-blueprints-skip-live-site-visibility-option Added changelog entry about skipping blueprint steps that set Site Visibility to Live
plugins/woocommerce/client/admin/client/blueprint/components/BlueprintUploadDropzone.tsx Modified importBlueprint to skip steps with woocommerce_coming_soon option set to 'no'
plugins/woocommerce/client/admin/client/blueprint/components/types.ts Added optional options property to BlueprintStep type

Sequence Diagram(s)

sequenceDiagram
    participant AdminUser
    participant BlueprintUploadDropzone
    participant ImportEndpoint

    AdminUser->>BlueprintUploadDropzone: Upload Blueprint
    BlueprintUploadDropzone->>BlueprintUploadDropzone: Parse Blueprint Steps
    loop For each step
        BlueprintUploadDropzone->>BlueprintUploadDropzone: Check if options.woocommerce_coming_soon == 'no'
        alt If 'no'
            BlueprintUploadDropzone-->>BlueprintUploadDropzone: Skip step
        else
            BlueprintUploadDropzone->>ImportEndpoint: Send step for import
        end
    end
    ImportEndpoint-->>BlueprintUploadDropzone: Import result
    BlueprintUploadDropzone-->>AdminUser: Notify completion
Loading

📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2e0162 and 5e498bc.

📒 Files selected for processing (2)
  • plugins/woocommerce/client/admin/client/blueprint/components/BlueprintUploadDropzone.tsx (1 hunks)
  • plugins/woocommerce/client/admin/client/blueprint/components/types.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/woocommerce/client/admin/client/blueprint/components/BlueprintUploadDropzone.tsx
  • plugins/woocommerce/client/admin/client/blueprint/components/types.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Core e2e tests 3/6 - @woocommerce/plugin-woocommerce [e2e]
  • GitHub Check: Core e2e tests 1/6 - @woocommerce/plugin-woocommerce [e2e]
  • GitHub Check: Core e2e tests 4/6 - @woocommerce/plugin-woocommerce [e2e]
  • GitHub Check: Metrics - @woocommerce/plugin-woocommerce [performance]
  • GitHub Check: build
  • GitHub Check: Check Asset Sizes
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Size Change: +18 B (0%)

Total Size: 5.85 MB

compressed-size-action

Copy link
Contributor

github-actions bot commented Jul 10, 2025

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@jimjasson jimjasson closed this Jul 10, 2025
@jimjasson jimjasson reopened this Jul 10, 2025
@jimjasson jimjasson requested a review from PanosSynetos July 10, 2025 08:07
Copy link
Contributor

github-actions bot commented Jul 10, 2025

Testing Guidelines

Hi @hayley-king @PanosSynetos ,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents import steps from automatically setting the site visibility to Live when importing a Blueprint and updates the TypeScript type for blueprint steps.

  • Added an optional options field to the BlueprintStep type.
  • Skipped any blueprint import steps that set woocommerce_coming_soon to no.
  • Added a changelog entry for this tweak.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
plugins/woocommerce/client/admin/client/blueprint/components/types.ts Added options?: Record<string, string> to BlueprintStep.
plugins/woocommerce/client/admin/client/blueprint/components/BlueprintUploadDropzone.tsx Introduced logic to skip steps that set site visibility to Live.
plugins/woocommerce/changelog/59579-blueprints-skip-live-site-visibility-option Changelog entry for skipping Live visibility steps.
Comments suppressed due to low confidence (1)

plugins/woocommerce/client/admin/client/blueprint/components/BlueprintUploadDropzone.tsx:92

  • Add unit or integration tests to cover the new skip logic for steps setting site visibility to Live to ensure it behaves as expected.
			if ( step?.options?.woocommerce_coming_soon === 'no' ) {

@PanosSynetos PanosSynetos requested a review from hayley-king July 10, 2025 13:59
Copy link
Contributor

@PanosSynetos PanosSynetos left a comment

Choose a reason for hiding this comment

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

Hey @jimjasson - I tested this on Jurassic Ninja and my local site and it worked, I don't see an issue and the import works as expected with no hiccups or strange errors (related to the site going live prematurely).

I also tried with the blueprints that @hayley-king provided on the issue

Comment on lines +90 to +95
// Skip steps that set the Site Visibility to Live.
// Admins should have a chance to review their store before it is set to Live.
if ( step?.options?.woocommerce_coming_soon === 'no' ) {
continue;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @jimjasson - Initially I thought that this would throw an error, if woocommerce_coming_soon does not exist. But I chatted with Gemini and shared this

So, if you have step?.options?.woocommerce_coming_soon === 'no', and woocommerce_coming_soon simply doesn't exist on step.options, the expression will evaluate to undefined === 'no', which is false. It will not throw an error at runtime.

So we're good :)

Copy link

@hayley-king hayley-king left a comment

Choose a reason for hiding this comment

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

@PanosSynetos I was able to import my hkco-blueprint.json test blueprint into a new Pressable site successfully. If you need additional details or access to the site, let me know.

@PanosSynetos PanosSynetos merged commit 1a5c8d6 into trunk Jul 15, 2025
32 checks passed
@PanosSynetos PanosSynetos deleted the blueprints/skip-live-site-visibility-option branch July 15, 2025 09:01
@github-actions github-actions bot added this to the 10.1.0 milestone Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error importing Blueprints need more descriptive error messages and troubleshooting guide
3 participants