feat(match): structural signatures + structure-aware matching (A1/A3/A12)#26
Merged
Merged
Conversation
…A12)
Match components by shape when text is scarce (TRACKER step 4.2):
- Parser emits a StructuralSignature per component — counts of tables, columns
(th), forms, inputs, buttons, links, images, headings, lists, and repeated
(.map) items — folding raw DOM tags and common design-system names
(<Table>, <TextField>, <IconButton>, …) into the same buckets.
- New matchComponents(graph, { terms?, structure? }) combines the rarity-
weighted text score (4.1) with a structure-descriptor fit into one ranking;
matchComponentsByText now wraps it. A vision-style descriptor ("a table with
four columns and a card grid") ranks the right component even with zero text.
Schema: ComponentNode.structure (StructuralSignature) + StructureDescriptor;
JSON schema regenerated. Eval GoldenQuery gains an optional `structure`.
Fixture a1-no-static-text (dashboard/form/gallery/list, no literals) matched
by structure alone. 36 core + 97 parser tests pass; eval green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Step 4.2 — Structural matching
Failure modes A1 / A3 / A12. Match components by shape when text is scarce or absent.
StructuralSignatureper component — counts of tables, columns (th), forms, inputs, buttons, links, images, headings, lists, andrepeated(.map) items — folding raw DOM tags and common design-system names (<Table>,<TextField>,<IconButton>, …) into the same buckets.matchComponents(graph, { terms?, structure? })combines the rarity-weighted text score (4.1) with a structure-descriptor fit into a single ranking;matchComponentsByTextnow wraps it. A vision-style descriptor — "a table with four columns and a card grid" — ranks the right component even with zero static text.Schema
ComponentNode.structure+StructureDescriptor; JSON schema regenerated. EvalGoldenQuerygains an optionalstructurefield.Eval
Fixture a1-no-static-text — a dashboard, form, gallery and list with no literals — each matched top-1 by structure alone (
{table, columns:4, cards:2}→ StatsDashboard;{form, inputs:2, buttons:1}→ LoginForm).Verification
pnpm eval: green, precision/recall 1.000, match accuracy 1.000.🤖 Generated with Claude Code