Repository navigation
fix(cli): doctor warns when the theme's page color needs showing and nothing paints the page - #12469
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.
Approval waits on an owner decision: no current spec record covers the new theme-page-color doctor check, because AST-050 FR11 lists exactly ten theme checks. An engineering owner needs to provide or identify the record that governs this check, including what counts as painting the page and the fix doctor gives, and to record that decision with /approve-spec <full head SHA>; as an engineering owner, you can do this yourself once a record states it.
These need fixing either way:
theme-checks.mjs:2300counts<AppShell>only when it is imported from exactly@astryxdesign/core, so an app that imports it from@astryxdesign/core/AppShell, as every AppShell template does, is told to wrap the page in AppShell.- The check ignores the default theme's recorded
mode, so an app that passesthemeModes[defaultThemeSlug]to its rootTheme, which draws the page in that scheme through Core's reset, still gets the warning that its text sits on the browser's page color, and the changeset says the same. - The stylesheet pattern at
theme-checks.mjs:2288also matches custom properties such as:root { --sidebar-background: #222; }, so an app whose page nothing paints passes the check. lightSidere-implements the hex parsing and relative luminance thatnormalizeColorandluminanceinpackages/cli/api/theme/palette/generate/color.mjsalready provide, and it reads fewer color forms, so please call the shared helpers instead.- The description says the theme guide teaches a
body { background: var(--color-background-body) }rule for pages without AppShell, but no guide in the repository says that, so please drop or correct that sentence.
Separately, consider having the warning say what doctor did not find, not that nothing paints the page, because an inline body style or a utility class also warns.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: before this change, a dark-only theme with no AppShell and no page background got no doctor finding. Verified: the base has no such check.
- Claim: the new check warns, names the mode and gives the fix. Verified:
theme-checks.mjs:2316-2321and the test attheme-checks.test.mjs:2016. - Claim: a theme with a light and a dark page adds no check, and the ten healthy-app checks stay the same. Verified:
theme-checks.mjs:2274and the tests attheme-checks.test.mjs:2054,:789and:819. - Claim: regression tests cover the warning, the AppShell and body-background passes, and the two-mode case. Verified:
theme-checks.test.mjs:2016-2063. - Claim: the doctor test suite passes 300 tests. Verified: 300 of 300 at this head.
- Claim:
Themepaints no page andAppShellpaints the body color. Verified:AppShell.tsx:322. - Claim, in the description and changeset: in the other OS mode the theme's text sits on the browser's own page color. False for an app whose root
Themereceives the theme's mode (reset.css:381-387,Theme.tsx:315). - Claim: the theme guide tells a page without AppShell to add a body background rule. False: no guide in the repository says so.
- Claim: the fix says to wrap the page in AppShell or add the body rule. Verified:
theme-checks.mjs:2321. - Claim: no new public API, default or interaction model. Verified: no command doc, export or option changed.
- Claim: changesets are valid and the changed files typecheck. Verified: the changeset check passes, and the strict typecheck shows no error in the changed files.
- File
.changeset/doctor-one-mode-page-color.md: finding (its other-OS-mode claim overstates the case). - File
packages/cli/api/doctor/theme-checks.mjs: findings (subpath AppShell, mode wiring, custom-property match, copied color reading). - File
packages/cli/api/doctor/theme-checks.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
|
Owner decision (engineering owner, covering this pull request): |
|
/approve-spec a1765b2 |
|
/approve-spec 0bb9709 |
|
/approve-spec 72e51e9 |
There was a problem hiding this comment.
Changes requested. The direction is settled, since an engineering owner approved the app-themes record's new doctor check (FR11 item 11) at this head, so what remains is making the check follow that clause.
theme-checks.mjs:2313-2320counts anymode="light"/"dark"ormode={themeModes[…]}text in any file, so an app that renders<MediaTheme mode="dark">or a nested<Theme mode="light">is told its unpainted page is painted; find the root CoreThemewith the existing AST helpers, read itsmode, and acceptthemeModes[…]only when the default theme records a mode.lightSide(theme-checks.mjs:2220-2237) re-implements the CLI's hex and luminance helpers and reads only hex andrgb(), so a one-mode page colour written inoklch()orhsl()gets no check; callparseColorandluminancethrough the doctor adapter instead.- The CSS regex at
theme-checks.mjs:2288passes:root { --page-background: var(--color-background-body) }and a commented-out body rule; parse the stylesheet with postcss asglobalRulesdoes and match onlybackgroundorbackground-colordeclarations onhtml,bodyor:root. - The description says a theme guide teaches
body { background: var(--color-background-body) }, but no guide does; cite FR11 item 11 instead, or add that guidance to the theme guide here.
Please add a negative test for each case above. The earlier points on AppShell's own entry and the release-note wording are fixed.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Release note: doctor warns when the default theme is drawn for one mode and nothing paints the page. Verified:
theme-checks.mjs:2330-2336, test attheme-checks.test.mjs:2016. - Release note: AppShell, a page-colour body background or a fixed mode on the root
Themekeep the text readable. Verified for the mechanism (Theme.tsx:305-336,reset.css:381-391); the detection is broader than stated (finding 1). - Release note: the fix says to use AppShell or add the body rule. Verified; the fix text also offers the root
Thememode. - Description:
Themepaints no page and AppShell paints the page colour. Verified:Theme.tsx:83-96,AppShell.tsx:322. - Description: doctor reads the default theme's built page colour. Verified:
theme-checks.mjs:2203-2206,:2270. - Description: AppShell from the package or its own entry counts. Verified:
theme-checks.mjs:2299-2308and its tests. - Description: an
html,bodyor:rootbackground with the page colour counts. Verified, with false passes for custom properties and comments (finding 3). - Description: a root
Themegiven the theme's recorded mode counts. False as built: any element'smodetext counts (finding 1). - Description: the check warns and never fails. Verified:
theme-checks.mjs:2333. - Description: the app-themes record gains the check as item 11. Verified:
spec.md:285-291. - Description: the theme guide teaches the body rule. False: no guide does (finding 4).
- Description: a two-mode theme adds no check and the ten checks are unchanged. Verified:
theme-checks.mjs:2252-2253,:64-75, test attheme-checks.test.mjs:2110. - Description: regression tests cover each listed case. Verified:
theme-checks.test.mjs:2016-2119. - Description: the doctor tests pass. Verified: 302 pass at this head.
- Description: no new public API and no internal context. Verified.
Files:
.changeset/doctor-one-mode-page-color.md: clear.docs/specs/AST-050-app-themes/spec.md: clear; item 11 is owner-approved at this head.packages/cli/api/doctor/theme-checks.mjs: findings 1, 2 and 3.packages/cli/api/doctor/theme-checks.test.mjs: needs negative cases for findings 1 to 3.
|
/approve-spec 38aab11 |
There was a problem hiding this comment.
Changes requested. An engineering owner approved the app-themes record's new doctor check (FR11 item 11) at this head, so the direction is settled; what remains is making the check follow that clause.
fixed()intheme-checks.mjs(lines 2286-2300) never reads the default theme's recorded mode, so an app wired exactly astheme addprints,mode={themeModes[defaultThemeSlug] ?? 'system'}, is warned that nothing paints its page, whilemode={themeModes[defaultThemeSlug]}passes for a default theme that records no mode and therefore follows the OS; count thethemeModesforms only whentheme.modeis set, accept the??fallback, and add a test for each case.rootThemeFixesMode(lines 2272-2283) re-implements the Core element import scan thatimportedElementsinfoundation/discovery/module-exports.mjsalready provides, with its own source pattern besideCORE_THEME_SOURCES; extend that shared helper to report the outermost elements and call it through the doctor adapter instead.- The
light-dark()pair pattern at line 2346 cannot read a pair of functional colors, so a theme whose page islight-dark(oklch(0.2 0.02 250), oklch(0.15 0.02 250))gets no check; split the two arguments at the top-level comma and add anoklch()pair test. - The description says a theme guide teaches
body { background: var(--color-background-body) }, but no guide does; cite FR11 item 11 instead, or add that guidance to the theme guide here.
The earlier points on the shared color helpers, the parsed CSS, MediaTheme and nested Theme are fixed.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Release note: doctor warns when the default theme is drawn for one mode and nothing paints the page. Verified:
theme-checks.mjs:2420-2426, test attheme-checks.test.mjs:2016; it also warns for the wiringtheme addprints (finding 1). - Release note: AppShell, a page-color body background, or a fixed mode on the root
Themekeep the text readable. Verified for the mechanism (Theme.tsx:314-320); the detection of the rootThememode does not follow the recorded mode (finding 1). - Release note: the fix says to use AppShell or else add the body rule. Verified; the fix text also offers the root
Thememode (theme-checks.mjs:2425). - Description:
Themepaints no page and AppShell paints the page color. Verified:Theme.tsxwrapper styles,AppShell.tsx:322. - Description: doctor reads the default theme's built page color and checks only a one-mode page. Verified:
theme-checks.mjs:2206-2209,:2343-2353; functional-color pairs are not read (finding 3). - Description: AppShell from the package or its own entry counts. Verified:
theme-checks.mjs:2393-2402and its tests. - Description: an
html,bodyor:rootbackground with the page color counts. Verified:theme-checks.mjs:2235-2255, tests for custom properties and comments. - Description: a root
Themegiven the theme's recorded mode counts. False as built: the recorded mode is never read (finding 1). - Description: the check warns and never fails. Verified:
theme-checks.mjs:2423. - Description: the app-themes record gains the check as item 11. Verified:
spec.md:285-291. - Description: the theme guide teaches the body rule. False: no guide does (finding 4).
- Description: a two-mode theme adds no check and the healthy-app checks are unchanged. Verified: test at
theme-checks.test.mjs:2127. - Description: regression tests cover each listed case. Verified:
theme-checks.test.mjs:2016-2136. - Description: the doctor tests pass. Verified: 303 pass at this head.
- Description: no new public API and no internal context. Verified.
Files:
.changeset/doctor-one-mode-page-color.md: clear.docs/specs/AST-050-app-themes/spec.md: clear; item 11 is owner-approved at this head.packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: findings 1, 2 and 3.packages/cli/api/doctor/theme-checks.test.mjs: needs tests for findings 1 and 3.
|
/approve-spec 21c7115 |
There was a problem hiding this comment.
Changes requested. An engineering owner approved the app-themes record's new doctor check at this head, and the recorded-mode wiring, the shared element reader and light-dark() pairs of functional colors now work; three things still need fixing:
- The fix text at
packages/cli/api/doctor/theme-checks.mjs:2409always suggestsmode={themeModes[defaultThemeSlug]}, but for a one-mode theme that records no mode (such as the bundledgothic) the generated module has nothemeModesexport and following it leaves the warning, so suggest the literalmode="dark"ormode="light"in that case and test both texts. - Miss: the root-
Themetest (theme-checks.mjs:2388-2390) accepts the outermostThemeof any module, so a section component that renders<Theme theme={themes.ocean} mode="dark">under a rootThemewith no mode makes doctor report the page painted; count the fixed mode only on theThemethat takesthemes[defaultThemeSlug], and add a negative test. - The description says a theme guide teaches that the page color shows inside
AppShelland thebody { background: var(--color-background-body) }rule, but no guide does, so cite the record's new item 11 instead or add the guidance to the theme guide.
Minor: the pass message still names the theme's own mode when an opposite literal mode passed, the lightSide comment still says it reads only hex or rgb(), and the record's FR11 verification row and the test file header still count ten checks.
Claims and files checked
Review mode: incremental; reason: none
- Changeset: doctor warns when the default theme is drawn for one mode and nothing paints the page: verified (tests and probes).
- Changeset:
AppShell, a body background of the page color, or a fixed mode on the rootThemecount as painted: verified, with the root-Themegap above. - Changeset: the fix says to use
AppShellor the body rule: verified; the fix also names theThemeroute. - Description: doctor reads the built page color and acts only when both modes fall on one side, in any fixed color syntax: verified (hex,
rgb(),hsl(),oklch(), named colors andcolor-mix(); avar()value gets no check). - Description:
AppShellfrom either entry counts: verified (tests). - Description: an
html,bodyor:rootbackground of the page color counts, parsed as CSS: verified (tests; selector lists and@layerprobed). - Description: a root
Themewith a literal mode, or the recorded mode'sthemeModesentry alone or with?? 'system', counts: verified (tests and probes), with the root-Themegap above. - Description: the check warns and never fails: verified.
- Description: the record's check list gains item 11: verified.
- Description: a theme guide teaches the
AppShellpage color and the body rule: false (above). - Description: a theme with a light and a dark page adds no check: verified (test).
- Description: the regression tests cover the warning, both
AppShellentries, thethemeModesmode, body backgrounds and two-mode themes: verified. - Description: the doctor test suite passes: verified (304 tests at this head).
.changeset/doctor-one-mode-page-color.md: clear.docs/specs/AST-050-app-themes/spec.md: non-blocking, the FR11 verification row still counts ten faults.packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: the fix-text and root-Themefindings above.packages/cli/api/doctor/theme-checks.test.mjs: no test yet for either finding; its header still says ten checks.packages/cli/foundation/discovery/module-exports.mjs: clear.
|
/approve-spec a86b03a |
There was a problem hiding this comment.
Changes requested. An engineering owner approved the app-themes record's new doctor check at this head, and the last review's three points are fixed (the fix text fits a theme with no recorded mode, only the Theme that takes the default theme counts, and the description cites the record); one thing still needs fixing:
- Miss:
packages/cli/api/doctor/_adapter.mjs:463-466re-exportsparseColorandhexstatically fromapi/theme-edit/_color.mjs, which imports_tables.mjs, whosediscoverBundledThemes()call runs at load, so importing@astryxdesign/cli/apinow loads@babel/parserandpackages/cli/test/lazy-dependencies.test.mjsfails ("are not loaded by importing the API"); load the color helpers on first use with a dynamicimport(), asfontPackagesInstallLinein the same adapter does.
Minor: a test for the themeModes fix text would guard that branch, the pass message still names "the theme's own mode" after an opposite literal mode, the lightSide comment still says hex or rgb(), and the record's FR11 verification row and the test file header still count ten checks. CI on this head was cancelled because CI was full, so it needs a re-run.
Claims and files checked
Review mode: incremental; reason: none
-
changed rules (0): none
-
Changeset: doctor warns when the default theme is drawn for one mode and nothing paints the page: verified (tests; doctor run on a fixture).
-
Changeset:
AppShell, a body background of the page color, or a fixed mode on the rootTheme(the recordedthemeModesentry or a literal mode) count as painted: verified (tests and probes). -
Changeset: without one of them, the theme's text sits on the browser's own page color in the other OS mode: verified from Core (only the root
Thememarks the page, andAppShellpaints the page color). -
Changeset: the fix says to use
AppShellor the body rule: verified; the fix also names the rootThememode route. -
Description:
Themepaints no page andAppShellpaints--color-background-body: verified (Core source). -
Description: doctor reads the default theme's built page color and acts only when both modes fall on one side, in any color syntax: verified for every fixed color form (hex, named,
rgb(),hsl(),hwb(),lab(),lch(),oklab(),oklch(),color(),color-mix(),light-dark()pairs); avar()value adds no row. -
Description:
AppShellfrom either Core entry counts: verified (tests). -
Description: an
html,bodyor:rootbackground/background-colorthat uses the page color counts, parsed as CSS: verified (tests). -
Description: the outermost Core
Themethat takes the default theme counts with a literal mode, or with the recordedthemeModesentry alone or with?? 'system': verified (tests and probes); a non-root module that passes the default theme a fixed mode also counts. -
Description: the check warns and never fails: verified (the doctor run exits 0).
-
Description: the record's FR11 gains the check as item 11: verified.
-
Description: one new check, added only for a one-mode default theme, so a two-mode theme adds no row and the healthy-app checks are unchanged: verified (test).
-
Description: before, no finding; after, a warning that names the mode and gives the fix: verified (doctor run on a fixture).
-
Description: the regression tests cover the warning, both
AppShellentries, thethemeModesmode, body backgrounds and a two-mode theme: verified. -
Description: the doctor tests pass (300): verified that they pass; the suite has 305 tests.
-
Description: the CLI's other test folders, the typechecks and the changeset check pass: the typechecks and the changeset check pass; false for the CLI test folder, where the lazy-dependencies test fails at this head (above).
-
Description: no new public API, and no internal context in public text: verified (no public surface row changes; nothing internal found).
-
Description: the writing rubric results for item 11: verified (present tense, no history, references or status).
-
.changeset/doctor-one-mode-page-color.md: clear. -
docs/specs/AST-050-app-themes/spec.md: non-blocking, the FR11 verification row still counts ten faults. -
packages/cli/api/doctor/_adapter.mjs: the lazy-loading finding above. -
packages/cli/api/doctor/theme-checks.mjs: non-blocking, the pass message and thelightSidecomment. -
packages/cli/api/doctor/theme-checks.test.mjs: non-blocking, no test for thethemeModesfix text; the header still says ten checks. -
packages/cli/foundation/discovery/module-exports.mjs: clear.
|
/approve-spec 0087432 |
There was a problem hiding this comment.
Changes requested: this revision fixes the last review's finding (wrappers around the root Theme and around the app in the render call are now read, and the description's claim about the census is corrected), but one shape still draws the theme-page-color warning on a painted page.
- The wrapper walk returns at React's own wrappers without reading what they hold (
packages/cli/api/doctor/theme-checks.mjs:3145), so a full-viewport.backdrop { position: fixed; inset: 0; background: var(--color-background-body) }placed beside the rootThemeinside<Suspense>or<Fragment>(or beside the app inside<Suspense>in the render call) is never seen and doctor says nothing paints the page, while the same backdrop without the wrapper gives no row; reading a transparent wrapper's children (and JSX in its props) as a fragment's are read, with those rows added to the "elements around the root Theme" table test, fixes it.
The spec direction in FR11 item 12 is approved at this head, so this one fix stands between the pull request and approval.
Claims and files checked
Review mode: full; reason: history
- Claim (changeset): doctor warns when a one-mode default theme, or a local theme with its own page color, has nothing painting the page: verified by the warn and local-theme tests and a doctor run (exit 0).
- Claim (changeset): AppShell, a page-color body background, or the theme's own mode on the root Theme paints the page: verified by the pass tests.
- Claim (changeset and description): doctor warns only when it can prove nothing paints the page, and anything it cannot read stays silent: false for a backdrop inside a React wrapper (the finding above).
- Claim (changeset and description): a project that loads no Core reset gets no warning: verified by the embedded, story-only and commented-out reset tests.
- Claim (changeset): the fix names AppShell or the body rule: verified; for a one-mode theme it also names the root Theme's mode.
- Claim (description): AppShell from either entry, a postcss-read html, body or :root rule, and the root Theme's literal or recorded mode (alone or with a system fallback) count; the other mode warns: verified by tests.
- Claim (description): the spec gains FR11 item 12: verified in the record.
- Claim (description): Core reset detection shares the core-stylesheets probe: verified, both call one function.
- Claim (description): the census covers the page shell, the elements around the root Theme and the app in the render call, the elements beside them, Core's own Theme element and the root's subtree: verified for host elements and components; false for elements inside React's own wrappers beside the way (the finding above).
- Claim (description): reading the elements around the root Theme only adds to the census or adds a may-paint verdict, so it can only remove warnings: verified, the new reader never yields a pass and never removes an element.
- Claim (description): every row of the mechanism table has a test: verified against the test file.
- Claim (description): sample-app and page-template counts: not re-measured; they describe earlier revisions.
- Claim (description): a two-mode theme on its base's page color adds no check: verified by test.
- Claim (description): the doctor folder passes 372 tests: verified (372 here; 1,564 with the discovery and lazy-dependency suites).
- Claim (description): the type gate and changeset check are clean: verified for the template-docs, JSON API and authoring typechecks and the changeset check; the strict typecheck fails here only on an unbuilt theme package that two untouched templates import.
- File
packages/cli/api/doctor/theme-checks.mjs: the finding above. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear (lacks the wrapper rows the fix adds). - File
packages/cli/api/doctor/_adapter.mjs: clear. - File
packages/cli/api/doctor/built-checks.mjs: clear. - File
packages/cli/api/doctor/built-checks.test.mjs: clear. - File
packages/cli/api/doctor/doctor.mjs: clear. - File
packages/cli/foundation/discovery/module-exports.mjs: clear. - File
docs/specs/AST-050-app-themes/spec.md: clear. - File
.changeset/doctor-one-mode-page-color.md: clear once the finding is fixed.
4723e92 to
6fada6e
Compare
|
/approve-spec 6fada6e |
There was a problem hiding this comment.
Changes requested: this push rebases the branch onto current main with no change to its own patch, so the last review's finding still stands: one shape draws the theme-page-color warning on a painted page.
- The wrapper walk returns at React's own wrappers without reading what they hold (
packages/cli/api/doctor/theme-checks.mjs:3145), so a full-viewport.backdrop { position: fixed; inset: 0; background: var(--color-background-body) }placed beside the rootThemeinside<Suspense>or<Fragment>(or beside the app inside<Suspense>in the render call) is never seen and doctor says nothing paints the page, while the same backdrop without the wrapper gives no row; reading a transparent wrapper's children (and JSX in its props) as a fragment's are read, with those rows added to the "elements around the root Theme" table test, fixes it.
The spec direction in FR11 item 12 is approved at this head, so this one fix stands between the pull request and approval.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim (changeset): doctor warns when a one-mode default theme, or a local theme with its own page color, has nothing painting the page: verified by the warn and local-theme tests and a doctor run (exit 0).
- Claim (changeset): AppShell, a page-color body background, or the theme's own mode on the root Theme paints the page: verified by the pass tests.
- Claim (changeset and description): doctor warns only when it can prove nothing paints the page, and anything it cannot read stays silent: false for a backdrop inside a React wrapper (the finding above).
- Claim (changeset and description): a project that loads no Core reset gets no warning: verified by the embedded, story-only and commented-out reset tests.
- Claim (changeset): the fix names AppShell or the body rule: verified; for a one-mode theme it also names the root Theme's mode.
- Claim (description): AppShell from either entry, a postcss-read html, body or :root rule, and the root Theme's literal or recorded mode (alone or with a system fallback) count; the other mode warns: verified by tests.
- Claim (description): the spec gains FR11 item 12: verified in the record.
- Claim (description): Core reset detection shares the core-stylesheets probe: verified, both call one function.
- Claim (description): the census covers the page shell, the elements around the root Theme and the app in the render call, the elements beside them, Core's own Theme element and the root's subtree: verified for host elements and components; false for elements inside React's own wrappers beside the way (the finding above).
- Claim (description): reading the elements around the root Theme only adds to the census or adds a may-paint verdict, so it can only remove warnings: verified, the new reader never yields a pass and never removes an element.
- Claim (description): every row of the mechanism table has a test: verified against the test file.
- Claim (description): sample-app and page-template counts: not re-measured; they describe earlier revisions.
- Claim (description): a two-mode theme on its base's page color adds no check: verified by test.
- Claim (description): the doctor folder passes 372 tests: verified (372 here; 1,564 with the discovery and lazy-dependency suites).
- Claim (description): the type gate and changeset check are clean: verified for the template-docs, JSON API and authoring typechecks and the changeset check; the strict typecheck fails here only on an unbuilt theme package that two untouched templates import.
- File
packages/cli/api/doctor/theme-checks.mjs: the finding above. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear (lacks the wrapper rows the fix adds). - File
packages/cli/api/doctor/_adapter.mjs: clear. - File
packages/cli/api/doctor/built-checks.mjs: clear. - File
packages/cli/api/doctor/built-checks.test.mjs: clear. - File
packages/cli/api/doctor/doctor.mjs: clear. - File
packages/cli/foundation/discovery/module-exports.mjs: clear. - File
docs/specs/AST-050-app-themes/spec.md: clear. - File
.changeset/doctor-one-mode-page-color.md: clear once the finding is fixed.
6fada6e to
1700ea0
Compare
|
/approve-spec 1700ea0 |
There was a problem hiding this comment.
Changes requested: two fixes stand between this pull request and approval; the spec direction in FR11 item 12 is approved at this head.
- The wrapper walk returns at React's own wrappers without reading what they hold (
packages/cli/api/doctor/theme-checks.mjs:3145), so a page-color backdrop or a package component inside<Suspense>or<Fragment>beside the rootTheme(or beside the app inside<Suspense>in the render call) is never seen and doctor warns that nothing paints the page, while the same element without the wrapper gives no row; reading a transparent wrapper's children and the JSX in its props the way a fragment's are read, with those rows added to the "elements around the root Theme" table test, fixes it. - Regression:
mainnow names the same 5,000-file walk boundSOURCE_FILE_LIMITinpackages/cli/api/doctor/_adapter.mjs, where this branch names itPROJECT_FILE_LIMIT, so the branch conflicts withmainand cannot merge; rebase and keepmain's constant as the one bound for the loop and forcomplete.
Also, theme-checks.mjs:751 still calls the migration notice "not one of the eleven setup checks"; this change makes them twelve.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
- Claim (changeset): doctor warns when a one-mode default theme, or a local theme with its own page color, has nothing painting the page: verified by the warn and local-theme tests.
- Claim (changeset): AppShell, a page-color body background, or the theme's own mode on the root Theme paints the page: verified by the pass tests.
- Claim (changeset and description): doctor warns only when it can prove nothing paints the page, and anything it cannot read stays silent: false for elements inside React's wrappers beside the root Theme (the first finding).
- Claim (changeset and description): a project that loads no Core reset gets no warning: verified by the embedded, story-only and commented-out reset tests.
- Claim (changeset): the fix names AppShell or the body rule: verified; for a one-mode theme it also names the root Theme's mode.
- Claim (description): AppShell from either entry, a postcss-read html, body or :root rule, and the root Theme's literal or recorded mode (alone or with a system fallback) count, and the other mode warns: verified by tests.
- Claim (description): the page color is read in any color syntax: verified by the oklch and light-dark tests and by real builds of three bundled themes.
- Claim (description): the spec gains FR11 item 12: verified in the record.
- Claim (description): Core reset detection shares the core-stylesheets probe: verified, both call one function.
- Claim (description): the census covers the page shell, the elements around and beside the root Theme and the app, Core's own Theme element and the root's subtree: false for elements inside React's wrappers (the first finding).
- Claim (description): React's StrictMode, Suspense, Fragment and Profiler render nothing: true of their own elements, but the check also skips what they hold (the first finding).
- Claim (description): reading the elements around the root Theme only adds to the census or adds a may-paint verdict: verified, that reader never yields a pass.
- Claim (description): every row of the mechanism table has a test: verified against the test file.
- Claim (description): sample-app and page-template counts: not re-measured; they describe earlier revisions.
- Claim (description): a two-mode theme on its base's page color adds no check: verified by test.
- Claim (description): the doctor folder passes 372 tests: verified (372 here).
- Claim (description): the branch is rebased on current main: no longer true, main has moved and the branch conflicts (the second finding).
- Claim (description): the type gate and changeset check are clean: verified for the changeset check and the template-docs, JSON API and authoring typechecks; the strict typecheck fails here only on an unbuilt theme package that two untouched templates import.
- File
packages/cli/api/doctor/theme-checks.mjs: the first finding; one stale count in a comment. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear (lacks the wrapper rows the fix adds). - File
packages/cli/api/doctor/_adapter.mjs: the second finding (conflicts with main). - File
packages/cli/api/doctor/built-checks.mjs: clear. - File
packages/cli/api/doctor/built-checks.test.mjs: clear. - File
packages/cli/api/doctor/doctor.mjs: clear. - File
packages/cli/foundation/discovery/module-exports.mjs: clear. - File
docs/specs/AST-050-app-themes/spec.md: clear. - File
.changeset/doctor-one-mode-page-color.md: clear once the first finding is fixed.
1700ea0 to
e209bdb
Compare
|
/approve-spec e209bdb |
There was a problem hiding this comment.
Changes requested: one fix stands between this pull request and approval. The last review's two findings are fixed, and the record change has an engineering owner's approval for this head. Those findings were React wrappers beside the root Theme and the conflict with main.
- Miss: the page check walks the project without the walk's
skippedLinksandoutputAtRootsOnlyoptions (theme-checks.mjs:4364-4371), so a page painted from a linked folder or file, or from an app folder namedbuild,distorcoverage, is told nothing paints it, which FR11 item 12 rules out; pass both options, count a skipped link as may-paint as the button check does under INV41, and add a test per form.
Non-blocking: a Suspense fallback held in a variable or a conditional is skipped, while the same expression as a child may paint (see the inline note).
Claims and files checked
Review mode: full; reason: rebase
- Claims:
- Doctor warns when a one-mode theme, or a local theme with its own page color, has nothing painting the page: verified (
theme-checks.mjs:4352-4354,:4512-4547; tests "warns when a one-mode theme page…" and "warns when a local theme sets its own page color…"). - AppShell, a body background of the page color, or the theme's own mode on the root
Themepaints the page: verified (:4439-4448,:3731-3750,:4479-4483; AppShell, body-rule, literal-mode and recorded-mode tests). - Doctor warns only when it can prove nothing paints the page, and anything it cannot read stays silent: false for linked folders and files and for app folders named
build,distorcoverage(the blocking finding). - A project that loads no Core reset gets no warning: verified (
:4355; embedded, story-only and commented-out reset tests). - The fix names AppShell or the body rule (and the root
Theme's mode for a one-mode theme): verified (:4529,:4546). - The app-themes record gains the check as a new doctor item: verified (record lines 308-324, verification row line 492).
- Core reset detection shares the
core-stylesheetsprobe: verified (projectStylesheetLoad,doctor.mjs:592,theme-checks.mjs:4305). - React's own wrappers render nothing, and what they hold as children or as JSX in a prop is read: verified (
:3145-3164; four new table-test rows). - Stories, tests and their setup are skipped before any read: verified (
:4379,:4396,:4305). - A project larger than the 5,000-file walk may paint: verified (
:4371; test "stays silent when the project is larger than the walk reads"). - No page template holds the root
Themeor a render call: verified (none of the 58 page templates does). - The listed regression tests exist and the doctor folder passes 396 tests: verified (396 passed at this head).
- The type gate and the changeset check are clean: verified for the changeset check and the template-docs, JSON-API and authoring typechecks. The strict typecheck reports only an unbuilt theme module in two untouched templates.
- The sample-app and template counts, measured at an earlier revision: not re-measured; the template count matches.
- Doctor warns when a one-mode theme, or a local theme with its own page color, has nothing painting the page: verified (
- Files:
.changeset/doctor-one-mode-page-color.md: its "warns only when it can prove" sentence is false through the blocking finding; otherwise clear.docs/specs/AST-050-app-themes/spec.md: clear (owner-approved for this head).packages/cli/api/doctor/_adapter.mjs: clear; it merges cleanly withmainand uses its file bound.packages/cli/api/doctor/built-checks.mjs: clear.packages/cli/api/doctor/built-checks.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: blocking finding at:4364-4371; non-blocking note at:3158-3162.packages/cli/api/doctor/theme-checks.test.mjs: clear; it needs tests for the linked and output-folder forms.packages/cli/foundation/discovery/module-exports.mjs: clear.
| const walk = walkProjectSourceFiles(projectDir, '', { | ||
| stylesheets: true, | ||
| pages: true, | ||
| styleSources: true, | ||
| unparsed: UNPARSED_COMPONENT_FILE, | ||
| }); | ||
| // (A project larger than the walk reads: what it left may paint.) | ||
| if (!walk.complete) mayPaint = true; |
There was a problem hiding this comment.
Miss: this walk leaves out linked folders and files (_adapter.mjs:376-388) and every build, dist or coverage folder (SKIP_DIRS), and complete tracks only the 5,000-file bound. So a createGlobalStyle body rule in a linked src/shared/, in a linked module file or in src/build/ draws warn. The same file in src/styles/ gives no row. Pass outputAtRootsOnly: true and a skippedLinks array, and set mayPaint when a link is collected, as findButtonsWithoutAction does under INV41. That keeps the warning to proven cases. Add a test per form.
| else if ( | ||
| a.value?.type === 'JSXExpressionContainer' && | ||
| /^JSX(?:Element|Fragment)$/.test(a.value.expression?.type ?? '') | ||
| ) | ||
| judge(a.value.expression); |
There was a problem hiding this comment.
Non-blocking: a fallback held in a variable or a conditional (fallback={fb}, fallback={wait ? <div className="backdrop" /> : null}) is skipped here. The same expression as a child opens the census (line 3114). Reading any other expression in fallback as may-paint keeps the two paths alike.
…nothing paints the page [skip ci]
e209bdb to
646e645
Compare
|
/approve-spec 646e645 |
There was a problem hiding this comment.
Changes requested: one fix stands between this pull request and approval, the same one the last review raised. The record change has an engineering owner's approval for this head, and the rebased branch merges cleanly with main.
- Miss: the page check still walks the project without the walk's
skippedLinksandoutputAtRootsOnlyoptions (theme-checks.mjs:4372-4377), so a page painted from a linked folder or file, or from an app folder namedbuild,distorcoverage, is told nothing paints it, which FR11 item 12 rules out; pass both options, count a skipped link as may-paint as the button check does, and add a test for each form.
Non-blocking: the new last-declaration read of the theme's page color also takes a declaration inside @media, and a Suspense fallback held in a variable or a conditional is still skipped (see the inline notes).
Claims and files checked
Review mode: full; reason: rebase
- Claims:
- Doctor warns when a one-mode theme, or a local theme with its own page color, has nothing painting the page: verified (
theme-checks.mjs:4360-4363,:4520-4555; the one-mode and local-theme warn tests). - AppShell, a body background of the page color, or the theme's own mode on the root
Themepaints the page, and the other mode warns: verified (:4447-4456,:4486-4499; AppShell, body-rule, literal-mode, recorded-mode and opposite-mode tests). - Doctor warns only when it can prove nothing paints the page, and anything it cannot read stays silent: false for linked folders and files and for app folders named
build,distorcoverage(the blocking finding). - A project that loads no Core reset gets no warning: verified (
:4363,:4310-4317; embedded, story-only and commented-out reset tests). - The fix names AppShell, the theme's mode on the root
Theme, or the body rule: verified (:4537-4554). - The app-themes record gains the check as doctor item 12, with the verification row updated: verified.
- Core reset detection shares the
core-stylesheetsprobe, with unchanged behavior: verified (doctor.mjs:592,theme-checks.mjs:4271-4302). - Each row of the description's table of ways CSS reaches the page has a test: verified for the rows; the table's rule is false only through the blocking finding.
- Stories, tests and their setup are skipped before any read, and a project past the 5,000-file walk stays silent: verified (
:4387-4388,:4404,:4379; tests). - A two-mode theme on its base's page color adds no check: verified (test).
- No page template holds the root
Themeor a render call: verified (none of the 58 does). - The doctor folder passes 398 tests: verified (398 passed).
- The type gate and the changeset check are clean: verified for the changeset check and three typechecks; the strict typecheck reports only an unbuilt theme package in two untouched templates.
- The sample-app and template measurements from an earlier revision: not re-measured.
- Doctor warns when a one-mode theme, or a local theme with its own page color, has nothing painting the page: verified (
- Files:
.changeset/doctor-one-mode-page-color.md: its "anything it cannot read stays silent" sentence is false through the blocking finding; otherwise clear.docs/specs/AST-050-app-themes/spec.md: clear (owner-approved for this head).packages/cli/api/doctor/_adapter.mjs: clear.packages/cli/api/doctor/built-checks.mjs: clear.packages/cli/api/doctor/built-checks.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/api/doctor/theme-checks.mjs: blocking finding at:4372-4377; non-blocking notes at:4167-4171and:3155-3163.packages/cli/api/doctor/theme-checks.test.mjs: clear; it needs tests for the linked and output-folder forms.packages/cli/foundation/discovery/module-exports.mjs: clear.
| */ | ||
| function pageColorDeclaration(css) { | ||
| return ( | ||
| customPropertyValues(css).get('--color-background-body')?.at(-1) ?? null |
There was a problem hiding this comment.
Non-blocking: this takes the last --color-background-body anywhere in the stylesheet, inside @media too, and Core writes a theme's adaptation tokens there, after the root rule. A two-mode theme followed by @media (prefers-contrast: more) { [data-astryx-theme="ocean"] { --color-background-body: #000; } } is then told it is drawn for dark mode only. Reading only declarations outside at-rules other than @layer and @scope keeps the last-declaration rule to the theme's base value.
User impact
An app whose default theme is drawn for one mode only (its page color is dark in both modes, or light in both) and whose page is painted by neither
AppShellnor a body background shows that theme's text on the browser's own page color in the other OS mode. With a dark-only theme in a light OS mode, that is pale text on white: the page reads as blank. Nothing told the developer.A second trigger: a local theme that sets its own page color (its built page color is none of those in the stylesheets of the base package its built module imports) warns when no AppShell renders and no body rule takes the page color, since the color chosen never shows. A project that loads no
@astryxdesign/core/reset.cssis embedded in a page it does not own, and gets neither warning.Problem and solution fit
Themesets tokens and paints no page;AppShellpaints--color-background-body. A page built from stacks or layouts directly insideThemehas no painted page.Doctor now reads the default theme's built page color. When both modes fall on one side (dark or light, any color syntax), it looks for an
AppShellrender (from@astryxdesign/coreor@astryxdesign/core/AppShell), a stylesheet whosehtml,bodyor:rootbackground/background-coloruses--color-background-body(parsed with postcss), or the outermost CoreThemethat takesthemes[defaultThemeSlug], given the theme's own mode: the literal of that mode, or the recorded mode'sthemeModes[…], alone or?? 'system'astheme addwires it (the other mode warns). If none exists, it warns, never fails. AST-050 FR11 gains the check as item 12.It warns only when it proves nothing paints the page: anything it cannot read (a class, StyleX, spread props, a component it cannot follow, a preprocessor stylesheet, a page's own
<style>, a CSS-in-JS global) stays silent. Core reset detection shares thecore-stylesheetsprobe.Every way CSS reaches the page
The rule. The check warns only on proof that nothing paints the page.
<html>or<body>unconditionally. Every compound of its selector, ancestors included, and any@scoperoot around it, must be onlyhtml,body,:rootor this theme's own root attribute, unnarrowed. No at-rule other than@layermay wrap it.::selection,::backdrop;::before/::aftercan be one). The census covers<html>,<body>, the mount node in the page shell (index.htmlor a JSX<body>), the elements around the rootThemeand around the app in the entry's render call (<div className="app">in the root module or inmain.tsx, JSX inside a prop included), the elements the app's own components put around the way from the render call to the rootTheme(followed through relative imports), the elements beside each of those (a backdrop beside the rootThemecan be a page layer), thedivCore'sThemerenders itself (with its theme attributes), the element the rootThemewraps, and every element inside it. An element around or beside the rootThemeor the app is also judged by its own styling: an inline page-color background, StyleX, a spread or a class from an expression may paint the page, so the check stays silent (only the root element's own page color counts as painting it). React's ownStrictMode,Suspense,FragmentandProfilerrender no element of their own; what they hold, as children or as JSX in a prop such asfallback, is read like any other element. Any other component around them (from the app, a package or Core) may render and paint an element of its own: it opens the census and may paint. A facet doctor cannot read (a component at any depth inside the root element, a component wrapper or neighbour, a way from the render call to the rootThemethat goes through a package or a path alias, a Core component's own elements, an app the render call holds in a variable, a class from an expression, or no page shell at all) proves nothing.*, attribute or pseudo-class prefixes,@scoperelatives, descendants such asbody div, siblings such ashead ~ *, and the root element's own tag.:is()/:where()subject included, is judged part by part. In a CSS Modules file (*.module.*):global(…)is the selector it holds. This theme's root attribute is the name its stylesheet scopes itself by, asThemewrites it (the slug only when the stylesheet names none). The page token is matched by its exact name.Measured at the previous head against the one before it, on the same inputs: the 24 sample apps give the same result row for row (the check shows in 2, both pass; no warnings), and the 58 page templates under a one-mode theme with nothing wired to paint the page give the same result template for template (5 pass, 37 warn, 16 silent). The rows that move from silent to warning in the table test (
html #app,html [data-root],[data-mode]) move because the page shell shows those are not on the page; none of the apps or templates has such a rule. Reading the elements around the rootThemeand the app only adds to the census or adds a may-paint verdict, so it can only turn a warning into silence (no longer counting Storybook and test-setup files can turn a pass into a warning, by design): the sample apps had no warning to lose, and no page template holds the rootThemeor a render call, so no template result can move. The table below lists each way CSS reaches the page under that rule.Each mechanism below is either read (doctor follows it and judges its rules) or may paint (doctor stops and stays silent). Every row has a test in
theme-checks.test.mjs..cssfile--color-background-body):html,body,:root,html body,:where(body),html, body,body, .card,:is(body, .x),[data-astryx-theme="<this theme>"],@scope (body) { :scope {} },:global(body)in a.module.css. Cannot paint:body .card,#app .card(no#appin the shell),aside,a[href="#top"],input:is([type]),.list > [data-x],[data-mode],::selection,.card::before,@scope (.card) { div {} }. May paint: everything else, for examplebody.dark,body::before,html.dark body,#root,body > #root,*,body > *,[data-theme="dark"] > *,:hover,:dir(ltr),body div,head ~ *,@scope (body) { > div {} },main(the root element's tag), and any class or tag when the census is open@layer(@media,@supports,@container,@document,@starting-style, vendor forms included, around the rule or nested in it)@applyin a page rule@tailwind base,@unocss); a vendor-prefixed one (@-moz-keyframes) is the at-rule it names, and the sub-blocks of@font-feature-valuesand@pageare CSS@import(quoted orurl())import/dynamicimport()/require()of a stylesheet (any language, any query such as?url/?inline)import(`${kit}/base.css`)) may paintmain,style, orexportsunderstyle/import/default/require)vite.config,webpack.config)angular.json,project.json)@use,@forward,@import,@require,meta.load-css()(comma lists, unquoted,url(), Less options)sass:built-ins load nothing@apply<link rel="stylesheet">(quoted, unquoted, or a JSX expression)<link rel="preload" as="style"><style>, or a style/class on<html>/<body><body>/<html>(Next.js layouts)links(), unheaduseHead({link}), Nuxthead.link, Next<Head><link>, react-helmet<link>(any object withrel: 'stylesheet', any JSX<link>)createGlobalStyle,injectGlobal,globalStyle,globalCss,defineGlobalStyles,:global,<Global…>such as MUI's<GlobalStyles>, a rendered<style>)<script>(one pattern for both:document.createElement('style'/'link'),new CSSStyleSheet,replaceSync,insertRule,document.adoptedStyleSheets,document.body/documentElement,querySelector('body'),getElementsByTagName('html'), or a class, style or attribute written on an element the module looks up, such as the mount node)<app-frame>) in the page shell, around or inside the rootTheme, or around the appTheme(a backdrop root)addBase, UnoCSSpreflights).vue,.svelte,.astro,.mdx,.marko,.riot,.ejs,.hbs,.mustache,.njk,.pug,.liquid,.twig,.erb,.haml,.slim)Theme:AppShell, the root element's own background, the theme's mode, the elements around it and around the app in the render call{children}or an unevaluable mode may paint*.stories.*,*.test.*,*.spec.*,setupTests.*,vitest.setup.*,jest.setup.*,__tests__/,stories/,.storybook/, by path inside the project)Expected behavior and authority
AST-050 FR11 item 12 (added here) states the rule: a default theme drawn for one mode has its page painted by
AppShell, anhtml/body/:rootbackground that uses--color-background-body, or the rootThemegiven the theme's own mode; otherwise doctor warns, with the fix to useAppShellor addbody { background: var(--color-background-body) }.Smallest restoration
One new doctor check,
theme-page-color, added only when the default theme needs its page color shown: its page is one-mode, or it is a local theme with its own page color, different from its base's. A two-mode theme on its base's page color adds no check, so the healthy-app check list is unchanged.Evidence
AppShelland no body background gets no doctor finding.theme-page-colorwarns, names the mode, and gives the fix (wrap inAppShell, or the body rule).AppShellfrom either entry; pass with the themeModes mode on Theme; pass with a body background of the page color, warn with another body background; no check for a two-mode theme.Scope
Components: cli doctor (theme checks)
Testing
CI=1 vitest run --project node packages/cli/api/doctor/withfoundation/discovery/andtest/lazy-dependencies(the doctor folder, rebased on current main: 398 pass);packages/cli/test/andpackages/cli/api/theme/; the type gate (five cli typechecks and sync:api-types, clean); check:changesets.Writing rubric results
AST-050 FR11 gains item 12, covering both triggers and the embedded exemption.
What the check does not cover
With a render call, the check follows it to the root
Themethrough the app's own modules, and the component on that way must return the rootThemeitself. With no render call (a Next.js layout, or a root module alone), it reads the rootThemeand the page shell it finds: anindex.htmlor a JSX<body>. Anything else counts as may paint, and the check stays silent:Theme;Themethat doctor does not follow, including another component of the rootTheme's module on the way (a frame, a backdrop);:root { color-scheme: dark },<html style={{colorScheme: 'dark'}}>);So an app that does paint its page never gets this warning, and some apps that do not paint it get no warning either.
preflight: pass 646e645