Skip to content

fix(cli): doctor warns when the theme's page color needs showing and nothing paints the page - #12469

Closed
josephfarina wants to merge 1 commit into
mainfrom
fix/doctor-one-mode-page-color
Closed

josephfarina wants to merge 1 commit into
mainfrom
fix/doctor-one-mode-page-color

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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 AppShell nor 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.css is embedded in a page it does not own, and gets neither warning.

Problem and solution fit

  • Why does it occur? Theme sets tokens and paints no page; AppShell paints --color-background-body. A page built from stacks or layouts directly inside Theme has no painted page.
  • Why does it harm the task? A two-mode theme draws readable text for whichever page the OS picks, so the gap hides. A one-mode theme draws its text for its own page only, so the other OS mode is unreadable.
  • Why does that matter? The app looks broken for every user in that OS mode, and Astryx never paints the host page, so only the app can fix it.

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 AppShell render (from @astryxdesign/core or @astryxdesign/core/AppShell), a stylesheet whose html, body or :root background/background-color uses --color-background-body (parsed with postcss), or the outermost Core Theme that takes themes[defaultThemeSlug], given the theme's own mode: the literal of that mode, or the recorded mode's themeModes[…], alone or ?? 'system' as theme add wires 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 the core-stylesheets probe.

Every way CSS reaches the page

The rule. The check warns only on proof that nothing paints the page.

  • A background rule paints the page only when it paints <html> or <body> unconditionally. Every compound of its selector, ancestors included, and any @scope root around it, must be only html, body, :root or this theme's own root attribute, unnarrowed. No at-rule other than @layer may wrap it.
  • A rule cannot paint the page only when its subject (the compound after the last combinator) carries something the project's census shows is on none of the elements that can be the page or cover it: a tag, a class, an id or an attribute, or a pseudo-element that is no page layer (::selection, ::backdrop; ::before/::after can be one). The census covers <html>, <body>, the mount node in the page shell (index.html or a JSX <body>), the elements around the root Theme and around the app in the entry's render call (<div className="app"> in the root module or in main.tsx, JSX inside a prop included), the elements the app's own components put around the way from the render call to the root Theme (followed through relative imports), the elements beside each of those (a backdrop beside the root Theme can be a page layer), the div Core's Theme renders itself (with its theme attributes), the element the root Theme wraps, and every element inside it. An element around or beside the root Theme or 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 own StrictMode, Suspense, Fragment and Profiler render no element of their own; what they hold, as children or as JSX in a prop such as fallback, 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 root Theme that 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.
  • Every other rule may paint, and the check stays silent. That covers bare *, attribute or pseudo-class prefixes, @scope relatives, descendants such as body div, siblings such as head ~ *, and the root element's own tag.
  • A selector list, an :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, as Theme writes 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 root Theme and 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 root Theme or 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.

Mechanism Verdict
A background declaration in a .css file judged by the rule above, against its full selector (nesting resolved) with the CLI's selector parser and the census. Paints (with --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 #app in 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 example body.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
A page declaration under any at-rule but @layer (@media, @supports, @container, @document, @starting-style, vendor forms included, around the rule or nested in it) may paint
An @apply in a page rule may paint
An at-rule CSS does not define (@tailwind base, @unocss); a vendor-prefixed one (@-moz-keyframes) is the at-rule it names, and the sub-blocks of @font-feature-values and @page are CSS may paint
A CSS @import (quoted or url()) read when it resolves into the walked files; a package, URL, root-absolute, protocol-relative or skipped path may paint. Astryx packages, the registered themes' stylesheets and Google/Bunny fonts are skipped
A JS import/dynamic import()/require() of a stylesheet (any language, any query such as ?url/?inline) read when it resolves into the walked files; a package, a path outside the walk, or a template with a value in it (import(`${kit}/base.css`)) may paint
A module doctor cannot parse may paint
A bare package whose entry is a stylesheet (main, style, or exports under style/import/default/require) may paint
A stylesheet path a module names as a string (bundler entries, vite.config, webpack.config) read when walked, else may paint
A stylesheet listed in a root JSON config (angular.json, project.json) read when walked, else may paint
Sass/Less/Stylus @use, @forward, @import, @require, meta.load-css() (comma lists, unquoted, url(), Less options) a walked partial is followed; any other load may paint; sass: built-ins load nothing
A preprocessor file naming the page with a background, or using @apply may paint
HTML <link rel="stylesheet"> (quoted, unquoted, or a JSX expression) read when walked; CDN, package or unreadable hrefs may paint
HTML <link rel="preload" as="style"> may paint
HTML <style>, or a style/class on <html>/<body> may paint
A JSX <body>/<html> (Next.js layouts) read by its own attributes; a class, StyleX or spread may paint
Framework head APIs: Remix/React Router links(), unhead useHead({link}), Nuxt head.link, Next <Head><link>, react-helmet read like a <link> (any object with rel: 'stylesheet', any JSX <link>)
CSS-in-JS globals (createGlobalStyle, injectGlobal, globalStyle, globalCss, defineGlobalStyles, :global, <Global…> such as MUI's <GlobalStyles>, a rendered <style>) may paint
Sheets added or the page styled at run time, in a module or a page's inline <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) may paint
A custom element (<app-frame>) in the page shell, around or inside the root Theme, or around the app may paint (its shadow content is not read)
A second render call whose tree never reaches the root Theme (a backdrop root) may paint
A CSS generator's base layer in config (Tailwind addBase, UnoCSS preflights) may paint
A component or page-template language doctor does not parse (.vue, .svelte, .astro, .mdx, .marko, .riot, .ejs, .hbs, .mustache, .njk, .pug, .liquid, .twig, .erb, .haml, .slim) may paint
The root Theme: AppShell, the root element's own background, the theme's mode, the elements around it and around the app in the render call read; a class, StyleX, spread, an unfollowable component, {children} or an unevaluable mode may paint
Stories, tests and their setup (*.stories.*, *.test.*, *.spec.*, setupTests.*, vitest.setup.*, jest.setup.*, __tests__/, stories/, .storybook/, by path inside the project) skipped before any read: nothing in them counts for the app
A project larger than the 5,000-file walk may paint
A project that loads no Core reset (embedded in someone else's page); a reset loaded only by a story or a test does not count no check

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, an html/body/:root background that uses --color-background-body, or the root Theme given the theme's own mode; otherwise doctor warns, with the fix to use AppShell or add body { 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

  • Before: a dark-only theme in an app with no AppShell and no body background gets no doctor finding.
  • After: theme-page-color warns, names the mode, and gives the fix (wrap in AppShell, or the body rule).
  • Unchanged path: a two-mode theme on its base's page color adds no check; the eleven healthy-app theme checks stay as they were.
  • Regression tests: warn case; pass with AppShell from 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)

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

Testing

CI=1 vitest run --project node packages/cli/api/doctor/ with foundation/discovery/ and test/lazy-dependencies (the doctor folder, rebased on current main: 398 pass); packages/cli/test/ and packages/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.

  • R1: the item states what doctor checks and when it passes, in the present tense. No change needed.
  • R2: no research. No change needed.
  • R3: no evidence cell. No change needed.
  • R4: no rejected alternative. No change needed.
  • R5: no pull request or issue reference. No change needed.
  • R6: no open question. No change needed.
  • R7: no project status. No change needed.

What the check does not cover

With a render call, the check follows it to the root Theme through the app's own modules, and the component on that way must return the root Theme itself. With no render call (a Next.js layout, or a root module alone), it reads the root Theme and the page shell it finds: an index.html or a JSX <body>. Anything else counts as may paint, and the check stays silent:

  • a render call whose app doctor cannot read (an app held in a variable or built by a call), or a second root that never reaches the root Theme;
  • any component, custom element or expression around, beside or inside the root Theme that doctor does not follow, including another component of the root Theme's module on the way (a frame, a backdrop);
  • an app's own page color scheme (:root { color-scheme: dark }, <html style={{colorScheme: 'dark'}}>);
  • styles a script adds or writes at run time, in any form doctor's pattern does not name.

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

@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 19, 2026 10:46pm 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 19, 2026, 11:05 PM UTC

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

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:2300 counts <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 passes themeModes[defaultThemeSlug] to its root Theme, 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:2288 also matches custom properties such as :root { --sidebar-background: #222; }, so an app whose page nothing paints passes the check.
  • lightSide re-implements the hex parsing and relative luminance that normalizeColor and luminance in packages/cli/api/theme/palette/generate/color.mjs already 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-2321 and the test at theme-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:2274 and the tests at theme-checks.test.mjs:2054, :789 and :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: Theme paints no page and AppShell paints 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 Theme receives 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.

Automated review (maintainer link)

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · cbb3d03

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.51 MB packed (+19.7 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.

Current run: CI concluded cancelled; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): astryx doctor warns, and never fails, when a one-mode theme's page color paints nowhere. The page counts as painted when the app uses AppShell, or when an html or body background uses --color-background-body. The fix doctor gives is to use AppShell or to add body { background: var(--color-background-body) }. spec:AST-050 FR11 gains this check in one line, and the check reports nothing on the bundled templates.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a1765b2

@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 0bb9709

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 17, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 72e51e9

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 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 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-2320 counts any mode="light"/"dark" or mode={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 Core Theme with the existing AST helpers, read its mode, and accept themeModes[…] 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 and rgb(), so a one-mode page colour written in oklch() or hsl() gets no check; call parseColor and luminance through the doctor adapter instead.
  • The CSS regex at theme-checks.mjs:2288 passes :root { --page-background: var(--color-background-body) } and a commented-out body rule; parse the stylesheet with postcss as globalRules does and match only background or background-color declarations on html, body or :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 at theme-checks.test.mjs:2016.
  • Release note: AppShell, a page-colour body background or a fixed mode on the root Theme keep 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 Theme mode.
  • Description: Theme paints 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-2308 and its tests.
  • Description: an html, body or :root background with the page colour counts. Verified, with false passes for custom properties and comments (finding 3).
  • Description: a root Theme given the theme's recorded mode counts. False as built: any element's mode text 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 at theme-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.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 38aab11

@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. 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() in theme-checks.mjs (lines 2286-2300) never reads the default theme's recorded mode, so an app wired exactly as theme add prints, mode={themeModes[defaultThemeSlug] ?? 'system'}, is warned that nothing paints its page, while mode={themeModes[defaultThemeSlug]} passes for a default theme that records no mode and therefore follows the OS; count the themeModes forms only when theme.mode is set, accept the ?? fallback, and add a test for each case.
  • rootThemeFixesMode (lines 2272-2283) re-implements the Core element import scan that importedElements in foundation/discovery/module-exports.mjs already provides, with its own source pattern beside CORE_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 is light-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 an oklch() 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 at theme-checks.test.mjs:2016; it also warns for the wiring theme add prints (finding 1).
  • Release note: AppShell, a page-color body background, or a fixed mode on the root Theme keep the text readable. Verified for the mechanism (Theme.tsx:314-320); the detection of the root Theme mode 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 Theme mode (theme-checks.mjs:2425).
  • Description: Theme paints no page and AppShell paints the page color. Verified: Theme.tsx wrapper 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-2402 and its tests.
  • Description: an html, body or :root background with the page color counts. Verified: theme-checks.mjs:2235-2255, tests for custom properties and comments.
  • Description: a root Theme given 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.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 21c7115

@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. 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:2409 always suggests mode={themeModes[defaultThemeSlug]}, but for a one-mode theme that records no mode (such as the bundled gothic) the generated module has no themeModes export and following it leaves the warning, so suggest the literal mode="dark" or mode="light" in that case and test both texts.
  • Miss: the root-Theme test (theme-checks.mjs:2388-2390) accepts the outermost Theme of any module, so a section component that renders <Theme theme={themes.ocean} mode="dark"> under a root Theme with no mode makes doctor report the page painted; count the fixed mode only on the Theme that takes themes[defaultThemeSlug], and add a negative test.
  • The description says a theme guide teaches that the page color shows inside AppShell and the body { 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 root Theme count as painted: verified, with the root-Theme gap above.
  • Changeset: the fix says to use AppShell or the body rule: verified; the fix also names the Theme route.
  • 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 and color-mix(); a var() value gets no check).
  • Description: AppShell from either entry counts: verified (tests).
  • Description: an html, body or :root background of the page color counts, parsed as CSS: verified (tests; selector lists and @layer probed).
  • Description: a root Theme with a literal mode, or the recorded mode's themeModes entry alone or with ?? 'system', counts: verified (tests and probes), with the root-Theme gap 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 AppShell page 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 AppShell entries, the themeModes mode, 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-Theme findings 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.

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec a86b03a

@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. 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-466 re-exports parseColor and hex statically from api/theme-edit/_color.mjs, which imports _tables.mjs, whose discoverBundledThemes() call runs at load, so importing @astryxdesign/cli/api now loads @babel/parser and packages/cli/test/lazy-dependencies.test.mjs fails ("are not loaded by importing the API"); load the color helpers on first use with a dynamic import(), as fontPackagesInstallLine in 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 root Theme (the recorded themeModes entry 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 Theme marks the page, and AppShell paints the page color).

  • Changeset: the fix says to use AppShell or the body rule: verified; the fix also names the root Theme mode route.

  • Description: Theme paints no page and AppShell paints --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); a var() value adds no row.

  • Description: AppShell from either Core entry counts: verified (tests).

  • Description: an html, body or :root background/background-color that uses the page color counts, parsed as CSS: verified (tests).

  • Description: the outermost Core Theme that takes the default theme counts with a literal mode, or with the recorded themeModes entry 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 AppShell entries, the themeModes mode, 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 the lightSide comment.

  • packages/cli/api/doctor/theme-checks.test.mjs: non-blocking, no test for the themeModes fix text; the header still says ten checks.

  • packages/cli/foundation/discovery/module-exports.mjs: clear.

Automated review (maintainer link)

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

Copy link
Copy Markdown
Contributor Author

/approve-spec 0087432

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

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 root Theme inside <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.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the fix/doctor-one-mode-page-color branch from 4723e92 to 6fada6e Compare November 19, 2026 15:21
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 6fada6e

@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: 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 root Theme inside <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.

Automated review (maintainer link)

@josephfarina
josephfarina force-pushed the fix/doctor-one-mode-page-color branch from 6fada6e to 1700ea0 Compare November 19, 2026 16:31
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1700ea0

@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 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 root Theme (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: main now names the same 5,000-file walk bound SOURCE_FILE_LIMIT in packages/cli/api/doctor/_adapter.mjs, where this branch names it PROJECT_FILE_LIMIT, so the branch conflicts with main and cannot merge; rebase and keep main's constant as the one bound for the loop and for complete.

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.

Automated review (maintainer link)

Comment thread packages/cli/api/doctor/_adapter.mjs Resolved
@josephfarina
josephfarina force-pushed the fix/doctor-one-mode-page-color branch from 1700ea0 to e209bdb Compare November 19, 2026 21:01
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec e209bdb

@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: 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 skippedLinks and outputAtRootsOnly options (theme-checks.mjs:4364-4371), so a page painted from a linked folder or file, or from an app folder named build, dist or coverage, 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 Theme paints 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, dist or coverage (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-stylesheets probe: 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 Theme or 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.
  • 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 with main and 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.

Automated review (maintainer link)

Comment on lines +4364 to +4371
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;

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.

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.

Comment on lines +3158 to +3162
else if (
a.value?.type === 'JSXExpressionContainer' &&
/^JSX(?:Element|Fragment)$/.test(a.value.expression?.type ?? '')
)
judge(a.value.expression);

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

@josephfarina
josephfarina force-pushed the fix/doctor-one-mode-page-color branch from e209bdb to 646e645 Compare November 19, 2026 22:33
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 646e645

@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: 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 skippedLinks and outputAtRootsOnly options (theme-checks.mjs:4372-4377), so a page painted from a linked folder or file, or from an app folder named build, dist or coverage, 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 Theme paints 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, dist or coverage (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-stylesheets probe, 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 Theme or 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.
  • 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-4171 and :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.

Automated review (maintainer link)

*/
function pageColorDeclaration(css) {
return (
customPropertyValues(css).get('--color-background-body')?.at(-1) ?? 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: 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.

@github-actions
github-actions Bot deleted the fix/doctor-one-mode-page-color branch November 23, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — 646e645c 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