Skip to content

fix(cli): a docs namespace page's own text yields to the doc beneath it that answers the same word - #12336

Merged
josephfarina merged 5 commits into
mainfrom
josephfarina/search-namespace-page-yields
Nov 18, 2026
Merged

josephfarina merged 5 commits into
mainfrom
josephfarina/search-namespace-page-yields

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User impact

A docs namespace page, such as an overview that sums up its guides, sometimes ranked first in astryx search above the component, template, hook or guide the reader actually wanted. That happened most when the overview inlined its guides' core rules. Search indexed the page as one entry holding the union of its guides' words, so it covered more query words than any single specific entry. After this change, a query that names a component and a few words of the rules it follows lists that component first, not the overview that inlines those rules. The overview still answers to its own name, title, summary and declared keywords. Overview pages can now carry their guides' core rules inline without taking first place from the entries they summarize.

Problem and solution fit

  • Why does the overview win? Search scores a namespace page as one candidate whose text holds every rule its guides hold. Coverage of many query words lifts it into the every-word tier, above specific entries that answer fewer words but are the real answer.
  • Why does that harm the task? The reader's first result opens a summary instead of the component or guide that holds the rule, and the specific entry slips to second or third place.
  • Why does it matter? The docs are moving rules into overview pages to make first reads better, so the effect grows with every page that gets richer.

The fix reads the page at the reader's grain, the way search already reads a guide by its sections. A word the page's text shares with a doc beneath its route, which that doc answers at least as strongly, is that doc's evidence. The page does not answer that word through its text. The page keeps its own name, title, description and declared keywords, and any word only the page carries still matches it.

Expected behavior and authority

  • spec:AST-083 FR1: in search's reading of the catalog, another entry's text can be that entry's evidence. This change adds the namespace rule there.
  • spec:AST-046 FR10: search finds the smallest part that answers.

Smallest restoration

  • _named-keywords.mjs (searchView): each doc that opens a level holds the docs under its route (_summarizes) in search's view only.
  • _candidate-score.mjs (scoreCandidate): a hit from such a page's text is not taken when a doc beneath it answers the term at least as strongly. "Text" means its prose, or a code term or table cell its keywords gather.

The rule has no names and no constants; the bar is the page's own hit score. searchCore, which build reads, keeps the gathered reading, so build output does not move.

Evidence

  • Judged real search queries: +0.10 pts in a Core-only project and +0.09 pts with integrations; both confidence intervals lie above 0.
  • An overview page that inlines its guides' rules is not worse with the rule. Without the rule, that same text took first place from specific entries.
  • Unchanged paths: astryx docs reads and their typo forms, the typo grid, build output, cold-start entries, and lookups.
  • Regression test: search.summary-page.test.mjs (made-up names). The page loses a word its guide answers, and keeps words only it carries, its name and description, and a word the guide answers more weakly. A route that only starts the same is not beneath it. The gathered reading (searchCore and build) is unchanged.

Scope

Components: cli search (api/search), specs AST-083, AST-046

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run --project node packages/cli/api/search packages/cli/api/build packages/cli/api/docs
  • pnpm check:knowledge
  • Type declarations build during pnpm pack in packages/cli.

Writing rubric results

  • R1 narration: none; the AST-083 FR1 and AST-046 FR10 lines are present-tense statements of what search does.
  • R2 research: none in the record; measurements live in this description only.
  • R3 evidence: no evidence or verification cell changed; none names a change.
  • R4 rejected alternatives: none added.
  • R5 change references: none in the added lines.
  • R6 open questions: none touched.
  • R7 project status: none in the added lines. The check:knowledge advisories for AST-046 are on existing lines this change does not touch.

A doc that opens a level (a docs-tree namespace such as one that sums up
its guides) no longer answers a query word through its text when a doc
beneath its route answers that word at least as strongly: the word is that
doc's evidence. The page's prose and the code terms and table cells its
keywords gather are its text; its name, title, description and declared
keywords stay its own, and a word only the page carries still matches it.
So a rich overview page no longer takes first place from the components,
templates, hooks and guides it summarizes. This applies to search's own
reading of the catalog; searchCore, which build reads, keeps the gathered
reading.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): in astryx search, a docs page that opens a level of the docs tree, such as an overview that sums up its guides, no longer answers a query word through its own prose, code terms or table cells when a doc beneath its route answers that word at least as strongly; that doc is the word's evidence. The page's name, title, description and declared keywords stay its own, and a word only the page carries still matches it. This applies to search's own reading of the catalog; the reading build uses is unchanged. spec:AST-083 FR1 and spec:AST-046 FR10 describe this.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 2e3dc17

@vercel

vercel Bot commented Nov 17, 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 Nov 17, 2026 9:27pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 9:30 PM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · c0ad56e

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: one missing line in the release note blocks the required lint check.

  • .changeset/search-summary-page.md credits no contributor, so pnpm check:changesets fails the required lint check; add @josephfarina on its own line after the body, as the other changesets do.

The search rule itself matches the approved spec wording, and its new test fails before the change and passes after it. One optional cleanup: the file header of packages/cli/api/search/_named-keywords.mjs still describes only the rule for keywords that name another entry.

Claims and files checked

Review mode: full; reason: no-earlier-review

Claims:

  • Release note: a namespace page's text gives a word to a doc beneath it that answers the word at least as strongly. Verified: _candidate-score.mjs lines 279–313, test "does not answer a word through text a doc beneath it answers".
  • Release note: such a page no longer ranks above the entries it summarizes. Verified where a doc beneath carries the words, by the same test; no real namespace page in the catalog still outranks a component it names.
  • Release note: words only the page carries, and its name, title, description and declared keywords, still match. Verified: tests "answers a word only its own text carries" and "keeps its name and description".
  • Release note: build is unchanged. Verified: search.mjs lines 181–184, test "keeps every word in the gathered catalog", build suites pass.
  • Release note format. False: no contributor line, so check:changesets fails.
  • Description: the overview won through the union of its guides' words. Verified: before the change the new test's overview scores 153 for all three words.
  • Description: a doc that opens a level holds the docs under its route in search's view only. Verified: _named-keywords.mjs lines 148–173, test "leaves the gathered candidate as it is".
  • Description: the rule has no names or constants; the bar is the page's own hit score. Verified: answeredBelow in _candidate-score.mjs.
  • Description: a route that only starts the same is not beneath. Verified: _named-keywords.mjs line 154 and its test.
  • Description: judged-query gains, and unchanged docs reads, typo grid, build output, cold-start entries and lookups. Not re-measured here; consistent with the replay gate result and with the docs, build and search suites passing.
  • Description: the listed tests and the knowledge check pass. Verified: 681 search, build and docs tests pass; the knowledge check passes in CI.
  • Description: type declarations build during pack. Not run; the CLI's strict typecheck reports no error in the changed files.
  • Description: no internal context in public text; record lines are present tense with no project status. Verified.

Files:

  • .changeset/search-summary-page.md: finding (missing contributor line).
  • docs/specs/AST-046-docs-tree/spec.md: clear.
  • docs/specs/AST-083-result-order/spec.md: clear.
  • packages/cli/api/search/ORDERING.md: clear.
  • packages/cli/api/search/_candidate-score.mjs: clear.
  • packages/cli/api/search/_named-keywords.mjs: non-blocking note (file header).
  • packages/cli/api/search/search.summary-page.test.mjs: clear.

Automated review (maintainer link)

Comment thread .changeset/search-summary-page.md Resolved
* @param {import('./_lexical.mjs').Candidate[]} all
* @returns {import('./_lexical.mjs').Candidate[]}
*/
function withSummarized(all) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the @file header (lines 3–22) still says this module only leaves out keywords that name another entry, and @output says the catalog comes back with only those keywords dropped. searchView now also gives namespace docs _summarizes; one sentence in @file and @output keeps the header accurate.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 514b3bf

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the CI run on this head was cancelled because CI had no room, so the required build and test checks have not run yet; re-run it.

