Skip to content

Set WP_SQLITE_AST_DRIVER constant when running wp CLI commands without running server - #2980

Merged
wojtekn merged 1 commit into
trunkfrom
fix-wp-sqlite-ast-driver-wp-cli
Apr 7, 2026
Merged

Set WP_SQLITE_AST_DRIVER constant when running wp CLI commands without running server#2980
wojtekn merged 1 commit into
trunkfrom
fix-wp-sqlite-ast-driver-wp-cli

Conversation

@wojtekn

@wojtekn wojtekn commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

I debugged the SQLite plugin issue popping up in Studio CLI when running wp command and identified an issue. Then, used Claude Code to implement the fix.

Proposed Changes

  • Set WP_SQLITE_AST_DRIVER: true in runWpCliCommand() via php.defineConstant() to match what the WordPress server sets via blueprint constants on startup

When a Studio site server is running, wp CLI commands are forwarded to the already-running playground instance which has WP_SQLITE_AST_DRIVER: true active (set via blueprint constants in wordpress-server-child.ts). When no server is running, runWpCliCommand spawns a fresh PHP-WASM instance without a blueprint - so the constant was never set, causing the SQLite AST driver to be skipped.

Testing Instructions

  1. Stop any running Studio server for a local site
  2. Run a wp CLI command against that site: node apps/cli/dist/cli/main.mjs wp plugin list --path=<site-path>
  3. Confirm the command succeeds

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@wojtekn wojtekn self-assigned this Apr 6, 2026
@wojtekn
wojtekn requested a review from a team April 6, 2026 08:40
@wojtekn wojtekn changed the title Set WP_SQLITE_AST_DRIVER constant when running wp CLI commands withou… Apr 6, 2026
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5680a8b vs trunk

app-size

Metric trunk 5680a8b Diff Change
App Size (Mac) 1263.82 MB 1263.82 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 5680a8b Diff Change
load 1913 ms 1939 ms +26 ms ⚪ 0.0%

site-startup

Metric trunk 5680a8b Diff Change
siteCreation 8174 ms 8194 ms +20 ms ⚪ 0.0%
siteStartup 4884 ms 4944 ms +60 ms 🔴 1.2%

Results are median values from multiple test runs.

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

@fredrikekelund fredrikekelund 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.

Works great 👍

@katinthehatsite katinthehatsite 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.

It looks good to me and the command succeeds:

Image
@wojtekn
wojtekn merged commit 924afff into trunk Apr 7, 2026
11 checks passed
@wojtekn
wojtekn deleted the fix-wp-sqlite-ast-driver-wp-cli branch April 7, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants