Skip to content

fix(cli): a doc may leave out a value the code deprecates everywhere - #12456

Closed
josephfarina wants to merge 2 commits into
mainfrom
josephfarina/rl-prop-drift-deprecated
Closed

josephfarina wants to merge 2 commits into
mainfrom
josephfarina/rl-prop-drift-deprecated

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

astryx doctor integration components, and Core's own docs test, compare each documented prop type with the code. A doc that leaves out a string value the code keeps only for compatibility, marked @deprecated, read as drift, so a doc had to list a value the code tells people not to use (FieldStatus variant sat on the known-drift list for this reason).

Problem and solution fit

  1. Why it occurs: the check compared the doc's values with every value the type takes, deprecated or not.
  2. Why it harms the task: a doc that follows the deprecation is reported as wrong, and one that lists the deprecated value invites its use.
  3. Why that matters: docs are where people and agents choose values.

The check now lets a doc leave out a string value the code marks deprecated in every place the type takes it from: a union member under @deprecated, a @deprecated key of a keyof map, or a @deprecated overload's parameter. A value any current source gives stays required, including one a type node the check does not read structurally still names (a generic such as Exclude<All, 'xs'>, an indexed access such as Base['size']). FieldStatus variant leaves the known-drift list.

Expected behavior and authority

architecture:cli-surface INV33 and DEC-5 say what the doc-versus-type check counts as drift (with the check-the-props guide row); this change says how a deprecated value counts.

Smallest restoration

  • packages/cli/foundation/discovery/prop-drift.mjs: the deprecated-value allowance.
  • packages/cli/test/core-prop-docs.known-drift.json: FieldStatus variant removed.
  • The check-the-props guide row and a changeset.

Evidence

  • prop-drift.test.mjs: a value deprecated in every source may be left out, and one a current source gives stays required (both directions); Exclude<…> and an indexed access keep their current value required. With the fallback for unread type nodes removed, the second test fails.

  • The deprecation comment is read where Prettier writes it, by TypeScript's own comment ranges: on its own line before a leading |, inline after |, and after a trailing |; a comment on the line of the member before stays with that member. With the earlier reader, the layout test fails on exactly those members.

Scope

  • One defect is restored.
  • 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

  • The CLI's discovery, doc-compiler, docs, integration and Core prop-docs tests (115 files, 2,369 tests; two lifecycle-output tests fail the same way on main on this machine's npm).
  • Typecheck; Prettier; pnpm check:knowledge.

`doctor integration components` (and the Core docs test) re-judge a type
mismatch without the string values the package marks deprecated in every
place the type takes them from: a union member under @deprecated, a
@deprecated keyof key, or a @deprecated overload. A value any other form
gives (a generic such as Exclude, an indexed access) stays required.
FieldStatus variant leaves the known-drift list.
@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 11:00pm 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, 11:14 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

@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 deprecated-value allowance works for @deprecated keyof keys and @deprecated overloads, but it misses the union-member form the guide promises once the source is Prettier-formatted.

  • commentDeprecates (prop-drift.mjs:924-930) sees a union member's @deprecated comment only on its own line after a trailing |; Prettier writes it before a leading | or inline after |, and both layouts still report type_mismatch, so read the comments between the previous member and this one and add tests in both layouts (or narrow the guide row, changeset and description to what works).
  • The description says architecture:knowledge-contracts governs the doc-versus-type check, but architecture:cli-surface INV33 and DEC-5 do, so please cite those instead.

Non-blocking: a doc that drops one of two deprecated values and keeps the other is still reported, while the guide row says "a string value"; either remove only the values the doc leaves out or reword the row.

