Repository navigation
Keep card and callout content through conversion and canonicalize - #3468
Merged
Merged
Conversation
A class-bearing card <div> converted to an empty core/group and was reported as success (#3458). The catalog's container converters (callout, details, media-text) built their inner markup by falling back to raw HTML when no catalog pattern matched inside. A container block saves only its inner blocks, so canonicalize's re-save of that group discarded the image, heading and text and was adopted as an info-level normalization. Container inner content is now always block markup: unmatched inner HTML becomes the same html-fallback island an unmatched top-level element gets. The callout group keeps the authored classes the site's CSS targets instead of replacing them with an is-style-<word> class no theme registers. Canonicalize gains one guard at the owning layer: when an invalid block's re-save would drop words or media sources it showed, the block is kept as written (serialize() emits an invalid block's original source, as the editor does until a person recovers it), listed in preservedBlocks, and reported as an invalid_block_preserved warning. The new content-preservation table converts the issue's cards and every compose fixture through convertReport on the real worker and checks the output keeps the input's words and media. It fails on trunk (16 of 30), with the catalog change reverted (13), with the guard disabled (3), and with raw inner HTML restored (12).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
Fixes #3458.
How AI was used
Claude (via the Pi coding agent in a Roadie session) traced the root cause, wrote the change and tests, and ran the verification below on the Lab runner. A Homeboy cook attempt stopped at promotion (homeboy#16453, fixed after the installed release), so this was finalized outside Homeboy with the operator's authorization.
Proposed Changes
catalog.tsrecurseInner). When no catalog pattern matches inside a callout, details or media-text, the inner HTML becomes the same html-fallback island an unmatched top-level element gets. It is no longer raw HTML, which the container's re-save discards.paw-card,notice callout). They are no longer replaced with anis-style-<word>class that no theme registers.wp/canonicalize.ts). If an invalid block's re-save would drop words or media sources it showed, the block is kept as written.serialize()emits an invalid block's original source, which is what the editor does until a person recovers it. The block is listed inFixResult.preservedBlocksand reported as aninvalid_block_preservedwarning, so the status issuccess_with_warnings.generic-callout,generic-details,generic-media-text,sample-callout-div) are updated. Each new expected output canonicalizes with no validation issues.Card contents now become a group containing an html island, not image/heading/paragraph blocks. Lowering the ordinary elements inside an island into real blocks belongs to the raw conversion path and is left for a follow-up. This PR removes the content loss.
Testing Instructions
src/__tests__/content-preservation.test.ts(20 tests) converts the issue's cards, a card grid, a callout, an accordion item and every compose fixture throughconvertReporton the real worker. It checks that the output keeps the input's words and media sources, and that none depend on the canonicalize guard. Guard cases cover a top-level group and a group nested in columns, plus a lossless invalid paragraph that is still fixed.Mutation check of the new tests plus the compose goldens (30 tests):
is-style-cardFull suite on Lab: 523 passed. 3 tests in 2 files fail identically on unmodified trunk in that checkout, because it has no
pnpm buildbundle and no php-transformervendor/(wp-runtime-bundle,associated-label-save-validity).Pre-merge Checklist