Route REST URL imports through the canonical import-url ability contract - #842
Conversation
… contract - Resolve URL-only REST sources via the resumable import-url ability instead of the legacy one-shot collector, so REST and the ability surface exercise one path. - Accept import_id on the REST URL schema; the reference client re-POSTs the same normalized intent until the ability reports terminal completion. - Drop provider, provider_args, work_dir, and batch tuning from the public URL surface; server-side policy stays internal to batch_args(). - URL-only Playground previews short-circuit and emit a structured requires_ability_capable_target requirement instead of invoking the ability on the shipped server. - Current-site terminal envelopes return the import result directly with no preview block. - Remove Static_Site_Importer_URL_Import_Runtime::website_artifact_from_url(). - Harden the view.js continuation loop against error envelopes. - Add continuation, identity-binding, and private-address REST smoke coverage. Closes Automattic#837
The issue Automattic#837 refactor inlined the provider-output call inside import_url(), leaving resolve_provider_output() with no callers. PHPStan reports it as method.unused. Delete the method and its docblock; provider_output() and the static_site_importer_url_import_provider filter stay unchanged.
The new URL import caller passes a function-name string literal to static_site_importer_rest_execute_import_ability(), whose docblock declared the parameter callable-string. PHPStan cannot prove the literal names a defined function. Keep the runtime type as string (the body resolves it via call_user_func), widen the docblock to string, and add a scoped @phpstan-ignore-next-line at the single new call site. The two pre-existing callers are unchanged and now match the docblock.
…egression Homeboy core 0.331.0 (PR #11553) validates the test.failures sidecar as a JSON array, but the wordpress extension wp-codebox adapter still emits an object sidecar. The same failure happens on main, so it is upstream, not introduced by this PR. Pin homeboy core to 0.330.0 (last known good) on both homeboy-action steps. The action SHA stays pinned. Remove the version pin once the extension ships an array-shaped sidecar.
Document the three CI fixes, the local verification commands, the manual wordpress-runtime smokes, and the rollback steps.
|
CI was red on three independent failures. Pushed 4 commits to fix all three so this PR can go green. Fix 1: PHPStan Fix 2: PHPStan Fix 3: Homeboy test sidecar schema (commit f923fb8) Docs (commit 9042270) Local verification
The three new wordpress-runtime smokes ( Ready for CI. |
- Suppress PHPStan argument.type at both inner call_user_func sites in static_site_importer_rest_execute_import_ability() and remove the stale outer ignore - Re-align array double arrows in the continuation envelope, terminal envelope, and requires_ability_capable_target sub-array - Drop the unused $input parameter from static_site_importer_rest_source_runtime() and update its 3 callers Errors fixed: - PHPStan argument.type at includes/rest.php:731 and includes/rest.php:743 - PHPCS WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned (15 warnings) - PHPCS Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed (1 warning) PHP 8.2 compatible. All CI checks passing. Refs Automattic#842
|
Fixed the failing Homeboy Lint check. All 18 findings were in includes/rest.php.
Local checks:
No behavior change. Formatting and static analysis fixes only. PHP 8.1+ compatible. |
Resolves the includes/rest.php conflict introduced by main's
feat/840 plan-first import refactor, which unified URL import
handling inside the static-site-importer/import ability (no
separate import-url ability). Reconciles the branch onto main's
unified ability model:
- Includes/rest.php: keep main's source_runtime/create_import
shape; remove the dead URL branch that called the deleted
Static_Site_Importer_URL_Import_Runtime::website_artifact_from_url();
route URL-only sources through static_site_importer_rest_route_url_import
which dispatches them to the unified 'static-site-importer/import' ability
with source.type=url; playground mode short-circuits to a
requires_ability_capable_target envelope.
- tests/smoke-rest-url-import-{helpers,via-ability,continuation,private-ip}.php
rewritten to drive the unified ability; assertions updated to match the
new envelope shape.
- tests/smoke-importer-block.php: URL-only REST assertions updated to
match the unified ability and new envelope.
Refs Automattic#837, Automattic#842.
…rough-ability Rebase onto Automattic's actual main to resolve PR Automattic#842's merge conflict. Re-resolved tests/smoke-importer-block.php playground URL test on the rest.php URL router that short-circuits to requires_ability_capable_target envelope (URL imports now route through the unified static-site-importer/import ability; the playground preview path returns a structured ability_capable_target_required envelope instead of a real blueprint). Co-Authored-By: Claude <noreply@anthropic.com>
…rough-ability Rebase onto Automattic's actual main to resolve PR Automattic#842's merge conflict. Re-resolved tests/smoke-importer-block.php playground URL test on the rest.php URL router that short-circuits to requires_ability_capable_target envelope (URL imports now route through the unified static-site-importer/import ability; the playground preview path returns a structured ability_capable_target_required envelope instead of a real blueprint).
The file is not part of the canonical documentation set and was a scratch artifact from the CI fix work.
47ebd65 to
29c0e6e
Compare
What
Routes URL-only imports through the resumable
import-urlability so the plugin UI and the ability surface exercise one canonical path.Changes
static-site-importer/import-urlinstead of the legacy one-shot collector.import_idon the REST URL schema. The reference client re-posts the same normalized intent until the ability reports terminal completion.provider,provider_args,work_dir, and batch tuning from the public URL surface. Server-side policy stays internal tobatch_args().requires_ability_capable_targetrequirement instead of invoking the ability on the shipped server.Static_Site_Importer_URL_Import_Runtime::website_artifact_from_url().view.jscontinuation loop against error envelopes.How to test
/wp-json/static-site-importer/v1/importscarries the previousimport_iduntil terminal.http://127.0.0.1/). Confirmstatic_site_importer_url_private_ip/static_site_importer_url_hostand the current site is not modified.Testing already done
php tests/smoke-rest-url-import-helpers.php(28 assertions)php tests/smoke-url-import-runtime.php(20 assertions)php tests/smoke-importer-block.php(304 assertions)npm run test:inventorycleannpm test45 passed, 4 pre-existing fixture-matrix failures unchangedNotes
import-urlability schema no longer declaresprovider/provider_args/work_dir. External callers that posted those fields will have them ignored. The hosted override path remains available via thestatic_site_importer_url_import_providerfilter.Closes #837