Skip to content

[PHP] Don't call prefetchUpdateChecks() when WordPress is disabled - #3589

Merged
adamziel merged 2 commits into
trunkfrom
adamziel/php-snippet-question
May 1, 2026
Merged

[PHP] Don't call prefetchUpdateChecks() when WordPress is disabled#3589
adamziel merged 2 commits into
trunkfrom
adamziel/php-snippet-question

Conversation

@adamziel

@adamziel adamziel commented May 1, 2026

Copy link
Copy Markdown
Collaborator

What it does

Fixes wp="none" PHP snippets that boot through a Blueprint. PHP-only Blueprints now skip WordPress update prefetching, so the runtime no longer tries to load WordPress files that were intentionally not installed.

The demo page also includes a quickstart.php example that installs a tiny /tmp/php-toolkit/vendor/autoload.php through a Blueprint and runs WP_HTML_Tag_Processor outside WordPress.

Rationale

wp="none" maps to preferredVersions.wp: false, which means the runtime boots PHP without a /wordpress directory. BlueprintsV1Handler still called prefetchUpdateChecks() after boot when networking was enabled, and that path expects WordPress to exist.

That made PHP-only snippets fail even when their own code and Blueprint did not require WordPress.

Implementation

BlueprintsV1Handler already computes whether WordPress should be installed:

const installWordPress = shouldInstallWordPress ?? !declarativeOptOut;

This now gates prefetchUpdateChecks() as well:

if (runtimeConfiguration.networking && !isLegacyWpVersion && installWordPress) {
	await playground.prefetchUpdateChecks();
}

Added a focused client regression test for both paths: PHP-only Blueprints do not prefetch, while normal WordPress boots still do.

Testing instructions

npm exec nx test playground-client --testFile=blueprints-v1-handler.spec.ts
npm exec nx typecheck playground-client
npm exec nx lint playground-client
npm exec nx lint playground-website

I also ran the focused php-code-snippet Playwright case against the bundled wasm-wordpress-net layout in Chromium, where /client/index.js is served and the snippet executes successfully.

@adamziel adamziel changed the title Fix PHP-only snippet blueprint boot May 1, 2026
@adamziel
adamziel marked this pull request as ready for review May 1, 2026 23:19
@adamziel
adamziel requested review from a team, bgrgicak and Copilot May 1, 2026 23:19

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adjusts Blueprint boot behavior so PHP-only Playground runs (WordPress disabled via preferredVersions.wp: false / wp="none") don’t attempt WordPress update prefetching, preventing crashes due to missing WP files.

Changes:

  • Gate prefetchUpdateChecks() behind installWordPress in BlueprintsV1Handler.
  • Add Vitest regression coverage for PHP-only vs WordPress-installed boot paths.
  • Extend the demo page + Playwright e2e coverage with a PHP-only “toolkit” snippet example.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
packages/playground/client/src/blueprints-v1-handler.ts Skips update prefetch when WordPress isn’t installed.
packages/playground/client/src/blueprints-v1-handler.spec.ts Adds unit regression tests for prefetch gating.
packages/playground/website/public/php-code-snippet-demo.html Adds a new PHP-only toolkit demo snippet driven by a Blueprint.
packages/playground/website/playwright/e2e/php-code-snippet.spec.ts Adds e2e coverage for the new quickstart snippet and toolkit scenario.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/website/public/php-code-snippet-demo.html Outdated
Comment thread packages/playground/website/public/php-code-snippet-demo.html Outdated
Comment thread packages/playground/website/public/php-code-snippet-demo.html
Comment thread packages/playground/website/playwright/e2e/php-code-snippet.spec.ts Outdated
Comment thread packages/playground/client/src/blueprints-v1-handler.spec.ts Outdated
@adamziel
adamziel merged commit f26633a into trunk May 1, 2026
49 of 50 checks passed
@adamziel
adamziel deleted the adamziel/php-snippet-question branch May 1, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment