Automattic / Automattic/blocks-engine

Preserve div pseudo-form binding anchors in WordPress site plans

Open
#718 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
14
Forks
2
Avg merge
2h 10m
Merged PRs (30d)
561

Description

## Problem

A div-based pseudo-form can produce a valid `html_form_fallback` and generic form entity, but its binding points at synthesized readable block markup that is not present in the converted page. `WordPressSitePlan::assertEntityBindingsRemainPageOwned()` rejects the detached anchor, and `ArtifactCompiler` omits `source_reports.wordpress_site_plan` with `wordpress_site_plan_not_self_contained`.

This was discovered while verifying #700. Real `` elements are unaffected and remain the scope of #700.

## Reproduction

Compile an artifact containing a plain container with a data-entry control and submit-like button, for example:

```html


```

Inspect the result:

- `fallbacks[0].diagnostic_code` is `html_form_fallback`.
- The fallback has generic controls and a binding.
- `source_reports.wordpress_site_plan` is absent.
- Diagnostics include `wordpress_site_plan_not_self_contained` because the binding search markup is not in the canonical page markup.

## Root Cause

`captureDivBasedPseudoFormFallback()` passes a separately synthesized readable block to `formFallbackFinding()` without replacing or composing the actual converted subtree. The runtime declaration therefore references an anchor the page does not own.

## Acceptance Criteria

- Div pseudo-forms retain an exact page-owned binding anchor in canonical block markup.
- Artifact compilation emits a self-contained WordPress site plan.
- Generic form metadata, controls, and bounded control topology survive unchanged into `generic/forms/v1`.
- Existing real-form behavior and readable pseudo-form output remain unchanged.
- Contract coverage proves both the fallback and site-plan projection.

Contributor guide

Open the contributing guide

Research direction

Start with captureDivBasedPseudoFormFallback() and formFallbackFinding(), then trace WordPressSitePlan::assertEntityBindingsRemainPageOwned() and ArtifactCompiler. Reproduce the provided div pseudo-form and inspect the fallback, canonical block markup, binding, and source report. Done means the binding is page-owned, the site plan is emitted, generic form topology is preserved, and contract coverage proves both projections.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.