Repository navigation
Conversation
…the agent to validate it wp_cli post create and post update check block content in the site's block editor before saving it, inline or from a file: lossless re-serializations are kept and shown as a diff, and content the editor rejects is not saved. Studio Code's Write and Edit run the same check on a Studio site's theme templates and parts, which are live as soon as they are written. Studio Code no longer has a validate_blocks tool, and the prompt rule and skill steps that told it to call one are gone. MCP clients keep validate_blocks for theme files written with their own tools; wp_cli checks their post content too. The page-content recipe saves its scratch file with post update <id> <file> instead of wp_cli eval.
1 task done
Contributor
Author
|
Closing to focus on #5146 |
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
How AI was used in this PR
Claude (via the Pi coding agent in a Roadie session) wrote the change and the tests, and ran the evaluation below. I reviewed the diff and the eval runs.
Proposed Changes
Block content had to pass
validate_blocksbefore reaching a site, and the agent was told so in a general rule ("MUST pass validate_blocks… Never apply unvalidated block content") and in five skills. The check is deterministic; only remembering to call it was not. Now the content is checked where it is saved:wp_cli post createandpost updatecheck block content in the site's block editor before saving it, inline (--post_content=) or from a file. Re-serializations the editor makes without loss are kept and shown as a diff; content the editor rejects is not saved, and the result lists why.templates/*.htmlandparts/*.html, which are live as soon as they are written.validate_blockstool. The general rule and the skill steps that told the agent to call it are gone; theblock-contentskill states how content is checked instead.wp_cli post update <id> tmp/page-<slug>.htmlinstead of awp_cli evalimport, so the save goes through the check.validate_blocks, now only for theme files they write with their own file tools (Studio cannot see those writes). Their post content goes throughwp_cliand is checked too.block-check.tsholds the one check all three use.Testing Instructions
npx vitest run apps/cli/ai: new tests cover content the editor rejects (nothing saved), lossless fixes kept inline and in files, commands without block content left unchecked, and templates/parts checked only on Studio sites.f142df336) and this branch, 3 runs each, judged by the suite's outcome checks (siteWorksincludes zero invalid blocks in the site's own editor):validate_blockscallspost create/updatetime, medianTrunk's one failure was the hero case's style check (
.eyebrowgiven an inline display), not block validity. In one branch run the check refused apost updatewhose paragraph held a nested<p>; the agent fixed the markup and saved it. The branch's token total comes mostly from two long runs: one spent its extra calls on a 404 after the agent saved the page with--post_status=published, the other on that refusal and on an invalid_wp_page_templatevalue. With three runs per case the token difference is within run-to-run variance (trunk's own runs on the hero case range 525k–906k).Pre-merge Checklist