Repository navigation
Conversation
… host is unreachable and emit structured JSON errors
chubes4
added a commit
to Extra-Chill/homeboy
that referenced
this pull request
Nov 23, 2026
…ved WordPress source, and zero-test suites (#18838) ## Summary Three hardening changes to the bundled WordPress and Node.js extensions. Each one targets a failure that a recent Lab Cook hit without explaining it: a missing shared install helper, an unresolved WordPress source, and a PHPUnit run that executed zero tests. Refs Automattic/wp-codebox#2593 ## What changed **1. Shared helper guard** - `extensions/wordpress/scripts/deps/deps-runner.sh`, `extensions/nodejs/scripts/deps/deps-runner.sh` and `extensions/wordpress/scripts/lib/local-workspace-prepare.mjs` now check that the shared `scripts/lib/local-workspace-install.sh` exists before using it. It is a shared asset from `extensions/homeboy-extension-root.json`. - If the file is missing, each one fails before running the package manager. The error names the expected shared path and the fix: `homeboy extension install https://github.com/Extra-Chill/homeboy --id <wordpress|nodejs>`. Before this change you got a bare `No such file or directory` followed by `npm ci` exit 1. **2. wordpress-source error detail** - When `wp-codebox wordpress-source --json` exits non-zero, `homeboy_wp_codebox_wordpress_source()` now reads the structured `{schema, error:{code,message}}` envelope from stdout first. It puts `code: message` into `HOMEBOY_WP_CODEBOX_WORDPRESS_SOURCE_ERROR`. - Older wp-codebox builds print nothing on stdout. For those it falls back to the last stderr line, as it did before. **3. No silent zero-test runs** - New boolean setting `standalone_php_requires_wordpress_core` (default `false`). When it is set and the WordPress source cannot be resolved, the standalone PHP step fails up front with `ERROR: WordPress core source could not be resolved ...: <reason>`, and the unrun smokes count as failed. Without the setting the behavior stays as it was: one warning line. In both cases, failing standalone smokes now print a `NOTE:` repeating the resolution reason whenever core was unavailable. - In the WP Codebox PHPUnit adapter, a sandbox suite whose PHPUnit config declares `<directory>` entries that contain test files on disk now fails when it executes zero tests. It prints `PHPUNIT_ZERO_TESTS_FAILED: suite "<name>" declares N test file(s) under <dirs> but PHPUnit executed 0 tests`. Before, the default `phpunit_no_tests` policy reported it as skipped. - An explicit `phpunit_no_tests` setting still wins. Homeboy merges manifest defaults into `HOMEBOY_SETTINGS_JSON`, so "explicit" could not be detected while the default was `"skipped"`. The manifest default is now `""`. Unset still behaves as `skipped` everywhere else (`test-runner.sh` and `normalizedTestStatus`). - Suites whose declared directories contain no test files still get the default skip. - Docs: `README.md`, `docs/TESTING.md` and the `wordpress.json` setting descriptions are updated. **Tests** - New `extensions/wordpress/tests/shared-install-helper-missing-smoke.sh`: simulates an installed layout whose shared `scripts/lib` lacks the helper. Both deps runners and the prepare-step bridge must fail with the clear message, without the bare source error and without running the package manager. - Extended `extensions/wordpress/scripts/test/standalone-wordpress-core-root-smoke.sh`: - A structured stdout error must win over the stderr line. - With `standalone_php_requires_wordpress_core`, an unresolved source (structured error and offline cases) must fail the step, include the reason, and not run the smokes. - A resolved source must still run the smokes normally. - New `extensions/wordpress/tests/wp-codebox-phpunit-declared-zero-tests-smoke.mjs`, using a fake wp-codebox CLI: - Declared suite with test files and zero executed: fails. - Explicit `phpunit_no_tests: skipped`: skips. - Explicit `phpunit_no_tests: fail`: fails. - Declared directories with no test files: default skip. - The new tests are registered in `extensions/wordpress/homeboy.json` self-checks. ## Verification Per operator instruction, no `cargo build/test/check/clippy` was run. Run locally: - `bash -n` on every changed or new shell file, and `node --check` on the changed or new `.mjs` files. - `shellcheck` on the changed shell files: no new findings. The warning count is the same or lower than on `main` for each file. - `bash extensions/wordpress/tests/shared-install-helper-missing-smoke.sh`: passes. It fails against the `main` versions of the three changed files. - `bash extensions/wordpress/scripts/test/standalone-wordpress-core-root-smoke.sh`: passes. It fails against the `main` versions of `wp-codebox-paths.sh` and `test-runner.sh`. - `node extensions/wordpress/tests/wp-codebox-phpunit-declared-zero-tests-smoke.mjs`: passes. It fails against the `main` adapter. - Regression runs that pass: - Shell smokes: `local-workspace-deps-lifecycle-smoke.sh` (wordpress), `local-workspace-deps-install-smoke.sh` (nodejs), `full-suite-no-phpunit-smoke.sh`, `standalone-php-failure-evidence-smoke.sh`, `standalone-dependency-env-smoke.sh`, `test-runner-file-routing-smoke.sh`, `test-inventory-standalone-smoke.sh`, `wp-codebox-cli-resolution-smoke.sh`. - Adapter smokes: `wp-codebox-phpunit-{bounded-output,evidence,host-suite,managed-default-suite,managed-selection,multi-suite,multisite,recipe-run-ledger,runtime-crash,runtime-service-diagnosis,timeout-diagnostics,timeout-options}-smoke.mjs` and `wp-codebox-database-service-smoke.mjs`. - Local setup needed for these runs: - The runner smokes need Homeboy's runtime helper env vars, so I pointed `HOMEBOY_RUNTIME_*` at the in-repo `crates/homeboy-core/src/extension/runtime/*.sh` files. - The adapter smokes need a stubbed `extensions/wordpress/vendor/{autoload.php,wp-phpunit/wp-phpunit}`. It was created only for the run, removed afterwards, and not committed. - Not verified locally: `wp-codebox-phpunit-aggregate-smoke.mjs` needs the real composer `vendor/bin/phpunit`. `wp-codebox-phpunit-target-activation-smoke.mjs` needs `HOMEBOY_RUNTIME_SETTINGS_HELPER` from the harness. Both fail the same way on unmodified `main` in this environment. The aggregate smoke's zero-test cases set `phpunit_no_tests` explicitly, so the new rule leaves them unchanged. ## AI disclosure Written by Claude (Anthropic) as a Pi subagent, dispatched directly (outside Homeboy Cook) at @chubes4's request; Claude wrote the code and tests.
Collaborator
Author
|
Closing: the Lab's egress allowlist now includes downloads.w.org, so wordpress-source works there without code changes. Download fallbacks are not needed. AI assistance: Franklin (Anthropic Claude via Roadie/Pi), directed by Chris Huber. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wp-codebox wordpress-source --jsonexited 1 on a Linux CI runner, so host-PHP smoke tests and PHPUnit gates that depend on it got no WordPress core source (PHPUnit then discovered zero tests).Root cause: for
latest, the WordPress release API returns adownloads.w.org/release/wordpress-X.Y.Z.zipURL. That host was unreachable from the runner's network (connect EHOSTUNREACH), whiledownloads.wordpress.organdwordpress.orgwere reachable. The archive cache downloader tried exactly one URL, so one unreachable host made every cache miss fatal. The only error was a barefetch failed, and--jsonprinted nothing on stdout.What changed
playground-cli-runner.ts): on a cache miss, the downloader now tries the URL the API returned, thenhttps://downloads.wordpress.org/release/wordpress-<v>.zip, thenhttps://wordpress.org/wordpress-<v>.zip. These mirrors are only added for release-shaped versions (including beta/RC), not for custom archive URLs. The first valid archive wins, and the source it came from is recorded as the cache validationsourceUrl. This also fixes Playground boot on the same networks, since it uses the same resolver.fetch failednow includes its cause (e.g.EHOSTUNREACH: connect EHOSTUNREACH …). When every source fails, one error names each URL and why it failed.--jsonerrors (wordpress-sourcecommand): with--json, a failure now prints a single object to stdout:{ "schema": "wp-codebox/wordpress-source/v1", "error": { "code", "message", "requestedVersion", "sourceUrl"? } }. The stable codes arewordpress-source-download-failed,wordpress-source-release-unresolved,wordpress-source-cache-locked,wordpress-source-invalid-version,wordpress-source-materialization-failedandwordpress-source-invalid-arguments.root, so existing callers that check.schema+.rootstill see the failure.Verification
wordpress-source --jsonexited 1 withUnable to resolve Playground startup asset wordpress-archive-cache for WordPress 7.1.5 from https://downloads.w.org/release/wordpress-7.1.5.zip: fetch failed.fetchto that URL failed withEHOSTUNREACH, andcurlcould not connect to it either.curl -Itodownloads.wordpress.org/release/wordpress-7.1.5.zip,wordpress.org/wordpress-7.1.5.zipand the version-check API each returned 200.npm run build: passes.tsx tests/wordpress-source.test.ts: passes. New coverage:downloads.w.orgrelease URL, for RC versions, and for custom URLs (no mirrors);downloads.wordpress.org, with the cache and source materialized andsourceUrlreporting the mirror;EHOSTUNREACH, with no archive left behind;--jsonfailures returningwordpress-source-download-failed,-materialization-failed,-invalid-versionand-invalid-arguments, while plain failures keep stdout empty.tests/playground-wordpress-release-cache.test.ts,tests/playground-custom-archive-cache.test.ts,tests/playground-custom-archive-cache-process.test.ts,tests/archive-cache-orphaned-lease.test.tsandscripts/cli-json-failure-smoke.ts.wordpress-source --jsonreturns the 7.1.5 source.--wp trunk --jsonexits 1 with thewordpress-source-invalid-versionerror object.AI disclosure
Written by Claude (Anthropic) as a Pi subagent, dispatched directly (outside Homeboy Cook) at @chubes4's request; Claude wrote the code and tests.