Skip to content

fix(cli): doctor says when an app does not import Core's component styles - #12244

Merged
josephfarina merged 4 commits into
mainfrom
josephfarina/doctor-core-stylesheets
Nov 17, 2026
Merged

josephfarina merged 4 commits into
mainfrom
josephfarina/doctor-core-stylesheets

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

An app that renders Astryx components with Core's prebuilt styles, but does not load them (@astryxdesign/core/astryx.css), shows every component unstyled. Nothing caught it: the build passed, and astryx doctor and astryx doctor --built dist both passed. The getting-started setup and the agent docs say to import Core's stylesheets once, and tell agents to check a build with doctor --built before they deliver it, so the check agents rely on missed the most basic setup failure.

Reproduction: a Vite app with @astryxdesign/core and @astryxdesign/theme-neutral, the neutral theme added and imported, a page with a Button; then the two imports (reset.css, astryx.css) removed.

Before After
doctor no problem reported core-stylesheets warns: "Found nothing in project source, stylesheets or pages that imports or links @astryxdesign/core/astryx.css, Core's component styles. Without them, Astryx components render unstyled."
doctor --built dist built-astryx-usage passes ("Astryx styles in assets/index-….css", the theme's stylesheet) built-astryx-styles warns: "None of the 2 built stylesheets and pages that doctor read carries Core's component styles (the astryx-base layer of @astryxdesign/core/astryx.css). This output's Astryx components render unstyled."

Each names the fix: import @astryxdesign/core/reset.css, then @astryxdesign/core/astryx.css, once, in the app's global stylesheet or its entry module. With the imports back (as @import lines or as module imports), or with a page that links Core's astryx.css, both checks pass.

An app that compiles Core's styles from source with @astryxdesign/build loads no astryx.css by design. When it loads none, both checks report it as not checked (info), naming the setup they found: withAstryx() in its next.config, astryxStylex() in its vite.config, an @astryx; rule in a stylesheet, or an @stylex; rule while its PostCSS config loads @astryxdesign/build. An @stylex; rule alone is the app's own StyleX, which still needs Core's prebuilt styles, so it is checked as usual. An app that loads Core's astryx.css passes in any setup.

Problem and solution fit

  1. Why does it happen? built-astryx-usage asks only whether the output uses Astryx at all. A theme's stylesheet, and Core's scripts, which reference Astryx's custom properties and hold the astryx-base layer name as text, already count, so output without Core's component styles passes. Plain doctor has no check on the app's stylesheets.
  2. Why does it harm the task? A page whose components render unstyled is broken, and the checks that should catch it pass.
  3. Why does that matter? Agents run doctor --built before they deliver, and follow its result.

Expected behavior and authority

  • architecture:cli-surface INV39, added in this pull request: doctor warns (core-stylesheets) and doctor --built warns (built-astryx-styles); an app that compiles Core's styles from source (withAstryx(), astryxStylex(), an @astryx; rule, or an @stylex; rule with @astryxdesign/build in the PostCSS config) gets neither warning.
  • Severity: --built shipped in a stable release (0.7.16), so its new check starts as a warning. Turning it into a failure is its own [breaking] change in the next minor release, not part of this pull request.

Smallest restoration

  • api/doctor/doctor.mjs: core-stylesheets, after core-installed, only when Core is installed and the project is on Core. It passes when a project stylesheet @imports Core's component styles (read with the shared stylesheet reader), a module imports them (read as a syntax tree), or a page links them (<link rel="stylesheet"> to the package's astryx.css, from a package CDN or the installed copy); a commented-out import or link does not count. Otherwise it is info for a source build (sourceBuildSetup) and a warning for any other app.
  • api/doctor/built-checks.mjs: built-astryx-styles, only when the output uses Astryx. It passes when a built stylesheet or page holds the astryx-base layer's rules, a page links Core's astryx.css (linksCoreStylesheet, the reader plain doctor shares), or a source file or stylesheet under the path imports Core's component styles (a project folder before its build). It is info for a source build of the project that holds the path, and info when the path holds no built stylesheet or page. Otherwise it warns. Core's scripts hold such a rule as text they write at run time, so scripts do not count.
  • api/doctor/_adapter.mjs: the walk lists pages on request; doctorStylesheetAtRules reads a stylesheet's at-rules with postcss; builtProjectRoot finds the project that holds a --built path (the walk builtIntegrationPackages already did).
  • api/doctor/theme-checks.mjs exports the module-specifier reader the new check shares, and stringValues, which reads a PostCSS config's plugin names from its syntax tree; doctor.doc.mjs and doctor.type.mjs describe both checks.

Evidence

  • The reproduction above, run with the current canary installed for the computer, and with only these files changed in that copy: before, nothing; after, a doctor warning and a doctor --built dist warning (exit 0). A CDN link to Core's astryx.css in index.html passes both checks, built (dist/index.html links …) and not; the same link in a comment warns. astryxStylex() in vite.config.ts, or an @astryx; rule in the global stylesheet, makes both checks info. An @stylex; rule alone warns; with @astryxdesign/build/postcss in postcss.config.mjs it is info.
  • This repository's examples, from their folders: example-nextjs-source (withAstryx()) and example-vite (astryxStylex()) are info in both checks, with doctor --built . exiting 0; example-nextjs-stylex (imports astryx.css beside its own @stylex; rule) and example-nextjs pass.
  • Regression tests: plain doctor passes an @import url(…), a module import, and a page link from a CDN or the installed package; warns when the only import or link is in a comment; is info for each source-build setup (Next, Vite, @astryx;, and @stylex; with the build's plugin in postcss.config.mjs or .postcssrc.json); warns an app whose @stylex; rule is its own StyleX; still warns when the setup is only named in a comment; passes an app that loads astryx.css beside its own @stylex; rule; is left out without Core. --built passes a page that links Core's stylesheet and warns when that link is in a comment; warns about a build whose CSS holds only a theme's stylesheet and whose script holds Core's run-time base-layer text; passes a built stylesheet or a page <style> with the layer, and a source that imports Core's styles before any build; is info for a source build (given, and read through doctor --built from the project's vite.config.ts), while output with the styles still passes; is info for output with no built stylesheet or page; is left out for output that uses no Astryx.
  • The doctor golden for a broken installed set carries the new warning.

Scope

Components: CLI (doctor, doctor --built)

  • 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.

Writing rubric results

  • INV39 is one present-tense statement of what both checks report and for which apps; the move to a failure is stated as the system's rule for the next minor, with no history or project status.

Testing

  • vitest run --project node over api/doctor/built-checks.test.mjs, api/doctor/doctor.test.mjs, api/doctor/theme-checks.test.mjs and test/experimental-isolation.test.mjs (the doctor golden): 4 files, 285 passed.
  • tsc --project tsconfig.strict.json: no error in the changed files. The commit hook's lint-staged and check:repo pass.

@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:52am 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, 11:04 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 87380e5

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.33 MB packed (+5.5 kB); no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@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 new doctor checks catch a missing Core stylesheet in the default setup, but they misreport apps on the supported @astryxdesign/build source build, and the new stylesheet reader duplicates one doctor already has. Both points still apply at this revision.

  • core-stylesheets and built-astryx-styles treat a source-build app as broken (for example apps/example-nextjs-source with withAstryx() and @stylex;, apps/example-vite with astryxStylex(), or the Turbopack setup with @astryx;): plain doctor warns and says to import @astryxdesign/core/astryx.css, which makes a withAstryx() build fail, and doctor --built . on those apps goes from exit 0 to exit 1 with "Do not deliver this output", so please detect a source build, pass or leave out both checks for it, and reword the changeset's "Without them, Astryx components render unstyled".
  • doctor.mjs parses stylesheet @imports with its own regex instead of the doctor adapter's doctorStylesheetImports, which the theme-wiring scan already uses, and the two already disagree (an @IMPORT rule warns here, while an @import inside a content: string passes), so please use the shared reader beside moduleSpecifiers and drop the regex.

No current spec record governs these two doctor checks, so approval also needs an engineering owner to settle whether doctor owns them, at what severity (a warning in doctor, a failure in --built), and whether source builds are left out. An owner records that decision with a spec record (the package-stylesheet spec is the closest) or by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none

Claims:

  • Changeset: doctor now reports an app that does not import Core's component styles. Verified: doctor.mjs:414-433, built-checks.mjs:768-801 and the new tests.
  • Changeset: without them, Astryx components render unstyled. False for @astryxdesign/build source builds, which load no astryx.css by design (first finding).
  • Changeset: before this change the build, doctor and doctor --built all passed. Verified: at the base, --built returns only the usage and purity checks, and plain doctor has no check for Core's stylesheet.
  • Changeset: plain doctor warns when no project source or stylesheet imports them. Verified: doctor.mjs:427-432.
  • Changeset: doctor --built fails when the output uses Astryx but no built stylesheet or page carries them. Verified, with the documented pass on a source import and info with no stylesheet or page (built-checks.mjs:778-793); a source-build project folder also fails (first finding).
  • Description: the before and after messages in the reproduction table. Verified against the message strings (doctor.mjs:430, built-checks.mjs:798).
  • Description: each message names the fix of importing reset.css, then astryx.css. Verified: doctor.mjs:431, built-checks.mjs:799.
  • Description: with the imports back, as @import lines or module imports, both checks pass, built or not. Verified: the new tests, and apps/example-nextjs passes both.
  • Description: a theme stylesheet and Core's scripts already satisfied the usage check. Verified: built-checks.mjs:113-114.
  • Description: agents run doctor --built before they deliver. Verified: the agent docs' delivery line (foundation/agent-docs/agent-docs.mjs:658).
  • Description: doctor's own contract describes --built as a check before delivery, and the getting-started guide sets both imports. Verified: doctor.doc.mjs, getting-started.doc.mjs.
  • Description: no knowledge record lists doctor's checks. Verified for these checks; the package-stylesheet spec still governs the setup they check, and it exempts source builds.
  • Description: core-stylesheets runs after core-installed, only with Core installed and the project on Core, and ignores commented-out imports. Verified: the check order, the Core-only check set, the coreDir guard and the warn test.
  • Description: built-astryx-styles runs only when the output uses Astryx, passes on base-layer rules or a source import, is info with no stylesheet or page, and ignores scripts. Verified for the prebuilt setup (built-checks.mjs:656-659, :768-801, :938-940); false for a source-build project folder (first finding).
  • Description: the theme checks share their module reader, and the doc and type describe the new check. Verified.
  • Description: the regression tests and the golden update. Verified: the three changed test files and the golden test pass at this revision.
  • Description: the full test, typecheck, lint and format runs. Partly verified: the changed and golden test files pass here, and CI's lint and CLI smoke-test jobs pass.
  • Description: no new public API under the bug-fix label. Verified: doctor() and its types keep their shape, and CI's API report lists no change.

Files:

  • .changeset/doctor-core-stylesheets.md: one sentence is false for source builds (first finding).
  • packages/cli/api/doctor/doctor.mjs: first and second findings.
  • packages/cli/api/doctor/built-checks.mjs: first finding. Non-blocking: the base-layer mark also matches the Lab, Rich Text and Charts stylesheets, so the pass message can name Core's styles when only another package's are present.
  • packages/cli/api/doctor/theme-checks.mjs: clear.
  • packages/cli/api/doctor/doctor.doc.mjs: clear.
  • packages/cli/api/doctor/doctor.type.mjs: clear.
  • packages/cli/api/doctor/built-checks.test.mjs: clear; it needs a source-build case once the first finding is fixed.
  • packages/cli/api/doctor/doctor.test.mjs: clear; same.
  • packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/doctor/doctor.mjs Resolved
Comment thread packages/cli/api/doctor/doctor.mjs Resolved
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): astryx doctor gains two checks for an app that does not load Core's component styles. core-stylesheets is a warning in plain doctor; an import of @astryxdesign/core/astryx.css or a page <link rel="stylesheet"> to it counts as loaded. built-astryx-styles in doctor --built is a warning, because --built already shipped in a stable release; making it a failure is a separate breaking change for the next minor. Apps on the supported source build (@astryxdesign/build, or an @astryx;/@stylex; rule) are detected and reported as not checked by both. The cli-surface record names both checks and the skip.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec cf89056

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval 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 new doctor warnings now leave @astryxdesign/build source builds alone, but the source-build detector also skips apps that compile only their own StyleX, so those apps never get the warning this change adds.

  • sourceBuildSetup (doctor.mjs) counts any @stylex; rule as a Core source build, yet StyleX's own PostCSS plugin writes that rule in the documented own-StyleX setup, which still loads the prebuilt stylesheet (as apps/example-nextjs-stylex does): with its astryx.css import removed, both checks say "Not checked: this app compiles Core's styles from source" instead of warning, so please drop @stylex; from the mark (the withAstryx() setup is already found through next.config) or count it only when the PostCSS config loads @astryxdesign/build, and update INV39, the --built doc and the tests to match.

The earlier points are fixed at this revision: source builds are reported as not checked, and plain doctor reads stylesheet imports with the shared reader. Our earlier suggestion to treat @stylex; as a source-build mark was wrong. The golden doctor-installed-set.json also conflicts with main and needs regenerating after a merge.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • Changeset: doctor now says when an app does not load Core's component styles. Verified: doctor.mjs:520-549, built-checks.mjs:774-815 and the new tests.
  • Changeset: in an app on Core's prebuilt styles, components render unstyled without them. Verified: a build with only a theme stylesheet carries no astryx-base rules.
  • Changeset: before, the build, doctor and doctor --built all passed. Verified: the base has neither check.
  • Changeset: plain doctor warns when no project stylesheet or module imports them and no page links them. False for an app with its own @stylex; rule (the finding); verified otherwise on copies of the example apps and in the tests.
  • Changeset: doctor --built warns when output that uses Astryx carries none of them. Verified: built-checks.mjs:808-814; it also passes on a source import.
  • Changeset: an app that compiles Core from source with @astryxdesign/build is not checked. Verified for withAstryx(), astryxStylex() and @astryx;; the detector also skips apps that do not use the build package (the finding).
  • Description: before, no problem reported; after, the two quoted warnings. Verified against the message text (doctor.mjs:546, built-checks.mjs:812) and the example-app copies.
  • Description: each warning names the fix of importing reset.css, then astryx.css. Verified: doctor.mjs:547, built-checks.mjs:813.
  • Description: with the imports back, or a page link, both checks pass. Verified on the example apps and in the tests.
  • Description: a source build is reported as not checked, naming the setup found, an @stylex; rule included. Verified as behavior; the @stylex; part misclassifies own-StyleX apps (the finding).
  • Description: the usage check already counted a theme stylesheet and Core's scripts. Verified: built-checks.mjs:114-115.
  • Description: agents run doctor --built before they deliver. Verified: the agent docs' delivery line.
  • Description: INV39 states both warnings and the skip, and the failure waits for the next minor because --built shipped in a stable release. Verified: cli-surface.md:344-351, built-checks.mjs:761-768.
  • Description: the check order, the Core-only scope, the readers, the page link, the info and warning cases, and the adapter and module-reader helpers. Verified.
  • Description: the repository's source-build examples are info with doctor --built . exiting 0, and example-nextjs-stylex and example-nextjs pass. Verified.
  • Description: the listed regression tests and the golden update. Verified: the tests pass at this revision.
  • Description: no new public API under the bug-fix label. Verified: no export, type, command or option changes.
  • Description: the writing rubric results. Present, as one line for R1 and R7.
  • Description: the test, typecheck and lint runs. Verified: the changed test files pass, the strict typecheck has no error in the changed files, and ESLint passes on them.

Files:

  • .changeset/doctor-core-stylesheets.md: the plain-doctor sentence is false for own-StyleX apps (the finding).
  • docs/architecture/cli-surface.md: INV39's @stylex; mark (the finding).
  • packages/cli/api/doctor/doctor.mjs: the finding. Non-blocking: the Core stylesheet constant and fix text are duplicated in built-checks.mjs.
  • packages/cli/api/doctor/built-checks.mjs: non-blocking: the astryx-base mark also matches the Lab, Rich Text and Charts stylesheets, and stylesheet imports are read with a regex rather than the shared reader.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: clear.
  • packages/cli/api/doctor/doctor.doc.mjs: its source-build wording follows the finding.
  • packages/cli/api/doctor/doctor.type.mjs: clear.
  • packages/cli/api/doctor/built-checks.test.mjs: clear.
  • packages/cli/api/doctor/doctor.test.mjs: the @stylex; case follows the finding; it needs an own-StyleX case without the import.
  • packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear at this revision; it conflicts with main.

Automated review (maintainer link)

Comment thread packages/cli/api/doctor/doctor.mjs Resolved
…ilds, and warns in --built

Plain doctor's core-stylesheets check also counts a page that links Core's
astryx.css and reads stylesheet imports with the shared reader. Both checks
report an app that loads no astryx.css but compiles Core's styles from source
(withAstryx(), astryxStylex(), or an @AstryX; or @stylex; rule) as not
checked. built-astryx-styles warns instead of failing, because --built shipped
in a stable release. architecture:cli-surface INV39 records both checks.
@josephfarina
josephfarina force-pushed the josephfarina/doctor-core-stylesheets branch from cf89056 to 7085d89 Compare November 17, 2026 09:48
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7085d89

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval 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: two defects remain in the new checks, and both have small fixes.

  • Any @stylex; rule is taken for a Core source build (packages/cli/api/doctor/doctor.mjs:433-439), so an app that compiles its own StyleX and loads the prebuilt astryx.css (a default setup the package-stylesheets spec requires to load it) is told "this app compiles Core's styles from source" and is never warned when the import is missing; count @stylex; only when the PostCSS config loads @astryxdesign/build, and update INV39, the docs, the changeset and the tests to match.
  • Miss: doctor --built ignores a page <link rel="stylesheet"> to Core's astryx.css (packages/cli/api/doctor/built-checks.mjs:657-678), so an app whose index.html links it from a CDN passes doctor but gets "This output's Astryx components render unstyled … Do not deliver this output." from doctor --built, which also makes the description's "a page that links Core's astryx.css, both checks pass" untrue; share the page-link reader with scanBuilt and add a --built test.

The earlier source-build false warning is fixed, and the tests, lint and knowledge checks pass at this head.

Claims and files checked

Review mode: full; reason: rebase

Claims:

  • Changeset: doctor now says when an app does not load Core's component styles: verified (a copy of the Next.js example without the import warns in both commands).
  • Changeset and description: before this change the build, doctor and doctor --built all passed: verified (the base has neither check, and built-astryx-usage passes on a theme stylesheet).
  • Changeset: plain doctor warns when no stylesheet or module imports the styles and no page links them: verified (tests and probes).
  • Changeset: doctor --built warns when Astryx output carries no Core styles: verified, but it also warns when a page links them (finding 2).
  • Changeset: only an @astryxdesign/build source build is not checked: false, any @stylex; app is skipped too (finding 1).
  • Description: the before/after reproduction messages: verified.
  • Description: with a page that links Core's astryx.css, both checks pass: false for doctor --built (finding 2).
  • Description: source builds are reported as not checked, naming their setup: verified for withAstryx(), astryxStylex() and @astryx;; the @stylex; mark is finding 1.
  • Description: an app that loads astryx.css passes in any setup: verified.
  • Description: --built starts as a warning because it already shipped in a stable release: verified.
  • Description: core-stylesheets runs only when Core is installed and the project is on Core; commented-out imports and links do not count: verified.
  • Description: built-astryx-styles is info with no built stylesheet or page, and scripts do not count: verified.
  • Description: the example apps report as described: verified on copies of each.
  • Description: the listed regression tests and the golden: verified, they pass.
  • Description: tests pass and the strict typecheck has no error in the changed files: verified.
  • Description: writing rubric results: present as one line; the next-minor sentence in INV39 reads as release sequencing (non-blocking).

Files:

  • .changeset/doctor-core-stylesheets.md: finding 1 (describes the skip as @astryxdesign/build only).
  • docs/architecture/cli-surface.md: finding 1 (INV39 names @stylex;); non-blocking note on the next-minor sentence.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/built-checks.mjs: finding 2; non-blocking notes on the layer mark and the duplicated constant.
  • packages/cli/api/doctor/built-checks.test.mjs: finding 2 (no page-link case).
  • packages/cli/api/doctor/doctor.doc.mjs: follows finding 1.
  • packages/cli/api/doctor/doctor.mjs: finding 1.
  • packages/cli/api/doctor/doctor.test.mjs: finding 1 (the @stylex; case).
  • packages/cli/api/doctor/doctor.type.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: clear.
  • packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.

Automated review (maintainer link)

…stryxdesign/build in PostCSS, and --built counts a page link

An app's own StyleX writes into an @stylex; rule too, and still needs Core's
prebuilt styles, so the rule marks a source build only while the PostCSS
config loads @astryxdesign/build. doctor --built now shares plain doctor's
page-link reader, so a page that links Core's astryx.css passes both checks.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 87380e5

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval 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.

Approved pending CI: the new doctor and doctor --built warnings for an app that loads none of Core's component styles match the cli-surface record's new INV39, which an engineering owner approved for this revision, and both earlier blocking points are fixed. CI's Node test legs, and the test job that joins them, stopped on the suite-wide time budget before running any test. The same plan is over budget on main, so this change does not cause it, but the Node tests still need to pass on a re-run before merge; every other check passed.

Non-blocking suggestions, with details in the inline comments:

  • Plain doctor reads only .css stylesheets, so an app whose globals.scss imports @astryxdesign/core/astryx.css is told its components render unstyled.
  • The astryx-base mark that built-astryx-styles looks for is in every package stylesheet, so output with only richtext.css or lab.css passes as "Core's component styles".
  • The --built docs leave out the page-link pass, and astryx doctor --help mentions neither new warning.
Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • Changeset: doctor now says when an app does not load Core's component styles: verified (doctor.mjs:569-598, built-checks.mjs:804-853, fixture runs).
  • Changeset: in an app on Core's prebuilt styles, components render unstyled without them: verified (the package-stylesheets spec requires the prebuilt stylesheet in every default setup).
  • Changeset and description: before, the build, doctor and doctor --built all passed: verified (the base has no such check, and the usage check accepts a theme's stylesheet and Core's scripts).
  • Changeset: plain doctor warns when no project stylesheet or module imports them and no page links them: verified for .css, module and page sources; a .scss stylesheet is not read (non-blocking).
  • Changeset: doctor --built warns when Astryx output carries none of them: verified (fixture output folders and tests).
  • Changeset and description: an app that compiles Core from source with @astryxdesign/build is reported as not checked, naming its setup: verified for withAstryx(), astryxStylex(), @astryx;, and @stylex; with the build's PostCSS plugin.
  • Description: an @stylex; rule alone is the app's own StyleX and is checked: verified (own-StyleX fixture without the import warns).
  • Description: the reproduction's before and after messages: verified word for word on fixture apps.
  • Description: each warning names the two imports to add: verified (doctor.mjs:596, built-checks.mjs:851).
  • Description: with the imports back, or a page linking Core's stylesheet, both checks pass; a link in a comment does not count: verified (fixtures and tests).
  • Description: plain doctor had no check for Core's stylesheet: verified (the existing theme-wiring scan reads stylesheets only for theme imports).
  • Description: the new record invariant states both warnings and the skip: verified (cli-surface.md:355-363).
  • Description: --built shipped in a stable release, so the new check warns and a failure is a later breaking change: verified (no failing status in the code).
  • Description: the adapter, theme-checks, doc and type changes as listed: verified.
  • Description: the source-build and own-StyleX example apps behave as stated, with doctor --built . exiting 0: verified on copies of those apps.
  • Description: the listed regression tests and the golden update: verified (doctor.test.mjs:340-491, built-checks.test.mjs:127-250).
  • Description: the four test files pass with 285 tests, and the strict typecheck and lint report nothing in the changed files: verified (285 passed; ESLint clean; the only typecheck errors are in page templates).
  • Description: no internal context in public text: verified.

Files:

  • .changeset/doctor-core-stylesheets.md: clear (its "no project stylesheet" is broader than the .css walk; see the first suggestion).
  • docs/architecture/cli-surface.md: owner-approved; non-blocking: the next-minor sentence is work order.
  • packages/cli/api/doctor/_adapter.mjs: clear.
  • packages/cli/api/doctor/built-checks.mjs: non-blocking: the styles mark matches every package stylesheet, and the stylesheet constant and fix text repeat doctor.mjs.
  • packages/cli/api/doctor/built-checks.test.mjs: clear.
  • packages/cli/api/doctor/doctor.doc.mjs: non-blocking: the --built text leaves out the page-link pass.
  • packages/cli/api/doctor/doctor.mjs: non-blocking: .scss stylesheets are not read.
  • packages/cli/api/doctor/doctor.test.mjs: clear.
  • packages/cli/api/doctor/doctor.type.mjs: clear.
  • packages/cli/api/doctor/theme-checks.mjs: clear.
  • packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json: clear.

Automated review (maintainer link)

function coreStylesheetLoad(root) {
let unparsed = 0;
for (const file of listProjectSourceFiles(root, '', {
stylesheets: true,

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 walk lists only .css stylesheets, so an app whose globals.scss imports @astryxdesign/core/astryx.css is told "Found nothing … Without them, Astryx components render unstyled." Consider reading the @import and @use lines of .scss and .sass files too, or saying in the message that only .css stylesheets were read.

* scripts hold such a rule as text they write at run time, so only
* stylesheets and pages count.
*/
const CORE_STYLES_MARK = /@layer\s+astryx-base\s*\{/;

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: every package stylesheet puts its rules in astryx-base (lab.css, richtext.css and charts.css too), so output that loads only one of those passes with "Core's component styles are in …". Saying "Astryx component styles", or matching a rule only Core's stylesheet has, would keep the message true.

type: 'string',
description:
'A finished build to check before you deliver it: a project folder, a build output folder, or one built `.html` file, relative to `cwd`. Adds two checks after the others. `built-astryx-usage` fails when the path holds no value import from an Astryx package (any `@astryxdesign/*` package or an integration the project installs), no component imported from one, and no Astryx styles in built CSS or HTML. `built-astryx-purity` warns with the source check of `astryx docs is-my-code-good`: raw elements Astryx has a component for, raw SVG and icon-library icons, inline styles, classes, `stylex.create` and imported stylesheets, each with its file and line, in `.tsx` and `.jsx` files and JSX in `.js` source, found by parsing it; it is info, not inspected, when the path holds no source with JSX, such as a bundle. It reads at most 20,000 files, each up to 5 MB, skipping installs and version control; when either limit leaves source unread and nothing was found, the purity check is info, not fully inspected, and when the file limit ends the read before any Astryx turns up, `built-astryx-usage` warns that the rest went unread instead of failing. Given one built `.html` file, it also reads the local stylesheets and scripts that page links, finding a root-relative link from the nearest folder above the page that holds it; a linked file that is not there makes `built-astryx-usage` warn instead of fail. An empty folder fails with nothing checked, like a missing path. A source tree counts as using Astryx through an import, a re-export (`export … from`) or a stylesheet `@import` of an Astryx package; a type-only import or re-export (`import type`, `export type`, or a list whose names are all `type`) does not count, since the build erases it. `--built` goes with `doctor` alone; a `doctor integration` check refuses it. A path that does not exist fails `built-astryx-usage` with nothing checked, and the purity check is left out. The integrations that count are the dependencies the nearest package.json above the path declares whose installed copy, found the way the CLI autolinks (a hoisted workspace copy included), has an integration manifest. The files under the path, and that configuration, are only read, never run. Without it, doctor runs exactly as before.',
"A finished build to check before you deliver it: a project folder, a build output folder, or one built `.html` file, relative to `cwd`. Adds its checks after the others. `built-astryx-usage` fails when the path holds no value import from an Astryx package (any `@astryxdesign/*` package or an integration the project installs), no component imported from one, and no Astryx styles in built CSS or HTML. When the output uses Astryx, `built-astryx-styles` warns when no built stylesheet or page under the path carries Core's component styles (the `astryx-base` layer of `@astryxdesign/core/astryx.css`) and no source file or stylesheet there imports them, since the components then render unstyled; it is info, not checked, when the path holds no built stylesheet or page, or when the project that holds the path compiles Core's styles from source (`withAstryx()` or `astryxStylex()` from `@astryxdesign/build` in its `next.config` or `vite.config`, an `@astryx;` rule in a stylesheet, or an `@stylex;` rule while its PostCSS config loads `@astryxdesign/build`). `built-astryx-purity` warns with the source check of `astryx docs is-my-code-good`: raw elements Astryx has a component for, raw SVG and icon-library icons, inline styles, classes, `stylex.create` and imported stylesheets, each with its file and line, in `.tsx` and `.jsx` files and JSX in `.js` source, found by parsing it; it is info, not inspected, when the path holds no source with JSX, such as a bundle. It reads at most 20,000 files, each up to 5 MB, skipping installs and version control; when either limit leaves source unread and nothing was found, the purity check is info, not fully inspected, and when the file limit ends the read before any Astryx turns up, `built-astryx-usage` warns that the rest went unread instead of failing. Given one built `.html` file, it also reads the local stylesheets and scripts that page links, finding a root-relative link from the nearest folder above the page that holds it; a linked file that is not there makes `built-astryx-usage` warn instead of fail. An empty folder fails with nothing checked, like a missing path. A source tree counts as using Astryx through an import, a re-export (`export … from`) or a stylesheet `@import` of an Astryx package; a type-only import or re-export (`import type`, `export type`, or a list whose names are all `type`) does not count, since the build erases it. `--built` goes with `doctor` alone; a `doctor integration` check refuses it. A path that does not exist fails `built-astryx-usage` with nothing checked, and the purity check is left out. The integrations that count are the dependencies the nearest package.json above the path declares whose installed copy, found the way the CLI autolinks (a hoisted workspace copy included), has an integration manifest. The files under the path, and that configuration, are only read, never run. Without it, doctor runs exactly as before.",

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 text says built-astryx-styles warns unless a built file carries the layer or a source imports it, but a page that links Core's astryx.css also passes (built-checks.mjs:814-821). The command doc, clients/cli/commands/doctor.doc.mjs, which astryx doctor --help prints, still mentions neither new warning.

Comment on lines +359 to +360
Core's component styles; that warning becomes a failure in the next minor
release, as its own `[breaking]` change. An app that compiles Core's styles

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: "that warning becomes a failure in the next minor release, as its own [breaking] change" is work order that turns false once that release ships (rubric R7 in docs/contributing/spec-writing.md). The pull request or a plan can carry it, while INV39 states what doctor does.

@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina josephfarina reopened this Nov 17, 2026
@josephfarina
josephfarina merged commit a9c3c85 into main Nov 17, 2026
259 of 330 checks passed
@github-actions
github-actions Bot deleted the josephfarina/doctor-core-stylesheets branch November 18, 2026 06:05

This branch was successfully deployed

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