Merge block HTML and editor validation into a single validate_blocks tool - #3753
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing fd7069f vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
youknowriad
force-pushed
the
claude/ecstatic-lichterman-41813a
branch
from
June 10, 2026 14:21
8bba9fd to
1756d65
Compare
…tool Collapse validate_html_blocks and validate_and_fix_blocks into one tool so the common "valid by default" path costs a single agent turn instead of two. The static core/html policy check acts as a short-circuit gate: when it finds invalid blocks it returns only those and skips the live-editor round-trip; once it passes, editor validation runs and both reports are concatenated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The single-page-build-turn-cadence eval asserted on validate_html_blocks and validate_and_fix_blocks tool results, which no longer exist after the merge. Assert on the combined validate_blocks result instead: the core/html policy gate passed (no "blocks invalid" marker) and live-editor validation succeeded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
youknowriad
force-pushed
the
claude/ecstatic-lichterman-41813a
branch
from
June 11, 2026 09:58
00bb783 to
fd7069f
Compare
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
Authored end-to-end with Claude Code: consolidated the two validation tools, updated the system prompt and skills, migrated tests, and verified with lint, typecheck, and the tools test suite. Reviewers should sanity-check the gating logic in
apps/cli/ai/tools/validate-blocks.tsand the updated agent guidance.Proposed Changes
The agent previously had to call two separate tools to validate block content —
validate_html_blocks(a fast staticcore/htmlpolicy check) followed byvalidate_and_fix_blocks(live-editor validation that needs a running site). Since the overwhelmingly common case is content that's already valid, this cost two agent turns where one would do.This merges them into a single
validate_blockstool. The static HTML policy check runs first and acts as a short-circuit gate:core/htmlblocks, the tool returns only that report and skips live-editor validation entirely — so the agent rewrites those blocks before paying the expensive browser round-trip, exactly as before.User impact: fewer agent turns (and less waiting) on the happy path when generating site content, with no change to the gating behavior that keeps invalid HTML blocks from reaching the editor. One trade-off: the static HTML check is now fused with editor validation, so it requires a running site — in practice it always preceded editor validation anyway.
Testing Instructions
npm run cli:buildstudio codesession, generate or edit page/post block content and observe that a singlevalidate_blockscall replaces the previous two-call sequence.core/htmlblock (e.g. a<form>); confirm the tool reports the invalid HTML blocks and does not run editor validation until they're rewritten.filePathis passed.Automated:
npm test -- apps/cli/ai/tests/tools.test.ts(48 passing), plusnpm run typecheckandnpx eslint.Pre-merge Checklist