The earlier blocker is fixed: the changeset now credits its contributor, and check:changesets and the lint check pass. The search rule matches the approved spec wording, and its new test fails before the change and passes after it. One optional cleanup remains: the file header of packages/cli/api/search/_named-keywords.mjs still describes only the rule for keywords that name another entry.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Release note: a namespace page's text gives a word to a doc beneath it that answers the word at least as strongly. Verified: _candidate-score.mjs lines 279–313, test "does not answer a word through text a doc beneath it answers".
  • Release note: such a page no longer ranks above the entries it summarizes. Verified where the docs beneath carry the words: the same test, and real queries such as layout idea content, which now lead with the Layout component.
  • Release note: words only the page carries, and its name, title, description and declared keywords, still match. Verified: tests "answers a word only its own text carries" and "keeps its name and description".
  • Release note: build is unchanged. Verified: search.mjs lines 181–184, test "keeps every word in the gathered catalog", build suites pass.
  • Release note format (tag, bump, contributor). Verified: check:changesets passes.
  • Description: the overview won through the union of its guides' words. Verified: before the change the new test's overview scores 153 for all three words.
  • Description: a doc that opens a level holds the docs under its route in search's view only. Verified: _named-keywords.mjs lines 148–173, test "leaves the gathered candidate as it is".
  • Description: the rule has no names or constants; the bar is the page's own hit score. Verified: answeredBelow in _candidate-score.mjs.
  • Description: a route that only starts the same is not beneath, and a word the guide answers more weakly stays the page's. Verified: _named-keywords.mjs line 154 and the two matching tests.
  • Description: judged-query gains in both test projects, and unchanged docs reads, typo grid, build output, cold-start entries and lookups. Verified as reported: the replay gate result on this head agrees, and the docs, build and search suites pass; the figures were not re-measured.
  • Description: the listed tests and the knowledge check pass. Verified: 681 search, build and docs tests and the knowledge check pass on this head.
  • Description: type declarations build during pack. Not run; the CLI's strict typecheck reports no error in the changed files.
  • Description: no new public API, no internal context in public text, and record lines in present tense with no project status. Verified.

Files:

  • .changeset/search-summary-page.md: clear (contributor line added).
  • docs/specs/AST-046-docs-tree/spec.md: clear.
  • docs/specs/AST-083-result-order/spec.md: clear.
  • packages/cli/api/search/ORDERING.md: clear.
  • packages/cli/api/search/_candidate-score.mjs: clear.
  • packages/cli/api/search/_named-keywords.mjs: non-blocking note (file header).
  • packages/cli/api/search/search.summary-page.test.mjs: clear.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1e54462

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not finished on this head yet.

The new commit updates three search goldens, and each changes only its match count, to the value the namespace-page rule gives on current main; the search code, spec wording, test and release note are unchanged since the last approval. One optional cleanup remains: the file header of packages/cli/api/search/_named-keywords.mjs still describes only the rule for keywords that name another entry.

Claims and files checked

Review mode: incremental; reason: none

Claims:

  • Release note: a namespace page's text gives a word to a doc beneath it that answers the word at least as strongly. Verified: _candidate-score.mjs lines 279–313, test "does not answer a word through text a doc beneath it answers".
  • Release note: such a page no longer ranks above the entries it summarizes. Verified where the docs beneath carry the words: the same test, and real queries such as layout idea content, which now lead with the Layout component.
  • Release note: words only the page carries, and its name, title, description and declared keywords, still match. Verified: tests "answers a word only its own text carries" and "keeps its name and description".
  • Release note: build is unchanged. Verified: test "keeps every word in the gathered catalog, as searchCore and build read it" and the build suites.
  • Release note format (tag, bump, contributor). Verified: check:changesets passes.
  • The other five release notes in GitHub's file list belong to commits already on main that the merge brought in; they are not part of this pull request.
  • Description: the overview won through the union of its guides' words. Verified: without the change the test's overview scores 153 for the three-word query.
  • Description: a doc that opens a level holds the docs under its route in search's view only. Verified: _named-keywords.mjs lines 136–173 and 201–208, test "leaves the gathered candidate as it is".
  • Description: a hit from such a page's text (its prose, or a code term or table cell its keywords gather) is not taken when a doc beneath it answers the word at least as strongly. Verified: _candidate-score.mjs lines 306, 407–408, 493 and 504.
  • Description: the rule has no names or constants; the bar is the page's own hit score. Verified: answeredBelow in _candidate-score.mjs.
  • Description: a route that only starts the same is not beneath, and a word the guide answers more weakly stays the page's. Verified: the two matching tests.
  • Description: searchCore, which build reads, keeps the gathered reading, so build output does not move. Verified: the gathered-catalog test and the build suites.
  • Description: judged-query gains in both test projects, and an overview that inlines its guides' rules is not worse with the rule. Verified as reported; not re-measured.
  • Description: docs reads and their typo forms, the typo grid, build output, cold-start entries and lookups are unchanged. Verified as far as the docs, build and search suites reach; not re-measured.
  • Description: the listed tests and the knowledge check pass. Verified: 756 search, build, docs and golden tests and the knowledge check pass on this head.
  • Description: type declarations build during pack in packages/cli. Verified: pnpm pack there syncs the declarations, the two changed search modules included.
  • Description: one defect, no tagalong, no new public API, no internal context in public text, and record lines in present tense with no project status. Verified.

Files:

  • .changeset/search-summary-page.md: clear.
  • docs/specs/AST-046-docs-tree/spec.md: clear.
  • docs/specs/AST-083-result-order/spec.md: clear.
  • packages/cli/api/search/ORDERING.md: clear.
  • packages/cli/api/search/_candidate-score.mjs: clear.
  • packages/cli/api/search/_named-keywords.mjs: non-blocking note (file header).
  • packages/cli/api/search/search.summary-page.test.mjs: clear.
  • packages/cli/test/__golden__/no-icon-set/search-icon.json and search-icon.txt: clear (match count 234 to 233).
  • packages/cli/test/__golden__/no-icon-set/search-icon-set.json and search-icon-set.txt: clear (399 to 397).
  • packages/cli/test/__golden__/no-icon-set/search-search.json and search-search.txt: clear (118 to 115).
  • The other 68 files GitHub lists come from seven commits already on main that the merge brought in: not part of this pull request.

Automated review (maintainer link)

# Conflicts:
#	packages/cli/test/__golden__/no-icon-set/search-icon.json
#	packages/cli/test/__golden__/no-icon-set/search-icon.txt
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c0ad56e

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the CI run on this head stopped because CI had no room, so the required build and test checks have not run yet; re-run CI before merging.

The merge of main only moves the icon search goldens' match count to the value the namespace-page rule gives on current main; the search code, spec wording, test and release note are unchanged. The new test fails without the change and passes with it, and the search, build and docs suites pass.

  • Non-blocking: the @file and @output header of packages/cli/api/search/_named-keywords.mjs (lines 3–22) still describes only the keyword rule; one sentence about the docs a namespace page now holds keeps it accurate.
Claims and files checked

Review mode: full; reason: merge-touches-pr-files

  • Claim (release note): a namespace page's text no longer answers a word that a doc beneath it answers at least as strongly. Verified: _candidate-score.mjs:306; new test case 1 fails on main and passes here.
  • Claim (release note): words only the page carries, and its name, title, description and declared keywords, still match it. Verified: _candidate-score.mjs:154-167; test cases 3 and 4.
  • Claim (release note): build is unchanged. Verified: search.mjs:181-184 reads the gathered catalog without the rule; test case 2; build suites pass.
  • Claim (release note): an overview no longer ranks above the entries it sums up. Verified for words a doc beneath answers: layout idea content now leads with the Layout component, and the page keeps its own name as the next sentence says.
  • Claim (description): an overview could rank first above the entry the reader wanted. Verified on main: the layout namespace (155) led the Layout component (122).
  • Claim (description): a query naming a component and words of its rules lists that component first. Verified: Layout leads layout idea content, and CalendarShowcase leads calendars astryx change.
  • Claim (description): judged-query gains of +0.10 and +0.09 points. Not re-run: the evaluation sets are not in the repository.
  • Claim (description): docs reads, typo forms, build output and lookups are unchanged. Verified: the search, build and docs suites pass (689 tests).
  • Claim (description): the regression test covers a lost word, words only the page carries, its name and description, a weaker answer below, and a route that only starts the same. Verified: search.summary-page.test.mjs, seven cases.
  • Claim (description): the listed checks pass and type declarations build. Verified: knowledge check aligned, changeset check valid, declarations sync.
  • Claim (description): no new public API. Verified: no export, signature, command or option changes.
  • Claim (description): public text carries no internal context. Verified.
  • File .changeset/search-summary-page.md: clear.
  • File docs/specs/AST-046-docs-tree/spec.md: clear (owner-approved amendment).
  • File docs/specs/AST-083-result-order/spec.md: clear (owner-approved amendment).
  • File packages/cli/api/search/ORDERING.md: clear.
  • File packages/cli/api/search/_candidate-score.mjs: clear.
  • File packages/cli/api/search/_named-keywords.mjs: non-blocking header note.
  • File packages/cli/api/search/search.summary-page.test.mjs: clear.
  • Files packages/cli/test/__golden__/no-icon-set/search-icon-set.json, search-icon-set.txt, search-icon.json, search-icon.txt, search-search.json, search-search.txt: clear (only the match count changes, to the value current main gives).

Automated review (maintainer link)

@josephfarina josephfarina reopened this Nov 18, 2026
@josephfarina
josephfarina merged commit d5b8417 into main Nov 18, 2026
133 of 139 checks passed
@github-actions
github-actions Bot deleted the josephfarina/search-namespace-page-yields branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — c0ad56eb Deployed Nov 17, 2026 by vercel[bot]
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