Repository navigation
Reject inline content in synced pattern references - #124
Merged
Merged
Conversation
Merged
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.
Problem
A synced-pattern reference with nested blocks can pass Gutenberg validation, then lose those blocks during serialization. An agent can therefore receive a successful result after its content has been discarded. Closes #123.
Solution
Reject inline blocks or HTML inside
core/blockreferences before serialization.fixreturns a failure with the original input intact; conversion and assembly refuse to emit a lossy result. The shipped guide explains shared definitions, named instance overrides and explicit detachment.src/gate/patterns.ts,src/gate/validate.tssrc/gate/canonicalize.tssrc/convert/finalize.tsdev/test/gate.test.ts,skills/block-runner/references/GUIDE.mdDiff
+184 −8 · 9 files · no public API shape change
Testing & verification
Reviewed revision:
ead9d7cf738d35611a3bc843f6c10b7033da3e0c· Environment: Node 22.23.1, macOS, local WordPress 7.0.4, Chrome.npm run verify: dependency-engine, typecheck and authoring-hash checks passed; the test run passed 723 tests with 4 skipped and one missing-built-CLI failure. Afternpm run build, rerunning the release-receipt test passed, giving 724 passing tests across those runs.npm run build,npm run check:private,npm run pack:check: passed.npm run bench: all 63 deterministic fixture SCORE values unchanged against the pre-change run.validateandfixrejected malformed references;fix --outdid not create the output file, and the input remained unchanged.fix; Chrome showed both frontend values. Temporary fixtures were trashed.Not verified: direct rich-text override editing, WordPress 7.1 runtime behaviour, or a model benchmark. Offline validation does not verify that referenced patterns exist or that override names match the target definition.
Risk / rollout
Previously accepted malformed references now fail explicitly. Valid reference attributes remain permissive; there is no database migration or release in this PR.
Detection: regression tests assert refusal, input preservation and valid-reference compatibility. Rollback: revert the two commits; that restores the previous risk of silently discarded inline content and cannot recover content already lost by earlier versions.