Automattic / Automattic/blocks-engine

Preserve canonical Gutenberg serialization for generated block attributes

Open
#1,586 1 comment 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 Static Site Importer acceptance investigation established that Gutenberg opens generated content as edited before a user change. The persisted block comment differs from Gutenberg's JavaScript `save()` serialization in attribute ordering and whitespace. PHP parse/serialize is structurally valid but is not a canonical replacement for the editor's serializer, so string-level normalization cannot prove or preserve a clean editor baseline.

## Scope

Provide the smallest generic Blocks Engine repair at the producer boundary so generated block markup is accepted by Gutenberg without an initial edit, while retaining normal text editing and serialization. The repair must use an appropriate native serialization API or generated representation that is canonical for Gutenberg rather than an importer-specific workaround.

## Evidence Required

- Reproduce on a fresh generated artifact in a real Gutenberg browser session.
- Compare parsed block attributes/edits and editor dirty state, not only serialized strings.
- Prove initial load is clean and a representative text edit marks the post dirty and persists correctly after save/reload.
- Add focused regression coverage at the owning layer.

## Boundaries

- No site-, fixture-, vendor-, route-, selector-, or Static Site Importer-specific behavior.
- Keep the fix compatible with the existing generated artifact contract and scoped to canonical serialization.
- Related acceptance investigation: Automattic/static-site-importer#1508. Form sizing is separately tracked in #1488.

## AI assistance disclosure

This issue was prepared with AI assistance: OpenAI GPT-5.6 Terra through OpenCode analyzed retained acceptance evidence and repository issue topology, and drafted the evidence requirements. Chris Huber authorized the tracker and directs the work.

Contributor guide

Open the contributing guide

Research direction

Begin by reproducing a fresh generated artifact in a real Gutenberg browser session. Compare parsed block attributes, editor edits, dirty state, and serialized output to identify the producer boundary and owning layer. Done means the initial load is clean, representative text edits persist correctly after save/reload, and focused regression coverage proves the canonical serialization behavior without importer-specific handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, content
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.