feat(relay,verify): verify_after_edit MCP tools with deterministic style deltas (RFC 0002) - #58
Merged
Merged
Conversation
…yle deltas (RFC 0002) Implements the post-edit verification loop the v3 annotation schema was built for. Two new MCP tools on the relay: - domscribe.verify.baseline — captures a pre-edit snapshot (RFC 0001 computed-style allowlist + bounding rect) of a rendered element over the existing WS context channel; baselines are in-memory and session-scoped (max 100, oldest evicted) - domscribe.verify.afterEdit — re-captures, computes per-property style deltas and geometry deltas, and returns a deterministic VerifyResult verdict (match/partial/no_change/regression) derived from optional declared expectedChanges; optionally appends to an annotation's verifyHistory Verdicts are deltas-first by design: computed-style deltas are exact, noise-free, and directly actionable, unlike pixel diffs or vision-model judgment. The pixelDiffRatio/screenshotRef path in the schema stays reserved for a future revision. - @domscribe/verify: new pure delta module (diffStyleMaps, diffBoundingRects, resolveVerdict) alongside the pixel comparator - @domscribe/relay: VerifyService, POST /v1/verify/baseline and /v1/verify/check routes, HTTP client methods, MCP tool registration - @domscribe/overlay: WS context responses now include the element's bounding rect - docs: reconstructed RFC 0002 (fixes the dead link from the sprint 3071 baseline doc); tool tables updated in root and mcp READMEs Degrades gracefully when runtime captureStyles is off: geometry-only change detection with an explanatory note and a hint to enable styles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QdBkwcY2Wx1KSCgPWV5xtS
|
View your CI Pipeline Execution ↗ for commit e366b69
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
…alls
npm install fails for the nuxt fixtures with an arborist crash
("Cannot read properties of null (reading 'edgesOut')" in #loadPeerSet)
that reproduces with a bare 'npm install nuxt' and no @domscribe
packages at all: nuxt -> @nuxt/devtools -> @vitejs/devtools@* resolves
to the new 0.4.x devtools family, whose peer topology triggers a known
npm arborist bug. Pre-existing on main; surfaced on this PR because CI
reinstalls fixtures on every run.
Pin @vitejs/devtools to ^0.3.0 via npm overrides in both nuxt fixtures
and the generator template until upstream npm/devtools resolve it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QdBkwcY2Wx1KSCgPWV5xtS
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.
Implements the post-edit verification loop that the v3 annotation schema (
verifyHistory,VerifyResult) was built for — the RFC 0002 Task B work the sprint 3071 baseline doc left open.What this adds
Two new MCP tools on the relay (14 total now):
domscribe.verify.baseline— called before an edit. Captures a snapshot of the target element from the live page over the existing WS context channel: the RFC 0001 computed-style allowlist plus the element's bounding rect. Returns abaselineId. Baselines are in-memory and session-scoped (max 100, oldest evicted).domscribe.verify.afterEdit— called after the edit + HMR. Re-captures, computes per-property style deltas and geometry deltas, and returns a deterministicVerifyResultverdict (match/partial/no_change/regression) derived from optional declaredexpectedChanges. Optionally appends the result to an annotation'sverifyHistory.Design: deltas first
The verdict is computed from computed-style and bounding-rect deltas, not pixel diffs: style deltas are exact, immune to anti-aliasing noise, and directly actionable in code (
padding: 8px → 12pxtells the agent what to fix). The verdict is intent-agnostic — the tool measures precisely; the calling agent judges whether a delta matches intent.pixelDiffRatio/screenshotRefstay reserved in the schema for a future element-scoped screenshot revision.Degrades gracefully when runtime
captureStylesis off: geometry-only change detection with an explanatory note and a hint (same pattern asquery.bySource).Changes by package
@domscribe/verify— new pure delta module:diffStyleMaps,diffBoundingRects(0.5 px epsilon),resolveVerdict, alongside the existing pixel comparator. Fully unit-tested.@domscribe/relay—VerifyService,POST /api/v1/verify/baseline+/api/v1/verify/checkroutes (house route-class pattern),RelayHttpClientmethods, two MCP tool classes registered in the adapter. Integration-style specs with real services and a mocked WS server, per relay convention.@domscribe/overlay— WScontext:responsenow includeselementInfo.boundingRect(serializedDOMRect).@domscribe/core—API_PATHS.VERIFY_BASELINE/VERIFY_CHECKconstants (schemas already existed at v3).docs/rfcs/0002-post-edit-verify-mcp-tool.md(fixes the dead link fromdocs/sprints/3071-rfc-0001-baseline.md); tool tables updated in the root and@domscribe/mcpREADMEs.Agent workflow
Testing
nx run-many -t lint test build typecheckgreen for all 15 projectsverifyHistoryappend and browser-disconnect paths), 11 MCP tool cases; adapter/tool-defs specs updated for the 14-tool surface🤖 Generated with Claude Code
https://claude.ai/code/session_01QdBkwcY2Wx1KSCgPWV5xtS
Generated by Claude Code