Skip to content

test: skip stub-driven abilities load-order simulation under real WordPress (#2620)#2625

Merged
chubes4 merged 1 commit into
mainfrom
fix-categories-load-order
Jun 14, 2026
Merged

test: skip stub-driven abilities load-order simulation under real WordPress (#2620)#2625
chubes4 merged 1 commit into
mainfrom
fix-categories-load-order

Conversation

@chubes4

@chubes4 chubes4 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

The homeboy / Test host-smoke phase crashes on abilities-categories-load-order-smoke.php (run-php exit 255 / state 1 assertion failure), which aborts the entire host-smoke run — it stops on the first alphabetical failure. Two sibling tests (abilities-image-template-load-order-smoke.php, abilities-send-email-load-order-smoke.php) have the identical defect and would crash next, so all three are fixed here.

Closes #2620

Root cause

These three smoke tests drive ensure_registered() through its three timing states (doing_action → register now, ! did_action → hook, post-action → no-op) by stubbing the WordPress lifecycle functions (doing_action, did_action, add_action, wp_register_ability_category / wp_register_ability). The stubs are installed only when the real functions are absent:

if ( ! function_exists( 'doing_action' ) ) { function doing_action( $hook ) { ... } }

The wp-codebox host-smoke backend runs every tests/*-smoke.php inside a real WordPress, where all those functions already exist — so the stubs are never installed and are inert. The simulation sets $state->doing = true to fake "the init action is firing", but real doing_action( 'wp_abilities_api_categories_init' ) returns false during the test, so categories never register immediately and the state 1 assertion failsexit(1) → host-smoke aborts.

This is a test-harness incompatibility, not a production regression. The runtime registration logic is correct (and is the same code that boots categories on every request).

Fix

Guard the stub-driven behavioral simulation behind ! defined( 'WPINC' ) — the established real-WP detector already used by agent-conversation-runtime-policy-smoke.php. Under real WordPress the test runs only the source-string assertions (which lock the real contract: unconditional registration call site + lifecycle-safe doing_action/did_action/no-op branches) and exits 0. In the pure-PHP / PHPUnit context the full behavioral simulation still runs.

No production code changed — test-only.

Verification

Each of the three tests validated in both modes:

Test standalone (full sim) real-WP (WPINC defined)
categories-load-order 14 assertions ✓ exit 0 8 source assertions ✓ exit 0
image-template-load-order ✓ exit 0 ✓ exit 0
send-email-load-order ✓ exit 0 ✓ exit 0

The three abilities load-order smoke tests (categories, image-template,
send-email) drive ensure_registered() through its doing_action /
did_action / post-action timing states by stubbing the WordPress
lifecycle functions. Those stubs are only installed when the real
functions are absent (`if ( ! function_exists() )`), so under the
wp-codebox host-smoke backend — which runs every tests/*-smoke.php inside
a real WordPress — the stubs are inert: `doing_action(
'wp_abilities_api_*_init' )` reflects the live (false) dispatch state,
the simulation cannot force state 1, and the "register immediately"
assertion fails, exiting non-zero and aborting the whole host-smoke
phase (it stops on the first alphabetical failure).

Guard the stub-driven behavioral simulation behind `! defined( 'WPINC' )`
(the established real-WP detector used by
agent-conversation-runtime-policy-smoke). The source-string assertions —
which lock the actual contract (unconditional category/ability
registration call site + lifecycle-safe branches) — still run in every
backend, and the behavioral path remains fully exercised in the pure-PHP
/ PHPUnit context. No production code change.

Closes #2620
@homeboy-ci

homeboy-ci Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine

Lint

lint — passed

ℹ️ Full options: homeboy docs commands/lint
Deep dive: homeboy lint data-machine --changed-since 12afa9a

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-lint-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-lint-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27501990562

Test

test — passed

ℹ️ Auto-fix lint issues: homeboy refactor data-machine --from lint --write
ℹ️ Collect coverage: homeboy test data-machine --coverage
ℹ️ Pass args to test runner: homeboy test -- [args]
ℹ️ Full options: homeboy docs commands/test
Deep dive: homeboy test data-machine --changed-since 12afa9a

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-test-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-test-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27501990562

Audit

audit — passed

  • audit — 9 finding(s)
  • Total: 9 finding(s)

Deep dive: homeboy audit data-machine --changed-since 12afa9a

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-audit-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-audit-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/27501990562
Tooling versions
  • Homeboy CLI: homeboy 0.229.8+d44d5011
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: 29a1d974
  • Action: unknown@unknown

@chubes4 chubes4 merged commit 4631058 into main Jun 14, 2026
5 checks passed
@chubes4 chubes4 deleted the fix-categories-load-order branch June 14, 2026 14:42
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.

Host-smoke failure: abilities-categories-load-order-smoke.php fails 'doing_action' category registration assertion in real WP

1 participant