Repository navigation
fix(cli): a docs namespace page's own text yields to the doc beneath it that answers the same word - #12336
Conversation
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.
|
Owner decision (engineering owner, covering this pull request): in |
|
/approve-spec 2e3dc17 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: one missing line in the release note blocks the required lint check.
.changeset/search-summary-page.mdcredits no contributor, sopnpm check:changesetsfails the requiredlintcheck; add@josephfarinaon 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.mjslines 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:
buildis unchanged. Verified:search.mjslines 181–184, test "keeps every word in the gathered catalog", build suites pass. - Release note format. False: no contributor line, so
check:changesetsfails. - 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.mjslines 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:
answeredBelowin_candidate-score.mjs. - Description: a route that only starts the same is not beneath. Verified:
_named-keywords.mjsline 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.
| * @param {import('./_lexical.mjs').Candidate[]} all | ||
| * @returns {import('./_lexical.mjs').Candidate[]} | ||
| */ | ||
| function withSummarized(all) { |
There was a problem hiding this comment.
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.
|
/approve-spec 514b3bf |
There was a problem hiding this comment.
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.mjslines 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 theLayoutcomponent. - 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:
buildis unchanged. Verified:search.mjslines 181–184, test "keeps every word in the gathered catalog", build suites pass. - Release note format (tag, bump, contributor). Verified:
check:changesetspasses. - 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.mjslines 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:
answeredBelowin_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.mjsline 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.
|
/approve-spec 1e54462 |
There was a problem hiding this comment.
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.mjslines 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 theLayoutcomponent. - 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:
buildis 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:changesetspasses. - The other five release notes in GitHub's file list belong to commits already on
mainthat 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.mjslines 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.mjslines 306, 407–408, 493 and 504. - Description: the rule has no names or constants; the bar is the page's own hit score. Verified:
answeredBelowin_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 packthere 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.jsonandsearch-icon.txt: clear (match count 234 to 233).packages/cli/test/__golden__/no-icon-set/search-icon-set.jsonandsearch-icon-set.txt: clear (399 to 397).packages/cli/test/__golden__/no-icon-set/search-search.jsonandsearch-search.txt: clear (118 to 115).- The other 68 files GitHub lists come from seven commits already on
mainthat the merge brought in: not part of this pull request.
# Conflicts: # packages/cli/test/__golden__/no-icon-set/search-icon.json # packages/cli/test/__golden__/no-icon-set/search-icon.txt
|
/approve-spec c0ad56e |
There was a problem hiding this comment.
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
@fileand@outputheader ofpackages/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 onmainand 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):
buildis unchanged. Verified:search.mjs:181-184reads 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 contentnow leads with theLayoutcomponent, 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: thelayoutnamespace (155) led theLayoutcomponent (122). - Claim (description): a query naming a component and words of its rules lists that component first. Verified:
Layoutleadslayout idea content, andCalendarShowcaseleadscalendars 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 currentmaingives).
User impact
A docs namespace page, such as an overview that sums up its guides, sometimes ranked first in
astryx searchabove 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
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-083FR1: 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-046FR10: 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
astryx docsreads and their typo forms, the typo grid, build output, cold-start entries, and lookups.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-046Testing
pnpm vitest run --project node packages/cli/api/search packages/cli/api/build packages/cli/api/docspnpm check:knowledgepnpm packinpackages/cli.Writing rubric results
check:knowledgeadvisories for AST-046 are on existing lines this change does not touch.