Automattic / Automattic/wp-codebox

Preflight the pinned Playwright browser before browser-bearing recipes

Open
#2,185 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16
Forks
4
Avg merge
59m
Merged PRs (30d)
131

Description

## Problem

Browser-dependent recipes can perform the full WordPress setup/import and fail only when the first browser step launches because the exact Playwright-managed Chromium revision is absent. `wp-codebox doctor --json` currently checks Node, npm, the CLI, processes, temp runtimes, and archives, but does not check the browser executable required by the installed WP Codebox Playwright version.

This is especially fragile on hosts with multiple Playwright consumers: running another package's `playwright install chromium` can prune browser revisions that it considers unused, including the revision required by WP Codebox.

## Reproduction

Installed runtime:

```text
wp-codebox 0.18.0
Playwright expected chromium_headless_shell-1234
```

1. Run `wp-codebox doctor --json`; browser readiness is not represented and the command reports no browser error.
2. Ensure `/Users//Library/Caches/ms-playwright/chromium_headless_shell-1234` is absent.
3. Run a recipe containing `wordpress.editor-open`, `wordpress.editor-validate-blocks`, or `wordpress.visual-compare`.
4. WordPress setup and import proceed, then each browser command fails with:

```text
browserType.launch: Executable doesn't exist at .../chromium_headless_shell-1234/...
Please run the following command to download new browsers: npx playwright install
```

Observed in Homeboy run `701cfb6c-2850-4d20-8b39-d813494cc167` while processing Blocks Engine fixture `89-static-site-importer-architecture`. The child recipe spent 85 seconds before surfacing three browser-step failures.

Installing the browser through the Playwright binary owned by the installed WP Codebox package and replaying the same workload succeeded: Homeboy run `2d788144-6209-4b5c-b39e-d6798e2b49fe`.

## Expected

- `wp-codebox doctor` verifies the exact browser executable required by the installed runtime.
- Browser-bearing recipe preflight fails before WordPress boot/import when that executable is absent.
- Diagnostics provide a command bound to the installed WP Codebox package/version, rather than an ambient `npx playwright install` that may select another package version.
- If `doctor --fix` owns browser installation, it installs only the pinned required revision and reports the resulting executable path/version.
- Deterministic coverage simulates a missing pinned browser without depending on the operator's global Playwright cache.

AI assistance: GPT-5.6 Sol via OpenCode diagnosed the failed run and drafted this report. Chris Huber owns the issue and acceptance criteria.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the wp-codebox doctor --json and doctor --fix entry points, then trace preflight for recipes containing wordpress.editor-open, wordpress.editor-validate-blocks, or wordpress.visual-compare. Verify the installed WP Codebox Playwright runtime's pinned executable without using the ambient npx command. Done means missing-browser failures occur before WordPress setup/import and deterministic coverage reports the bound install command and executable path.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
cli, testing-qa, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.