Skip to content

Drop Blueprint features the native runner cannot accept - #4488

Merged
gavande1 merged 4 commits into
trunkfrom
fix/stu-2124-strip-unsupported-blueprint-features
Aug 13, 2026
Merged

Drop Blueprint features the native runner cannot accept#4488
gavande1 merged 4 commits into
trunkfrom
fix/stu-2124-strip-unsupported-blueprint-features

Conversation

@gavande1

@gavande1 gavande1 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

AI assisted with reproducing the failure, tracing it to the schema mismatch between Playground's JS schema and the one bundled in blueprints.phar, and drafting the fix and tests. I reviewed the change and verified it locally against the Stylish Press Blueprint.

Proposed Changes

Creating a site from the Stylish Press Blueprint failed under the native PHP runtime. The cause is a schema mismatch, not a parsing failure.

Studio pre-validates a Blueprint with Playground's JS schema, then hands it to blueprints.phar, which validates it again against its own v1 schema. That schema accepts only features.networking, so a Blueprint setting features.intl is rejected outright rather than having the flag ignored:

Invalid Blueprint v1 provided. See the validation errors below:
Blueprint root["features"]["intl"]:
Property "intl" isn't allowed here. Allowed properties are: networking.

intl and preferredVersions are both environment choices the runner does not make here. Studio picks the PHP binary and installs WordPress before the Blueprint runs. normalizeBlueprintForRunner now strips both, extending the preferredVersions handling that was already inline. Studio's PHP builds ship the Intl extension, so dropping the flag loses nothing.

Testing Instructions

  1. Check out this branch and run npm run cli:build.
  2. Save the Stylish Press Blueprint to a file:
    curl -s "https://public-api.wordpress.com/wpcom/v2/studio-app/blueprints" \
      | python3 -c "import json,sys; print(json.dumps([b for b in json.load(sys.stdin)['blueprints'] if b['slug']=='stylish-press-2'][0]['blueprint']))" \
      > /tmp/stylish-press.json
  3. Before this change, the next step fails with Failed to apply Blueprint. Create a site from the Blueprint under the native runtime:
    node apps/cli/dist/cli/main.mjs site create --name repro --path /tmp/repro-site \
      --wp latest --runtime native --blueprint /tmp/stylish-press.json --no-start --skip-browser
  4. The command exits 0 and prints Site created successfully.
  5. Confirm the Blueprint actually applied, rather than being skipped:
    ls /tmp/repro-site/wp-content/plugins   # includes woocommerce
    ls /tmp/repro-site/wp-content/themes    # includes stylish-press-theme
  6. In the app: enable the native PHP runtime, create a site from the Stylish Press blueprint, and confirm it creates and opens.
  7. Regression: features.networking still reaches the runner, and a Blueprint with no features key is unchanged. Both are covered by the unit tests below.

Tests: npm test -- apps/cli/lib/native-php/tests/blueprints.test.ts → all 5 pass.

Reset (to re-test):

node apps/cli/dist/cli/main.mjs site delete repro --delete-files
rm -rf /tmp/repro-site /tmp/stylish-press.json

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

blueprints.phar's v1 schema knows only features.networking, so a Blueprint
setting features.intl fails validation outright rather than having the flag
ignored. Stylish Press and other gallery Blueprints set it, which is why
creating a site from them failed under the native PHP runtime.

Both intl and preferredVersions are environment choices the runner does not
make here: Studio picks the PHP binary and installs WordPress before the
Blueprint runs. normalizeBlueprintForRunner now strips both, extending the
preferredVersions handling that was already inline. Studio's PHP builds ship
the Intl extension, so dropping the flag loses nothing.
@gavande1
gavande1 force-pushed the fix/stu-2124-strip-unsupported-blueprint-features branch from c82efad to 63878eb Compare August 10, 2026 08:33
@wpmobilebot

wpmobilebot commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 0f7855b vs trunk

app-size

Metric trunk 0f7855b Diff Change
App Size (Mac) 1406.61 MB 1406.61 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 0f7855b Diff Change
load 1083 ms 1058 ms 25 ms ⚪ 0.0%

site-startup

Metric trunk 0f7855b Diff Change
siteCreation 7556 ms 7555 ms 1 ms ⚪ 0.0%
siteStartup 2867 ms 2865 ms 2 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@gavande1
gavande1 requested a review from a team August 10, 2026 10:01
…nsupported-blueprint-features

# Conflicts:
#	apps/cli/lib/native-php/blueprints.ts
#	apps/cli/lib/native-php/tests/blueprints.test.ts

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks I tested it by creating a new site using the Stylish Press blueprint and worked as expected.
I think it makes sense to remove the networking feature because native php runtime have already network access.
Thanks for centralizing the blueprint customization in a single function.

networking.mp4

@gavande1
gavande1 merged commit 3209875 into trunk Aug 13, 2026
13 checks passed
@gavande1
gavande1 deleted the fix/stu-2124-strip-unsupported-blueprint-features branch August 13, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants