Skip to content

docs(core): Text's as and PowerSearch's statusVariant list every value their types allow - #12403

Closed
josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl-doc-prop-unions
Closed

josephfarina wants to merge 3 commits into
mainfrom
josephfarina/rl-doc-prop-unions

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Reader impact

People and agents read a component's prop values from its docs (astryx component <Name> prints the doc's type), and tools check a page's values against them. Two docs listed fewer values than the prop's type allows, so readers were told a valid value is wrong:

  • Text's as listed span, p, div and label, while Text also renders h1, h2 and h3.
  • PowerSearch's statusVariant listed attached and detached, while it also takes tooltip.

Source of truth

The prop types in packages/core/src (Text.tsx, PowerSearch.tsx through FieldStatusPlacement). Docs follow the types.

Correction

  • Docs follow the types: Text as lists 'h1' | 'h2' | 'h3'; PowerSearch statusVariant lists 'tooltip' (English and Chinese, and its compact line), and its text says what PowerSearch shows for it: the message is not shown on screen, screen readers still announce it, and the border still shows the status type.
  • Core's docs test now also compares the Chinese tables' types with the code (87 tables, 935 types judged; types only, as translations may cover some props).
  • Two entries leave the known-drift list (Text as, PowerSearch statusVariant); the list only shrinks.

Evidence

  • With Text as and PowerSearch's Chinese statusVariant broken again, both prop-docs tests fail on exactly those.

Scope

Components: Text, PowerSearch

  • This PR changes documentation only, or names every necessary generated artifact.
  • Runtime, API, visual, and policy changes were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • packages/cli/test/core-prop-docs.test.mjs (2 tests); Core's PowerSearch, Text and doc-shape tests (27 files, 909 tests).
  • Prettier; pnpm check:knowledge.

A new Core test reads each prop type with the TypeScript checker and fails
when a documented closed string union differs from it. Docs follow the
types: Text `as` now lists h1, h2 and h3; PowerSearch `statusVariant`
lists tooltip (en and zh).
@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 10:13pm UTC

Request Review

@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, 10:28 PM UTC

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

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · fafebbd

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: the Text as and PowerSearch statusVariant doc unions now match their types, but four things need fixing first.

  • packages/cli/test/core-prop-docs.test.mjs fails on this head because packages/cli/test/core-prop-docs.known-drift.json still lists the two drifts this pull request fixes (lines 28 and 52), so delete those two lines.
  • The new PowerSearch statusVariant text (PowerSearch.doc.mjs lines 106, 415 and 566, and the JSDoc at PowerSearch.tsx:382) says tooltip shows the message on a status icon, but PowerSearch renders no status icon, so with tooltip the message is not shown at all; describe what PowerSearch actually does instead.
  • docPropUnions.test.ts re-implements the doc-versus-type comparison that comparePropDocs in packages/cli/foundation/discovery/prop-drift.mjs already runs over Core's docs, and the two already disagree (for example on FieldStatus.variant), so extend the shared check (Chinese tables, a deprecated-member allowance) and drop the new guard, or explain in the description why the shared check cannot serve.
  • The description says the guard checks 464 closed-union doc props, but at this head it reads 465 (317 English, 148 Chinese) across 129 components.

The red-first evidence for the two union fixes holds: run against the old docs, the new test fails on exactly Text as and PowerSearch statusVariant in both languages.

Claims and files checked

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

  • Claim: astryx component prints each doc prop's type — verified (CLI output at base and head).
  • Claim: Text's as docs omitted h1–h3, which Text renders — verified (Text.tsx:164).
  • Claim: PowerSearch's statusVariant docs omitted tooltip, which its type accepts and every other field control documents — verified (fieldStatusPlacement.ts:18; the other field-control docs list it).
  • Claim: the prop types are the source of truth and docs follow them — verified against the public component API record.
  • Claim: Text lists seven values; PowerSearch's English, Chinese and compact docs and its JSDoc list tooltip — verified in the diff; the tooltip wording itself is false (finding above).
  • Claim: the guard compares every closed string-union doc prop with the checker's type, resolving inline unions, aliases and keyof maps, and lets deprecated values go undocumented — verified (test code and its self-tests).
  • Claim: 464 doc props across 129 components — false: 465 across 129.
  • Claim: with the doc fixes reverted it fails on exactly those two props, both languages — verified (red-first run).
  • Claim: its own tests cover a dropped value, an extra value, an open type and a deprecated value — verified.
  • Claim: it runs in 2.7 s — consistent (about 2.4 s of import and tests here).
  • Claim: scope is Text and PowerSearch — verified.
  • Claim: documentation only, or every necessary generated artifact named — false: the CLI known-drift list must change too.
  • Claim: no runtime, API, visual or policy change — verified (built API surface unchanged).
  • Claim: no internal context in public text — verified.
  • Claim: tests, typecheck, knowledge check, Prettier and ESLint pass — typecheck, knowledge check, Prettier and ESLint verified; the Core test subset passes, but the CLI's Core prop-docs test fails.
  • Changeset: Text and PowerSearch docs list the values their types allow — verified.
  • Changeset: a new test fails when a documented string union differs from its prop type — verified for closed string unions, with deprecated values exempt.
  • File .changeset/doc-prop-unions-match-types.md — clear.
  • File packages/core/src/PowerSearch/PowerSearch.doc.mjs — finding (tooltip wording).
  • File packages/core/src/PowerSearch/PowerSearch.tsx — finding (tooltip JSDoc line).
  • File packages/core/src/Text/Text.doc.mjs — clear on its own; with the PowerSearch fix it needs the known-drift list updated (finding).
  • File packages/core/src/docPropUnions.test.ts — findings (duplicates the shared check; description count).

Automated review (maintainer link)

Comment thread packages/core/src/Text/Text.doc.mjs Resolved
Comment thread packages/core/src/docPropUnions.test.ts Resolved
Drop the separate Core union guard. The shared prop-drift check now lets a
doc leave out a string value the code deprecates everywhere the type takes
it from, the Core docs test also compares the Chinese tables' types, and
the known-drift list loses the three entries this change fixes. PowerSearch
says what tooltip shows.
@josephfarina josephfarina changed the title docs(core): Text's as and PowerSearch's statusVariant list every value their types allow, and a test keeps doc unions equal to the types docs(core): Text's as and PowerSearch's statusVariant list every value their types allow, judged by the one shared doc-versus-type check Nov 17, 2026

@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: the Text as and PowerSearch statusVariant doc fixes, the Chinese-table check and the move to one shared checker look right, and the four points from the earlier review are fixed, but two things need fixing first.

  • deprecatedLiterals in packages/cli/foundation/discovery/prop-drift.mjs (lines 931-971) reads only unions, literals, keyof and alias references without type arguments, so a literal that a current source gives through a generic type such as Exclude<All, 'xs'> or an indexed access such as Base['size'] is still treated as deprecated-only and astryx doctor integration components accepts a doc that leaves that current value out; please add the string-literal parts of any type node the walk does not read to the current set, and test both shapes.
  • The description ticks "Runtime, API, visual, and policy changes were removed or split", but the pull request still changes the comparison astryx doctor integration components runs, so please untick that box or move the allowance into its own pull request.

The allowance can also move to a separate CLI pull request: the Text and PowerSearch fixes pass without it, with FieldStatus variant left in the known-drift list.

Claims and files checked

Review mode: full; reason: over-500-lines

  • Claim: astryx component <Name> prints the doc's type — verified (CLI output in both trees).
  • Claim: Text's as docs left out h1–h3, which Text renders — verified (Text.tsx:164).
  • Claim: PowerSearch's statusVariant docs left out tooltip, which its type takes — verified (fieldStatusPlacement.ts:18).
  • Claim: the prop types are the source of truth, and docs follow them — verified against the Text record's element list and the public component API record.
  • Claim: Text as now lists h1–h3 — verified (Text.doc.mjs:99).
  • Claim: PowerSearch statusVariant lists tooltip in English, Chinese and the dense line, and says the message is not shown, is still announced, and the border keeps the status — verified (PowerSearch.doc.mjs:104-106, :413-415, :565-566; Field.tsx:276-291; PowerSearch.tsx:1546; Tokenizer.tsx:1990).
  • Claim: Core keeps one doc-versus-type checker, the shared one the doctor also runs — verified (the second checker is deleted; the integration adapter calls comparePropDocs).
  • Claim: a doc may leave out a value deprecated in every source, so FieldStatus variant is no longer drift — verified (the base check reports it; the head check does not).
  • Claim: a value any current source gives stays required — false for current sources written as generic or indexed-access types (finding).
  • Claim: Core's prop-docs test compares the Chinese tables' types — verified (core-prop-docs.test.mjs:88-108).
  • Claim: three entries leave the known-drift list, which only shrinks — verified.
  • Claim: 183 English tables (1,951 types) and 87 Chinese tables (935 types) are judged — verified.
  • Claim: with Text as and PowerSearch's Chinese statusVariant broken again, both prop-docs tests fail on exactly those — verified (red-first run).
  • Claim: prop-drift.test.mjs covers a value deprecated everywhere and one a current source gives — verified for a union-member source only.
  • Claim: scope is Text, PowerSearch, FieldStatus docs and the CLI's shared check — verified.
  • Claim (unticked box): not documentation-only, since the shared check changes — verified.
  • Claim (ticked box): runtime, API, visual and policy changes were removed or split — false (finding).
  • Claim (ticked box): public text and artifacts hold no internal context — verified (added lines, title, body, branch and commit messages).
  • Claim: the CLI discovery, doc-compiler, docs, integration and Core prop-docs tests pass (87 files, 1,727 tests) — consistent: the discovery, integration, doctor-integration and prop-docs tests plus Core's PowerSearch, Text and doc-shape tests pass (109 files, 2,731 tests); the exact set was not reproduced.
  • Claim: Core's PowerSearch and doc-shape tests, the knowledge check and Prettier pass — verified.
  • Changeset: Text as lists h1–h3 and PowerSearch statusVariant lists tooltip, with text saying what PowerSearch shows — verified.
  • Changeset: the doctor no longer reports a union that leaves out a value deprecated in every source — verified; it also stops reporting some current values (finding).
  • Title: both props list every value their types allow, judged by one shared check — verified.
  • File .changeset/doc-prop-unions-match-types.md — clear.
  • File packages/cli/assets/docs/tree/check-the-props.doc.mjs — clear (states the rule the code must meet).
  • File packages/cli/foundation/discovery/prop-drift.mjs — finding (generic and indexed-access sources).
  • File packages/cli/foundation/discovery/prop-drift.test.mjs — clear; needs the two repro shapes with the fix.
  • File packages/cli/test/core-prop-docs.known-drift.json — clear.
  • File packages/cli/test/core-prop-docs.test.mjs — clear.
  • File packages/core/src/PowerSearch/PowerSearch.doc.mjs — clear.
  • File packages/core/src/PowerSearch/PowerSearch.tsx — clear.
  • File packages/core/src/Text/Text.doc.mjs — clear.

Automated review (maintainer link)

The deprecated-value allowance for the shared prop check moves to its own
change, so FieldStatus variant stays on the known-drift list here.
@josephfarina josephfarina changed the title docs(core): Text's as and PowerSearch's statusVariant list every value their types allow, judged by the one shared doc-versus-type check docs(core): Text's as and PowerSearch's statusVariant list every value their types allow Nov 17, 2026

@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 run on this head yet, because the CI run found no free capacity and was cancelled; re-run all CI jobs so the required checks run before merge.

The Text as and PowerSearch statusVariant docs now list every value their types accept, the tooltip text matches what PowerSearch shows, and the new check holds the Chinese tables' types to the code through the shared comparison. The points from the earlier reviews are resolved: the separate checker is gone, the deprecated-value allowance moved to its own change, and the fixed entries left the known-drift list.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: astryx component <Name> prints the doc's type — verified (CLI output on base and head).
  • Claim: Text's as docs left out h1–h3, which Text renders — verified (Text.tsx:164).
  • Claim: PowerSearch's statusVariant docs left out tooltip, which its type takes — verified (fieldStatusPlacement.ts:18, PowerSearch.tsx:386).
  • Claim: the prop types are the source of truth and docs follow them — verified against the Text and PowerSearch records.
  • Claim: Text as lists h1–h3; PowerSearch lists tooltip in English, Chinese and the compact line, and says the message is not shown, is announced, and the border keeps the status type — verified (Text.doc.mjs:99; PowerSearch.doc.mjs:104-106, :413-415, :566; Field.tsx:271-281; Tokenizer.tsx:2249).
  • Claim: Core's docs test compares the Chinese tables' types (87 tables, 935 types) — verified (core-prop-docs.test.mjs:88-108, counts measured).
  • Claim: two entries leave the known-drift list, which only shrinks — verified.
  • Claim: breaking Text as or PowerSearch's Chinese statusVariant again fails both tests on exactly those — verified.
  • Claim: scope is Text and PowerSearch — verified.
  • Claim (box): documentation only, or every generated artifact named — verified (the other files are the docs test and its list; no generated file holds the old text).
  • Claim (box): runtime, API, visual and policy changes removed or split — verified (built API surface unchanged).
  • Claim (box): no internal context in public text — verified (added lines, commits, title, body, branch).
  • Claim: core-prop-docs.test.mjs passes (2 tests) — verified.
  • Claim: Core's PowerSearch, Text and doc-shape tests pass (27 files, 909 tests) — verified.
  • Claim: Prettier and the knowledge check pass — verified.
  • Changeset: Text as lists h1–h3, PowerSearch statusVariant lists tooltip, and the tooltip text says what PowerSearch shows — verified.
  • Title: both props list every value their types allow — verified.
  • File .changeset/doc-prop-unions-match-types.md — clear.
  • File packages/cli/test/core-prop-docs.known-drift.json — clear.
  • File packages/cli/test/core-prop-docs.test.mjs — clear.
  • File packages/core/src/PowerSearch/PowerSearch.doc.mjs — clear.
  • File packages/core/src/PowerSearch/PowerSearch.tsx — clear.
  • File packages/core/src/Text/Text.doc.mjs — clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12072 fix(templates): payment form and checkout wrap the summary below the form on a narrow first paint
  Author: Joey Farina <[email protected]>
- #12274 fix(core): cap the Selector family's trigger-width list minimum at the viewport
  Author: josephfarina <[email protected]>
- #12215 fix(cli): advise keeping one dependency when two packages declare one provider ID
  Author: Joey <[email protected]>
- #12322 [experimental] export --reverse: use the project's own copy of an aliased file, or restore the page's copy with its paths entry
  Author: josephfarina <[email protected]>
- #12403 docs(core): Text's as and PowerSearch's statusVariant list every value their types allow
  Author: Joey Farina <[email protected]>
- #12494 fix(templates): dashboard templates use page sections, not cards, for page regions
  Author: Joey Farina <[email protected]>
- #12282 fix(cli): theme build --check and doctor ignore which CLI release, and which command name, built a theme
  Author: Joey Farina <[email protected]>
- #12420 fix(Chat): ChatToolCalls and ChatDictationButton without a required prop name it and the fix in development
  Author: Joey Farina <[email protected]>
- #12205 fix(cli): equally scored icons put first one whose id the query names in full
  Author: Joey Farina <[email protected]>
- #12455 fix(core): a theme sets the room between a checkbox or a switch and its label
  Author: josephfarina <[email protected]>
- #12658 perf(cli): the first theme build after a CLI upgrade reuses the JavaScript it compiled from a theme's local modules
  Author: Joey <[email protected]>
- #12323 [experimental] export: React logs no render timings while the export draws a page
  Author: Joey Farina <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12713.

@github-actions
github-actions Bot deleted the josephfarina/rl-doc-prop-unions branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — fafebbd0 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