Claims and files checked

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

  • Claim (changeset): the doctor components check no longer reports a doc that leaves out a value deprecated in every source. Partly false: true for deprecated keyof keys and deprecated overloads (new test fails on the base and passes on the head); false for union-member comments in Prettier layouts (probe).
  • Claim: the doctor check and Core's docs test compare documented prop types with the code. Verified (api/integration/_adapter.mjs:22, test/core-prop-docs.test.mjs:16).
  • Claim: FieldStatus variant was on the known-drift list because of a deprecated value. Verified (its tooltip key is deprecated in FieldStatus/index.ts:26-33; Core's prop-docs test passes on the head without the entry).
  • Claim: three deprecated sources are accepted. Verified for keyof keys and overloads; false for union-member comments in Prettier layouts.
  • Claim: a value any current source gives stays required, including Exclude<…> and an indexed access. Verified (second new test).
  • Claim: with the fallback for unread type nodes removed, the second test fails. Verified by removing it.
  • Claim: the authority is the knowledge-contracts doc checks. False: architecture:cli-surface INV33 and DEC-5 govern the check.
  • Claim: no new public API, visual change, default or interaction model. Verified.
  • Claim: no internal context in public text. Verified.
  • Claim: tests, typecheck, Prettier and the knowledge check pass. Partly verified: the two covering test files pass, Prettier passes on the changed files, and CI typecheck and lint pass; the full local tally was not rerun.
  • File packages/cli/foundation/discovery/prop-drift.mjs: finding (union-member comment detection; partial omission note).
  • File packages/cli/foundation/discovery/prop-drift.test.mjs: finding (the union-member fixture uses a layout Prettier never writes).
  • File packages/cli/assets/docs/tree/check-the-props.doc.mjs: finding (the row promises the union-member form in general).
  • File .changeset/prop-drift-deprecated-values.md: finding (same claim as the row); format valid.
  • File packages/cli/test/core-prop-docs.known-drift.json: clear.

Automated review (maintainer link)

Comment on lines +895 to +898
const current = types
.flatMap(type => (type.isUnion() ? type.types : [type]))
.filter(part => !(part.isStringLiteral() && deprecated.has(part.value)));
return judgeType(docType, current, {...ctx, written: []}) === 'match'

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: this removes every deprecated literal at once. With two deprecated members, a doc that drops one and keeps the other is still reported ('sm' | 'md' | 'lg' against 'sm' | 'md' | 'lg' | 'xl', both of the last two deprecated). The guide row says a doc may leave out "a string value". Remove only the deprecated literals the doc leaves out, or word the row "the string values".

A member's @deprecated comment may sit on its own line before a leading
`|` or inline after the `|`; a comment on the line of the member before
belongs to that member. TypeScript's own comment ranges place them.

@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 jobs did not run on this head because the CI queue was full, so they need a re-run.

Both earlier blocking points are fixed: a union member's @deprecated comment is now read in every layout Prettier writes (on its own line before a leading |, inline after |, and above the first member), and the description cites architecture:cli-surface INV33 and DEC-5.

Non-blocking: the second pass drops every deprecated value at once (prop-drift.mjs:895-898), so a doc that keeps one deprecated value and drops another, or that describes one member of a union of props types, is still reported; either word the guide row and changeset "every string value the code marks deprecated" or strip only the values the doc leaves out, per member.

Claims and files checked

Review mode: incremental; reason: none

  • Claim (changeset): the doctor components check no longer reports a documented string union that leaves out a value deprecated in every source. Verified for a doc that leaves out every deprecated value (the new tests fail on the earlier code and pass on the head); a doc that keeps one of two deprecated values is still reported (non-blocking note above).
  • Claim: the doctor check and Core's docs test compare documented prop types with the code. Verified (api/integration/_adapter.mjs:22, test/core-prop-docs.test.mjs:16).
  • Claim: FieldStatus variant sat on the known-drift list because of a deprecated value. Verified (deprecated tooltip key in FieldStatus/index.ts:26-33 and deprecated overload in FieldStatus.tsx:151-158; Core's prop-docs test passes on the head without the entry).
  • Claim: a value deprecated as a union member, a keyof key or an overload parameter may be left out. Verified (first and second new tests; probes of each layout).
  • Claim: a value any current source gives stays required, including Exclude<…> and an indexed access. Verified (third new test).
  • Claim: with the fallback for unread type forms removed, that test fails. Verified by removing it.
  • Claim: the comment is read where Prettier writes it, a comment on the previous member's line stays with that member, and the earlier reader fails the layout test on exactly those members. Verified (the earlier reader reports only Box.gap and Box.size beyond the expected Box.pad; Prettier's output matches the fixtures).
  • Claim: architecture:cli-surface INV33 and DEC-5 govern the check, with the guide row. Verified.
  • Claim: no new public API, visual change, default or interaction model. Verified.
  • Claim: no internal context in public text. Verified.
  • Claim: tests, typecheck, Prettier and the knowledge check pass. Partly verified: the prop-drift and Core prop-docs tests and 82 CLI test files pass, and Prettier, the changeset check and the knowledge check pass; the strict CLI typecheck reports no error in the changed files, only two template imports of an unbuilt theme package.
  • File packages/cli/foundation/discovery/prop-drift.mjs: non-blocking notes (all-at-once removal at lines 895-898; a comment that only mentions @deprecated counts at lines 939-941).
  • File packages/cli/foundation/discovery/prop-drift.test.mjs: clear.
  • File packages/cli/assets/docs/tree/check-the-props.doc.mjs: non-blocking (the row says "a string value").
  • File .changeset/prop-drift-deprecated-values.md: non-blocking (same wording); format valid.
  • File packages/cli/test/core-prop-docs.known-drift.json: clear.

Automated review (maintainer link)

...(ts.getLeadingCommentRanges(text, start) ?? []),
...(ts.getTrailingCommentRanges(text, start) ?? []),
].some((/** @type {any} */ range) =>
text.slice(range.pos, range.end).includes('@deprecated'),

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: .includes('@deprecated') also matches a comment that only mentions the word, so | /** Replaces the @deprecated big size. */ 'lg' marks 'lg' deprecated and a doc may leave it out unreported. Matching the tag only where JSDoc puts one, at the start of a comment line, avoids that.

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 6933b8b

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

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 6933b8b

josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12941 fix(Table): the default cell renderer shows an Invalid Date as an empty cell
  Author: @josephfarina
- #12886 docs(core): the README setup loads the theme's fonts
  Author: @josephfarina
- #12887 fix(cli): doctor --built reads the setup stylesheet as wiring, not page styling
  Author: @josephfarina
- #12456 fix(cli): a doc may leave out a value the code deprecates everywhere
  Author: @josephfarina
- #12857 docs(cli): the styling and typography pages state their core rules
  Author: @josephfarina
- #12994 test(cli): the doctor golden leaves out a check only some computers report
  Author: @josephfarina
- #13001 test(cli): the swizzle proof renders Lab's MediaPlayer with its required label
  Author: @josephfarina
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12992.

@github-actions
github-actions Bot deleted the josephfarina/rl-prop-drift-deprecated branch November 20, 2026 06:05

This branch was successfully deployed

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