Skip to content

feat(cli): index component usage guidance, one tier below description - #5937

Open
josephfarina wants to merge 1 commit into
mainfrom
feat/search-guidance-tier
Open

feat(cli): index component usage guidance, one tier below description#5937
josephfarina wants to merge 1 commit into
mainfrom
feat/search-guidance-tier

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

Split out of #5320 at review request: the guidance indexing, on its own, with red→green evidence.

The gap

97 core components ship best-practice guidance and none of it was searchable. Banner describes itself as "a persistent message"; only its guidance says caution, problems, form errors. The reader's vocabulary lives in guidance, and search never read it.

Red → green, on the real registry

Each term appears only in that component's guidance — not its name, keywords, or description.

query before after
caution Banner absent Banner #5
problems Banner absent Banner #4
sources Blockquote absent Blockquote #6
attention Badge absent Badge #5

Why 45, and why below the token floor

Guidance scores 45, under description's 50, so a component that is the answer outranks one whose advice merely mentions the term — the ordering that put Toast behind Card, Dialog and Item on "notification".

It also sits deliberately below MIN_TOKEN_SCORE (50), so it never counts as a matched concept in a multi-word query. That is not a detail. I measured the alternative: dropping the floor to 45 moved nested menu from SideNav → List, and explain why a field is required from Field → TextInput — in both cases a component whose guidance happens to mention the other word displacing the one that is the answer. Breadth is not relevance, the same reason weakKeywords are capped.

With the floor left at 50, a 28-query sweep over realistic phrasings shows zero top-result changes and zero regressions, while every single-word gain above is kept.

Also

  • guidanceFrom handles the shape core actually ships — usage.bestPractices entries are {guidance, description} objects, not strings. features is absent from every core doc today; it is read if present.
  • Public response doc (search.doc.mjs) updated to describe the tier.
  • 7 new tests, including one that pins the floor so a future change cannot silently re-introduce the displacement.

Gates: check:repo green, lint:strict 0 errors, search + build suites 32/32. (typecheck:strict fails identically on main in an unbuilt worktree — it needs pnpm build first.)

97 core components ship best-practice guidance and none of it was searchable.
Banner describes itself as "a persistent message"; only its guidance says
caution, problems, form errors. Measured on the real registry, `caution`,
`problems`, `sources` and `attention` each now return the component whose
guidance defines them, and each returned nothing relevant before.

Guidance scores 45, below description's 50, so a component that IS the answer
outranks one whose advice merely mentions the term.

It sits below MIN_TOKEN_SCORE deliberately, so it never counts as a matched
concept in a multi-word query. Letting it count was measured moving `nested
menu` from SideNav to List and `explain why a field is required` from Field to
TextInput. With the floor at 50, a 28-query sweep shows zero top-result changes
and zero regressions, and the single-word gains are kept.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 2, 2026
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 2, 2026 9:55pm UTC

Request Review

josephfarina added a commit that referenced this pull request Sep 2, 2026
Review asked for the guidance indexing and the thin-kit hint as separate small
PRs. The hint is now #5938 and the guidance tier is #5937, so this branch keeps
only the coverage gate on the build pages group and the matchedTerms/queryTerms
plumbing that gate needs.

No behaviour change to the gate itself.
github-actions Bot added a commit that referenced this pull request Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant