Draft php-transformer package#1
Conversation
|
Fleet wave integrated into this draft branch. Added:
Verification from
Both passed after integrating the parallel slices. |
|
Second parallel fleet integrated. Added:
Verification from
All passed. Parity harness result: 4 fixtures passed, 3 legacy comparisons skipped by metadata. |
|
Third parallel fleet integrated. Added:
Verification from
All passed. Parity harness result: 6 fixtures passed, 0 legacy comparisons, 6 legacy comparisons skipped by metadata. |
|
Fourth parallel fleet integrated. Added:
Verification from
All passed. Parity harness result: 9 fixtures passed, 0 legacy comparisons, 9 legacy comparisons skipped by metadata. |
|
Sixth parallel fleet integrated. This wave tightened the intended direction: Added/changed:
Verification from
All passed. Default parity now reports only canonical fixture results. Opt-in migration parity with local old repo paths also passed: 15 fixtures, 1 migration comparison, 14 explicit skips. |
|
Seventh parallel fleet integrated. This wave made the repo-consolidation strategy explicit: collapse implementation into Added/changed:
Verification from
All passed. Opt-in migration parity with local old repo paths also passed: 15 fixtures, 1 migration comparison, 14 explicit skips. |
|
Eighth cooking wave integrated. Direction reinforced:
Upstream changes pushed:
Downstream dry run:
Verification from
All passed. Opt-in migration parity with local old repo paths also passed: 15 fixtures, 1 migration comparison, 14 explicit skips. |
|
Ninth cooking wave integrated. Focus: generic upstream gaps from the downstream dry run, without making Upstream changes pushed:
Downstream continuation:
Verification from
All passed. Canonical parity now has 16 fixtures. Opt-in migration parity with local old repo paths also passed: 16 fixtures, 1 migration comparison, 15 explicit skips. |
|
Tenth cooking wave integrated. Focus: close the first generic artifact/media gap from the downstream dry run without introducing downstream package awareness. Upstream change pushed:
Verification from
All passed. Opt-in migration parity with local old repo paths also passed: 17 fixtures, 1 migration comparison, 16 explicit skips. |
|
Eleventh cooking wave integrated. Focus: generic source/reference provenance for artifact image handling. Upstream change pushed:
Verification from
All passed. Opt-in migration parity with local old repo paths also passed: 17 fixtures, 1 migration comparison, 16 explicit skips. |
|
Twelfth cooking wave integrated. Focus: richer generic unsupported-element diagnostics from the downstream dry-run gap list. Upstream change pushed:
Verification from
All passed. Opt-in migration parity with local old repo paths also passed: 17 fixtures, 1 migration comparison, 16 explicit skips. |
…ry + metrics) (#426) * blocks-engine: add convert report envelope design spec Design for porting php-transformer's structured result envelope into packages/blocks-engine as item #1 of docs/to-port-to-js.md: a new canonical convertReport() returning { schema, status, blockMarkup, fallbacks, diagnostics, metrics }, with convert() projected to .blockMarkup. Covers the tolerant ConversionFinding shape, core/html-as-fallback-source inventory, metrics, a pure unit-testable buildReport core, and an assertConvertReport contract. Scopes ratchet integration and hallucination findings out to later items. * blocks-engine: fold deep-review deltas into convert report spec Incorporates the four decisions from the plan deep review: (1) block analysis moves into the worker (Approach A) so buildReport stays pure and WP-free and the no-wordpress-runtime-deps contract holds, reusing walkBlocks and adding blockCount/htmlIslands to FixResult; (2) conversion_degraded diagnostic when the pool sentinel fires; (3) unconverted_html inventory capped at 100 with a fallback_inventory_truncated diagnostic while metrics.fallbackCount keeps the true total; (4) snippet sanitized, char-based (multibyte-safe) truncation, documented as untrusted. Updates sections 3-8 and the testing matrix accordingly. * blocks-engine: freeze convert report contracts * blocks-engine: add structured convert report * blocks-engine: add content dropped finding code * blocks-engine: harden convert report honesty * blocks-engine: freeze theme conversion diagnostics contract * blocks-engine: surface conversion diagnostics in themes * blocks-engine: record deferred convert-report follow-ups Capture the 6 review-deferred follow-ups (invalid-block severity, fallbackCount/length doc, inventory perf gate per council C, snippet render-safety, failed-status decision, purity import-graph guard) in the spec so nothing is lost after the branch lands. Docs only. * blocks-engine: make theme conversion diagnostics field optional Declare ThemeDiagnostics.conversion optional so adding it is backward-compatible for external code that constructs a ThemeBuildResult/ThemeDiagnostics literal (e.g. downstream test fixtures), which would otherwise have to add the new field to compile. siteToTheme still always populates it, so readers are unaffected at runtime. Keeps the change purely additive for consumers like data-liberation-agent. * blocks-engine: never commit superpowers docs; ignore nested path The root .gitignore pattern 'docs/superpowers/' is anchored to the repo root, so it did not cover 'packages/blocks-engine/docs/superpowers/' — which let a design spec get committed by mistake. Switch to '**/docs/superpowers/' so the path is ignored at any depth, and remove the spec doc that should not have been committed. * blocks-engine: ignore docs/superpowers at any depth Root pattern 'docs/superpowers/' is anchored to the repo root and did not cover 'packages/blocks-engine/docs/superpowers/', which let a design spec get committed by mistake. Use '**/docs/superpowers/' so superpowers docs are ignored at any depth.
Summary
Introduces
php-transformeras the origin-clean PHP package for Blocks Engine transformation primitives. The package lives atphp-transformer/, publishesautomattic/blocks-engine-php-transformer, and uses theAutomattic\BlocksEngine\PhpTransformer\namespace.This PR establishes the reusable transformer layer for HTML, declared content formats, and generated website artifact bundles. It intentionally excludes product workflows such as importer UI, ZIP intake, theme activation, Studio orchestration, deployment behavior, and generation-loop policy.
Public API
Current public entrypoints:
Contract\TransformerResultfor the serializable result envelope.Contract\TransformationOptionsfor generic transform context, strict/fallback policy, and source provenance.HtmlToBlocks\HtmlTransformerfor supported HTML to parsed block arrays and serialized block markup.FormatBridge\FormatBridgeforhtml,markdown, and serializedblocksnormalization/conversion.FormatBridge\FormatAdapterInterfacefor package-level format extension.ArtifactCompiler\ArtifactCompilerfor generated website artifact bundle normalization.WordPress\Runtimefor WordPress calls that must work inside and outside WordPress.Other classes are implementation details unless the README explicitly marks them public or they are injected adapter contracts.
What Is Included
php-transformer/homeboy.jsonwith independent package version state inphp-transformer/VERSION.Release Direction
php-transformeris independently versioned from the repository container. Homeboy tracksphp-transformer/VERSION; Composer stays VCS/tag-driven and does not carry an explicitversionfield, socomposer validate --strictremains clean.Actual releases should run from the default branch after merge. A release dry-run from this draft branch reached Homeboy planning, then stopped on the default-branch preflight as expected for non-default release branches.
Migration Direction
Review this as a new standalone package, not as a renamed old repository. Existing HTML converter, format bridge, artifact compiler, and Static Site Importer paths are downstream consumers, wrappers, or migration evidence.
Reusable transformation behavior should move into
php-transformer. Existing repositories should become thin downstream entrypoints first, then be archived when public package names, functions, hooks, CLI commands, abilities, and product integrations no longer need compatibility surfaces. The intended completion criteria is that the old implementation repositories no longer carry canonical transformation logic;php-transformeris the canonical implementation.static-site-importershould remain a product/plugin consumer. It should consume transformer APIs through product-owned adapters rather than become part of this package.Verification
Latest verification from
php-transformer/passed:composer install --no-interactioncomposer validate --strictcomposer testcomposer run test:migration:examplescomposer run test:migration:legacy-paritygit diff --checkhomeboy component show php-transformerhomeboy release php-transformer --dry-run --skip-publish --no-github-releasereached release planning, then stopped on default-branch preflight from this draft branchOpt-in local migration parity with existing local old-repo paths also passed: 17 fixtures, 1 migration comparison, 16 explicit skips.
Remaining Follow-Ups
These should be smaller follow-up PRs after this foundation lands:
AI assistance