Automattic / Automattic/wp-codebox

Real-WordPress PHP smoke harness needs a deterministic bootstrap contract

Open
#1,015 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
The real-WordPress smoke execution environment can have WordPress functions loaded without the smoke being able to rely on the usual bootstrap markers. In Data Machine PR CI, a pure-PHP smoke guarded on `defined( 'WPINC' )`, but WP functions such as `do_action()` were already loaded, causing:

`Cannot redeclare do_action() (previously declared in /wordpress/wp-includes/plugin.php)`

This required changing the smoke to guard every stub with `function_exists()`. That is reasonable defensively, but the harness contract is ambiguous.

## Expected
WP Codebox should document and/or enforce a deterministic contract for real-WordPress PHP smoke execution:

- whether WordPress is fully bootstrapped
- whether `WPINC`/`ABSPATH` are defined
- whether core functions are loaded
- whether pure-PHP smoke files should be skipped, isolated, or run in a non-WP process

## Why
Ambiguous partial bootstrap makes standalone smoke tests brittle and creates CI-only failures that are hard to reproduce locally.

## Evidence
Data Machine PR: https://github.com/Extra-Chill/data-machine/pull/2638
Initial failure: `tests/adjacent-handler-tool-policy-smoke.php` redeclared `do_action()` under WP Codebox real-WP host smoke execution.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.