Make the rendered element tree match the source tree, and gate it
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 8/100
Research direction
This is a design proposal, so there is no single file to edit yet. Start by reading the linked issues #1454, #1483 and #1904, then the merged fixes listed in the table, to see how each divergence was repaired. The first useful contribution is the measurement the issue asks for: classifying root causes on other imported sites. Done means a decision on each core block's structure and an agreed scope for the CI topology check.
Written by the indexing model from the issue text.
Description
Problem
Imported author CSS is written against the source page's element tree. When the rendered tree differs from it, by an added, removed or wrapped element, author selectors stop matching where the author intended. Today each such difference is found as visual drift, traced by hand, and repaired with a selector rewrite or a compensating engine rule.
The nostar2.com parity loop (front end and editor) produced 17 merged fixes. In 12 of them the root cause was a difference between the source element tree and the rendered one:
| Divergence | Fixes |
|---|---|
Synthetic figure around a source image |
#2791, #2807, #2867 |
| Synthetic or kept-empty paragraphs | #2802, #2803, #2868 |
Wrapper links, neutral mark carriers, comment seams |
#2813, #2848, #2871 |
| Engine editor layer and core's editor transport wrapper | #2865, #2869, #2866 |
The other 5 had different causes: srcset selection (#2763), SVG currentColor (#2816), inline SVG geometry (#2817), embed height (#2819) and separator border (#2799).
Earlier work handled parts of this class one case at a time: #1454 (editor inner-blocks wrappers in CSS-owned layouts) and #1483 (editor presentation as a chain of symptom patches). Nothing currently states or checks the invariant itself.
Proposal
- Invariant. Every source element renders as exactly one element with the same tag and the same parent/child/sibling relationships, on the front end and in the editor canvas. Engine-added elements are either removed or declared as transparent to author CSS (for example
display:contentswith no box-forming styles). - Gate. Add a topology check to CI over a corpus of real captures. It records each source element, the matching front-end element and the matching editor element, then diffs the three trees: added, removed and re-parented elements, plus changed sibling indexes for
:nth-*/+/~selectors. Every difference is either declared (with its reason) or a failure. - Remove compensation. Once a divergence is gone or declared, delete the selector-rewriting and engine-support rules that existed only to cover it.
Expected result
- This class of parity bug fails in CI before an import, instead of surfacing as drift on a live site.
- Editor parity follows from the same contract as the front end, with no separate editor patch layer.
- Fewer selector rewrites and engine support rules.
Measurement before committing
- Classify the root causes of parity issues on other imported sites. One site (12 of 17) is not enough to justify an architecture change.
- List the places where core blocks force structure, for example
core/image→figureand RichText's padding and placeholders. For each, decide between a generated block that keeps the source tag (and accept the cost to editability) and a declared, CSS-transparent divergence. - Note: the wrapper count is mostly source structure, not engine additions (see #1904; every wrapper carries a
blocks-engine-source-div-*identity). This proposal targets parity, not nesting depth.
Found and reduced with Claude (Anthropic) in the Pi coding agent during the nostar2.com import parity loop.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 2
- Avg merge
- 8h 22m
- Merged PRs (30d)
- 659
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#2061 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#1701 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
-
Product-grid detection: facet-drawer heading becomes a product, names absorb whole card text, slugs drop accentsPossibly taken @chubes4 claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Automattic/blocks-engine#3185 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
needs-triage Platform(Default)
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Sync EN] Document Error thrown by shm_* functions on a detached segment (#5975)Possibly taken A pull request linked to this issue is open or already merged. Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100