Skip to content

feat(match): structural signatures + structure-aware matching (A1/A3/A12)#26

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-4/step-4.2-structural
Jul 14, 2026
Merged

feat(match): structural signatures + structure-aware matching (A1/A3/A12)#26
officialCodeWork merged 1 commit into
developmentfrom
build/phase-4/step-4.2-structural

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Step 4.2 — Structural matching

Failure modes A1 / A3 / A12. Match components by shape when text is scarce or absent.

  • The 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 a single 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 static text.

Schema

ComponentNode.structure + StructureDescriptor; JSON schema regenerated. Eval GoldenQuery gains an optional structure field.

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

  • 36 core + 97 parser tests pass (5 new structural tests).
  • pnpm eval: green, precision/recall 1.000, match accuracy 1.000.

🤖 Generated with Claude Code

…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>
@officialCodeWork
officialCodeWork merged commit ac665db into development Jul 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants