Repository navigation
fix(cli): doctor --built reads the setup stylesheet as wiring, not page styling - #12887
josephfarina wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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
--builtoption text inpackages/cli/api/doctor/doctor.doc.mjsstill 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 --builtno 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
doctorStylesheetOnlyLoadsandastryxSetupStylesheets. - 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,@layerorder statements and comments count as wiring. Verified in the code and by probing edge cases. - Description: a rule, a
@layerblock 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.cssfinding goes away and the other findings stay. Verified on an equivalent fixture app. .changeset/doctor-setup-stylesheet.md: clearpackages/cli/api/doctor/_adapter.mjs: clearpackages/cli/api/doctor/built-checks.mjs: clearpackages/cli/api/doctor/built-checks.test.mjs: clear
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]
aae35eb to
510e56c
Compare
fa67c3c to
0a3647c
Compare
There was a problem hiding this comment.
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.tsxreports the import thatastryx 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 --builtno 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-426and:434-435. - Claim (description): on the base,
import './index.css'insrc/main.tsxwas flagged for a setup-only sheet. Verified: base run reportssrc/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
@layerorder line, four imports, a comment) is not flagged at this head. - Claim (description): only
@imports of Astryx packages' CSS plus@layerorder 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
@layerblock, 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
--builtoption 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.cssfinding. - Claim (test plan): on a new Vite app the
./index.cssfinding 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.
| let setup = known.get(sheet); | ||
| if (setup === undefined) { | ||
| const raw = | ||
| extensionOf(sheet) === '.css' ? byRel.get(sheet)?.read() : null; |
There was a problem hiding this comment.
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.
|
/approve-spec 0a3647c |
- #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
|
Landed in #12992. |
Stack: #12886 → #12887
astryx doctor --built .flaggedimport './index.css'insrc/main.tsxas "imports the stylesheet: use component props and tokens", even whenindex.cssholds 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@layerorder 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@layerblock, 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--builtoption text names both exceptions. Behavior stays within AST-041 FR7.Test plan
built-checks.test.mjs: the setup sheet is not flagged; sheets with a rule, a non-Astryx import, or a@layerblock, and a bare import, still are.built-checks.test.mjspasses locally (CI=1).src/main.tsximporting./index.cssgoes away; the other findings are unchanged.preflight: pass 0a3647c