Skip to content

fix(cli): doctor --built reads the setup stylesheet as wiring, not page styling - #12887

Closed
josephfarina wants to merge 1 commit into
josephfarina/tweet-readme-theme-fontsfrom
josephfarina/tweet-doctor-setup-stylesheet
Closed

josephfarina wants to merge 1 commit into
josephfarina/tweet-readme-theme-fontsfrom
josephfarina/tweet-doctor-setup-stylesheet

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #12886 → #12887

astryx doctor --built . flagged import './index.css' in src/main.tsx as "imports the stylesheet: use component props and tokens", even when index.css holds only the setup imports the getting-started steps tell you to write (reset.css, astryx.css, a theme's CSS), the same shape as the default setup example in AST-080 FR5. Following the setup exactly produced a styling finding.

A relative stylesheet import whose file's only rules are @imports of Astryx packages' CSS (plus @layer order statements; comments ignored) is now read as wiring, the way a registered theme's own stylesheets already are. A stylesheet with any rule of its own, a @layer block, or an import from another package is still flagged, and so is a bare package import. Each sheet is read only when a source file imports it. The --built option text names both exceptions. Behavior stays within AST-041 FR7.

Test plan

  • New case in built-checks.test.mjs: the setup sheet is not flagged; sheets with a rule, a non-Astryx import, or a @layer block, and a bare import, still are. built-checks.test.mjs passes locally (CI=1).
  • Reproduced on a new Vite app on the current CLI: the finding for src/main.tsx importing ./index.css goes away; the other findings are unchanged.

preflight: pass 0a3647c

@vercel

vercel Bot commented Nov 19, 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 19, 2026 12:03pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 19, 2026, 12:12 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 19, 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 its commit carries [skip ci], so the required checks still need to pass on a head that runs them.

The change does what it says. A stylesheet that only @imports Astryx packages' CSS no longer gets the "imports the stylesheet" warning from astryx doctor --built, and stylesheets with their own rules, a @layer block or another package's import are still flagged. The new test fails without the change and passes with it.

Two optional follow-ups:

  • The --built option text in packages/cli/api/doctor/doctor.doc.mjs still says the purity check warns on "imported stylesheets". Naming the setup-stylesheet exception there keeps what agents read in step with the check.
  • astryx doctor --built src/main.tsx (one source file) still flags ./index.css, because only scanned files are classified. Reading the imported sheet from disk would cover that case too.
Claims and files checked

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

  • Changeset: doctor --built no longer flags the setup stylesheet as page styling. Verified by the new test and a before/after CLI run.
  • Changeset: a stylesheet that only imports Astryx packages' CSS is read as wiring. Verified in doctorStylesheetOnlyLoads and astryxSetupStylesheets.
  • Changeset: a stylesheet with its own rules, or another package's import, is still flagged. Verified by the test's negative cases.
  • Description: the old check flagged import './index.css' for a setup-only sheet. Verified: the new test fails on the base with exactly that finding.
  • Description: only Astryx @imports, @layer order statements and comments count as wiring. Verified in the code and by probing edge cases.
  • Description: a rule, a @layer block or another package's import is still flagged. Verified by the test.
  • Test plan: the new case covers the setup sheet and three negatives. Verified: it passes on the head.
  • Test plan: on a fresh Vite-style app the index.css finding goes away and the other findings stay. Verified on an equivalent fixture app.
  • .changeset/doctor-setup-stylesheet.md: clear
  • packages/cli/api/doctor/_adapter.mjs: clear
  • packages/cli/api/doctor/built-checks.mjs: clear
  • packages/cli/api/doctor/built-checks.test.mjs: clear

Automated review (maintainer link)

doctor --built flagged import './index.css' in main.tsx as page styling,
even when index.css holds only the imports the getting-started steps
write (reset.css, astryx.css, a theme's CSS). A stylesheet whose only rules
are @imports of Astryx packages' CSS, and @layer order statements, is now
read as wiring; one with any rule of its own, a @layer block, or another
package's import is still flagged.

[skip ci]

@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 its commit carries [skip ci], so the required checks still need to pass on a head that runs them.

astryx doctor --built now reads a stylesheet that only @imports Astryx packages' CSS as setup wiring, and still flags sheets with their own rules, a @layer block or another package's import. The new test fails without the change and passes with it, and on a sample app the purity check goes from one finding to none.

One optional follow-up:

  • A setup sheet outside the scanned path is still flagged, so astryx doctor --built src/main.tsx reports the import that astryx doctor --built . accepts; resolving the sheet against the scanned folder and reading it from disk would make the result independent of the path given (see the inline note).
Claims and files checked

Review mode: full; reason: rebase

  • Claim (changeset): doctor --built no longer flags the setup stylesheet as page styling. Verified: the new test case and a sample-app run (purity warn to ok).
  • Claim (changeset): a sheet that only imports Astryx packages' CSS, as the getting-started steps write it, is read as wiring. Verified: the getting-started, README and default-setup sheets are not flagged at this head and are flagged on the base.
  • Claim (changeset): a sheet with its own rules, or an import from another package, is still flagged. Verified: built-checks.test.mjs:423-426 and :434-435.
  • Claim (description): on the base, import './index.css' in src/main.tsx was flagged for a setup-only sheet. Verified: base run reports src/main.tsx:3 imports the stylesheet ./index.css.
  • Claim (description): the setup has the same shape as the package-stylesheet spec's default setup example. Verified: that example (a @layer order line, four imports, a comment) is not flagged at this head.
  • Claim (description): only @imports of Astryx packages' CSS plus @layer order statements, comments ignored, count as wiring, like a registered theme's sheets. Verified: _adapter.mjs:554-563, built-checks.mjs:797-801.
  • Claim (description): a rule, a @layer block, another package's import, or a bare package import is still flagged. Verified: built-checks.test.mjs:409-439.
  • Claim (description): each sheet is read only when a source file imports it. Verified for the classifier (built-checks.mjs:672-685); the scan loop still reads every stylesheet for the style checks, as before (built-checks.mjs:733).
  • Claim (description): the --built option text names both exceptions. Verified: doctor.doc.mjs:44.
  • Claim (description): behaviour stays within the shared code rubric's ownership of the criteria. Verified: the rubric's Styling criterion names StyleX declarations, inline styles and classes, not a sheet that only loads Astryx CSS.
  • Claim (test plan): the new case passes. Verified: all 321 doctor tests pass at this head; the new case fails on the base with only the extra ./index.css finding.
  • Claim (test plan): on a new Vite app the ./index.css finding goes away and the other findings are unchanged. Verified on an equivalent sample app: purity has no findings, and usage and styles results are the same on both sides.
  • File .changeset/doctor-setup-stylesheet.md: clear.
  • File packages/cli/api/doctor/_adapter.mjs: clear.
  • File packages/cli/api/doctor/built-checks.mjs: non-blocking note (a setup sheet outside the scanned path is still flagged).
  • File packages/cli/api/doctor/built-checks.test.mjs: clear.
  • File packages/cli/api/doctor/doctor.doc.mjs: clear.

Automated review (maintainer link)

let setup = known.get(sheet);
if (setup === undefined) {
const raw =
extensionOf(sheet) === '.css' ? byRel.get(sheet)?.read() : null;

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: only sheets in the scanned file list are classified, so astryx doctor --built src/main.tsx (one source file) and astryx doctor --built src with the sheet above src still report the setup sheet as page styling, while astryx doctor --built . on the same app does not. Resolving the joined path against the scanned folder and reading the sheet from disk when it is not in files, as doctorThemeWiring resolves local theme sheets against the scanned folder, would make the result independent of the path given.

@josephfarina
josephfarina marked this pull request as ready for review November 19, 2026 13:32
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 0a3647c

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/tweet-doctor-setup-stylesheet branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — 0a3647cc Deployed Nov 19, 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