Skip to content

wordpress.bench should load declared plugin dependencies in the benchmark request #570

@chubes4

Description

@chubes4

Problem

wordpress.bench does not currently guarantee that declared plugin dependencies are loaded in the PHP request that executes benchmark workloads.

This surfaced while building Homeboy evidence for WooCommerce Stripe Express Checkout performance issue woocommerce/woocommerce-gateway-stripe#1439.

Homeboy generated a WP Codebox recipe with:

  • WooCommerce mounted at /wordpress/wp-content/plugins/woocommerce
  • Stripe mounted at /wordpress/wp-content/plugins/woocommerce-gateway-stripe
  • blueprint activatePlugin steps for both plugins
  • wordpress.bench args including dependency-slugs=woocommerce

The workload still failed with:

Fatal error: Uncaught RuntimeException: WooCommerce is not active in the benchmark runtime.

The workload check was:

if ( ! function_exists( 'WC' ) || ! class_exists( 'WooCommerce' ) ) {
    throw new RuntimeException( 'WooCommerce is not active in the benchmark runtime.' );
}

Root Cause Direction

The current bench handler activates plugins after wp-load.php and manually fires synthetic lifecycle hooks. If the blueprint already activated the plugin, is_plugin_active() causes bench to skip activate_plugin(), so the plugin main file may never be included in the current request.

A local patch that explicitly require_onces the component/dependency plugin files made the built-in WP Codebox bench smoke tests pass, but the real WooCommerce/Stripe rig still needs deeper hardening/diagnostics to prove the full integration contract.

Desired Contract

For wordpress.bench:

  • dependency-slugs means those plugin main files are available to benchmark workloads in the current PHP request.
  • The component plugin main file is also available before benchmark workloads run.
  • Bench should either load dependencies successfully or fail with a structured diagnostic that names the missing plugin file, active state, include status, and relevant paths.
  • Blueprint activation and bench dependency loading should not fight each other.
  • Homeboy can pass mounted plugins + dependency-slugs and expect plugin functions/classes to be visible in workloads.

Repro Context

Worktree used locally:

/Users/chubes/Developer/wp-codebox@fix-bench-load-active-plugins

Temporary Homeboy rig package:

/var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/opencode/wc-stripe-ece-perf-rig

Bench command used:

HOMEBOY_WP_CODEBOX_BIN="/Users/chubes/Developer/wp-codebox@fix-bench-load-active-plugins/packages/cli/dist/index.js" \
  homeboy bench --force-hot --rig wc-stripe-ece-product-page --profile smoke --iterations 1 --warmup 0 \
  --shared-state "/var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/opencode/wc-stripe-ece-perf-rig/artifacts" \
  --output "/var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/opencode/wc-stripe-ece-perf-rig/bench-output.json"

Recent artifact path from a failed run:

/var/folders/lr/c_cmmt7s0592m4njz99v5yb40000gn/T/homeboy-wp-codebox-bench-artifacts.T9d6Yz/runtime-mpzh2d4q-ussybx

Acceptance Criteria

  • Add coverage proving wordpress.bench workloads can see dependency plugin functions/classes loaded from dependency-slugs.
  • Add diagnostics for missing dependency/component plugin files or load failures.
  • Verify existing smoke tests still pass.
  • Verify the WooCommerce/Stripe Homeboy rig no longer fails at the dependency-loading stage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions